the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at master 68 lines 2.1 kB view raw
1#pragma once 2 3#include "EntityTile.h" 4#include "CompoundTag.h" 5#include "TileEntity.h" 6 7class CompoundTag; 8class ChunkRebuildData; 9 10class RecordPlayerTile : public EntityTile 11{ 12 friend class Tile; 13 friend class ChunkRebuildData; 14public: 15 class Entity : public TileEntity 16 { 17public: 18 eINSTANCEOF GetType() { return eTYPE_RECORDPLAYERTILE; } 19 static TileEntity *create() { return new RecordPlayerTile::Entity(); } 20 21 public: 22 int record; 23 Entity() : TileEntity(), record( 0 ) {} 24 25 virtual void load(CompoundTag *tag) 26 { 27 TileEntity::load(tag); 28 record = tag->getInt(L"Record"); 29 } 30 31 virtual void save(CompoundTag *tag) 32 { 33 TileEntity::save(tag); 34 if (record > 0) tag->putInt(L"Record", record); 35 // return true; // 4J - TODO, in java there is no return type here but we can't change our derived class member function to not have one - investigate 36 // 4J Jev, took out the return statement, TileEntity::save is now virtual. Think this fixes above. 37 } 38 39 // 4J Added 40 shared_ptr<TileEntity> clone() 41 { 42 shared_ptr<RecordPlayerTile::Entity> result = shared_ptr<RecordPlayerTile::Entity>( new RecordPlayerTile::Entity() ); 43 TileEntity::clone(result); 44 45 result->record = record; 46 47 return result; 48 } 49 }; 50 51private: 52 Icon *iconTop; 53 54protected: 55 RecordPlayerTile(int id); 56 57public: 58 virtual Icon *getTexture(int face, int data); 59 virtual bool TestUse(Level *level, int x, int y, int z, shared_ptr<Player> player); 60 virtual bool use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param 61 void setRecord(Level *level, int x, int y, int z, int record); 62 void dropRecording(Level *level, int x, int y, int z); 63 virtual void onRemove(Level *level, int x, int y, int z, int id, int data); 64 virtual void spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonus); 65 66 virtual shared_ptr<TileEntity> newTileEntity(Level *level); 67 void registerIcons(IconRegister *iconRegister); 68};