the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#pragma once
2#include "Tile.h"
3
4class PistonBaseTile : public Tile
5{
6public:
7 static const int EXTENDED_BIT = 8;
8 static const int UNDEFINED_FACING = 7;
9
10 static const float PLATFORM_THICKNESS;
11 static const int MAX_PUSH_DEPTH = 12;
12 static const int TRIGGER_EXTEND = 0;
13 static const int TRIGGER_CONTRACT = 1;
14
15 static const wstring EDGE_TEX;
16 static const wstring PLATFORM_TEX;
17 static const wstring PLATFORM_STICKY_TEX;
18 static const wstring BACK_TEX;
19 static const wstring INSIDE_TEX;
20
21private:
22 bool isSticky;
23
24 Icon *iconInside;
25 Icon *iconBack;
26 Icon *iconPlatform;
27
28 static DWORD tlsIdx;
29 // 4J - was just a static but implemented with TLS for our version
30 static bool ignoreUpdate();
31 static void ignoreUpdate(bool set);
32
33public:
34 PistonBaseTile(int id, bool isSticky);
35
36 Icon *getPlatformTexture();
37 virtual void updateShape(float x0, float y0, float z0, float x1, float y1, float z1);
38
39 virtual Icon *getTexture(int face, int data);
40 static Icon *getTexture(const wstring &name);
41 void registerIcons(IconRegister *iconRegister);
42
43 virtual int getRenderShape();
44 virtual bool isSolidRender(bool isServerLevel = false);
45 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
46 virtual void setPlacedBy(Level *level, int x, int y, int z, shared_ptr<LivingEntity> by, shared_ptr<ItemInstance> itemInstance);
47 virtual void neighborChanged(Level *level, int x, int y, int z, int type);
48 virtual void onPlace(Level *level, int x, int y, int z);
49
50private:
51 void checkIfExtend(Level *level, int x, int y, int z);
52 bool getNeighborSignal(Level *level, int x, int y, int z, int facing);
53
54public:
55 virtual bool triggerEvent(Level *level, int x, int y, int z, int param1, int facing);
56 virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr<TileEntity> forceEntity = shared_ptr<TileEntity>()); // 4J added forceData, forceEntity param
57 virtual void updateDefaultShape();
58 virtual void addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr<Entity> source);
59 virtual AABB *getAABB(Level *level, int x, int y, int z);
60 virtual bool isCubeShaped();
61
62 static int getFacing(int data);
63 static bool isExtended(int data);
64 static int getNewFacing(Level *level, int x, int y, int z, shared_ptr<LivingEntity> player);
65private:
66 static bool isPushable(int block, Level *level, int cx, int cy, int cz, bool allowDestroyable);
67 static bool canPush(Level *level, int sx, int sy, int sz, int facing);
68 static void stopSharingIfServer(Level *level, int x, int y, int z); // 4J added
69
70 bool createPush(Level *level, int sx, int sy, int sz, int facing);
71};