the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#pragma once
2using namespace std;
3
4#include "HashExtension.h"
5#include "..\Minecraft.World\JavaIntHash.h"
6
7class Level;
8class Packet;
9class CompoundTag;
10
11typedef TileEntity *(*tileEntityCreateFn)();
12
13class TileEntity : public enable_shared_from_this<TileEntity>
14{
15public:
16 static void staticCtor();
17 virtual eINSTANCEOF GetType() { return eTYPE_TILEENTITY; }
18private:
19 typedef unordered_map<wstring, tileEntityCreateFn> idToCreateMapType;
20 typedef unordered_map<eINSTANCEOF, wstring, eINSTANCEOFKeyHash, eINSTANCEOFKeyEq> classToIdMapType;
21 static idToCreateMapType idCreateMap;
22 static classToIdMapType classIdMap;
23 static void setId(tileEntityCreateFn createFn, eINSTANCEOF clas, wstring id);
24 bool remove;
25 unsigned char renderRemoveStage; // 4J added
26
27public:
28 Level *level;
29 int x, y, z;
30
31 // 4J added
32 enum RenderRemoveStage
33 {
34 e_RenderRemoveStageKeep,
35 e_RenderRemoveStageFlaggedAtChunk,
36 e_RenderRemoveStageRemove
37 };
38
39 int data;
40 Tile *tile;
41
42public:
43 // 4J Java does not have a ctor, but we need one to do some initialisation of the member variables
44 TileEntity();
45 virtual ~TileEntity() {}
46
47 void setRenderRemoveStage(unsigned char stage); // 4J added
48 void upgradeRenderRemoveStage(); // 4J added
49 bool shouldRemoveForRender(); // 4J added
50
51 virtual Level *getLevel();
52 virtual void setLevel(Level *level);
53 virtual bool hasLevel();
54 virtual void load(CompoundTag *tag);
55 virtual void save(CompoundTag *tag);
56 virtual void tick();
57 static shared_ptr<TileEntity> loadStatic(CompoundTag *tag);
58 virtual int getData();
59 virtual void setData(int data, int updateFlags);
60 virtual void setChanged();
61 virtual double distanceToSqr(double xPlayer, double yPlayer, double zPlayer);
62 virtual double getViewDistance();
63 virtual Tile *getTile();
64 virtual shared_ptr<Packet> getUpdatePacket();
65 virtual bool isRemoved();
66 virtual void setRemoved();
67 virtual void clearRemoved();
68 virtual bool triggerEvent(int b0, int b1);
69 virtual void clearCache();
70
71 // 4J Added
72 virtual shared_ptr<TileEntity> clone() = 0;
73protected:
74 void clone(shared_ptr<TileEntity> tileEntity);
75};