the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "HalfSlabTile_SPU.h"
3#include "Facing_SPU.h"
4#include "ChunkRebuildData.h"
5
6void HalfSlabTile_SPU::updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData /* = -1 */, TileEntity* forceEntity /* = NULL */)
7{
8 if (fullSize())
9 {
10 setShape(0, 0, 0, 1, 1, 1);
11 }
12 else
13 {
14 bool upper = (level->getData(x, y, z) & TOP_SLOT_BIT) != 0;
15 if (upper)
16 {
17 setShape(0, 0.5f, 0, 1, 1, 1);
18 }
19 else
20 {
21 setShape(0, 0, 0, 1, 0.5f, 1);
22 }
23 }
24}
25
26void HalfSlabTile_SPU::updateDefaultShape()
27{
28 if (fullSize())
29 {
30 setShape(0, 0, 0, 1, 1, 1);
31 }
32 else
33 {
34 setShape(0, 0, 0, 1, 0.5f, 1);
35 }
36}
37
38bool HalfSlabTile_SPU::isSolidRender(bool isServerLevel)
39{
40 return fullSize();
41}
42
43bool HalfSlabTile_SPU::shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face)
44{
45 if (fullSize()) return Tile_SPU::shouldRenderFace(level, x, y, z, face);
46
47 if (face != Facing::UP && face != Facing::DOWN && !Tile_SPU::shouldRenderFace(level, x, y, z, face))
48 {
49 return false;
50 }
51
52 int ox = x, oy = y, oz = z;
53 ox += Facing::STEP_X[Facing::OPPOSITE_FACING[face]];
54 oy += Facing::STEP_Y[Facing::OPPOSITE_FACING[face]];
55 oz += Facing::STEP_Z[Facing::OPPOSITE_FACING[face]];
56
57 bool isUpper = (level->getData(ox, oy, oz) & TOP_SLOT_BIT) != 0;
58 if (isUpper)
59 {
60 if (face == Facing::DOWN) return true;
61 if (face == Facing::UP && Tile_SPU::shouldRenderFace(level, x, y, z, face)) return true;
62 return !(isHalfSlab(level->getTile(x, y, z)) && (level->getData(x, y, z) & TOP_SLOT_BIT) != 0);
63 }
64 else
65 {
66 if (face == Facing::UP) return true;
67 if (face == Facing::DOWN && Tile_SPU::shouldRenderFace(level, x, y, z, face)) return true;
68 return !(isHalfSlab(level->getTile(x, y, z)) && (level->getData(x, y, z) & TOP_SLOT_BIT) == 0);
69 }
70}
71
72bool HalfSlabTile_SPU::isHalfSlab(int tileId)
73{
74 return tileId == Tile_SPU::stoneSlabHalf_Id || tileId == Tile_SPU::woodSlabHalf_Id;
75}
76
77