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_SPU.h"
3
4
5class ButtonTile_SPU : public Tile_SPU
6{
7
8public:
9 ButtonTile_SPU(int id) : Tile_SPU(id) {}
10
11 Icon_SPU *getTexture(int face, int data)
12 {
13 if(id == Tile_SPU::button_wood_Id)
14 return TileRef_SPU(wood_Id)->getTexture(Facing::UP);
15 else
16 return TileRef_SPU(rock_Id)->getTexture(Facing::UP);
17 }
18 virtual bool blocksLight() { return false; }
19 virtual bool isSolidRender(bool isServerLevel = false) { return false; }
20 virtual bool isCubeShaped() { return false; }
21 virtual void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param
22 {
23 int data = level->getData(x, y, z);
24 int dir = data & 7;
25 bool pressed = (data & 8) > 0;
26
27 float h0 = 6 / 16.0f;
28 float h1 = 10 / 16.0f;
29 float r = 3 / 16.0f;
30 float d = 2 / 16.0f;
31 if (pressed) d = 1 / 16.0f;
32
33 if (dir == 1)
34 {
35 setShape(0, h0, 0.5f - r, d, h1, 0.5f + r);
36 } else if (dir == 2)
37 {
38 setShape(1 - d, h0, 0.5f - r, 1, h1, 0.5f + r);
39 } else if (dir == 3)
40 {
41 setShape(0.5f - r, h0, 0, 0.5f + r, h1, d);
42 } else if (dir == 4)
43 {
44 setShape(0.5f - r, h0, 1 - d, 0.5f + r, h1, 1);
45 }
46 }
47 virtual void updateDefaultShape()
48 {
49 float x = 3 / 16.0f;
50 float y = 2 / 16.0f;
51 float z = 2 / 16.0f;
52 setShape(0.5f - x, 0.5f - y, 0.5f - z, 0.5f + x, 0.5f + y, 0.5f + z);
53 }
54};