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 "ThinFenceTile_SPU.h"
3#include "ChunkRebuildData.h"
4
5bool ThinFenceTile_SPU::isSolidRender(bool isServerLevel)
6{
7 return false;
8}
9
10int ThinFenceTile_SPU::getRenderShape()
11{
12 return Tile_SPU::SHAPE_IRON_FENCE;
13}
14
15bool ThinFenceTile_SPU::shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face)
16{
17 int id = level->getTile(x, y, z);
18 if (id == this->id) return false;
19 return Tile_SPU::shouldRenderFace(level, x, y, z, face);
20}
21
22void ThinFenceTile_SPU::updateDefaultShape()
23{
24 setShape(0, 0, 0, 1, 1, 1);
25}
26
27void ThinFenceTile_SPU::updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData, TileEntity* forceEntity) // 4J added forceData, forceEntity param
28{
29 float minX = 7.0f / 16.0f;
30 float maxX = 9.0f / 16.0f;
31 float minZ = 7.0f / 16.0f;
32 float maxZ = 9.0f / 16.0f;
33
34 bool n = attachsTo(level->getTile(x, y, z - 1));
35 bool s = attachsTo(level->getTile(x, y, z + 1));
36 bool w = attachsTo(level->getTile(x - 1, y, z));
37 bool e = attachsTo(level->getTile(x + 1, y, z));
38
39 if ((w && e) || (!w && !e && !n && !s))
40 {
41 minX = 0;
42 maxX = 1;
43 }
44 else if (w && !e)
45 {
46 minX = 0;
47 }
48 else if (!w && e)
49 {
50 maxX = 1;
51 }
52 if ((n && s) || (!w && !e && !n && !s))
53 {
54 minZ = 0;
55 maxZ = 1;
56 }
57 else if (n && !s)
58 {
59 minZ = 0;
60 }
61 else if (!n && s)
62 {
63 maxZ = 1;
64 }
65 setShape(minX, 0, minZ, maxX, 1, maxZ);
66}
67
68Icon_SPU *ThinFenceTile_SPU::getEdgeTexture()
69{
70 if(id == Tile_SPU::ironFence_Id)
71 return &ms_pTileData->ironFence_EdgeTexture;
72 if(id == Tile_SPU::thinGlass_Id)
73 return &ms_pTileData->thinGlass_EdgeTexture;
74#ifndef SN_TARGET_PS3_SPU
75 assert(0);
76#endif
77 return NULL;
78}
79
80bool ThinFenceTile_SPU::attachsTo(int tile)
81{
82 return ms_pTileData->solid[tile] || tile == id || tile == Tile_SPU::glass_Id;
83}