the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 61 lines 1.8 kB view raw
1#pragma once 2 3#include "Tile_SPU.h" 4#include "ChunkRebuildData.h" 5 6class TopSnowTile_SPU : public Tile_SPU 7{ 8public: 9 static const int MAX_HEIGHT = 6; 10 static const int HEIGHT_MASK = 7; 11 12 TopSnowTile_SPU(int id) : Tile_SPU(id) {} 13 14 bool blocksLight() { return false; } 15 bool isSolidRender(bool isServerLevel = false) { return false; } 16 bool isCubeShaped() { return false; } 17 void updateShape(ChunkRebuildData *level, int x, int y, int z, int forceData = -1, TileEntity* forceEntity = NULL) // 4J added forceData, forceEntity param 18 { 19 int height = level->getData(x, y, z) & HEIGHT_MASK; 20 float o = 2 * (1 + height) / 16.0f; 21 setShape(0, 0, 0, 1, o, 1); 22 } 23 bool shouldRenderFace(ChunkRebuildData *level, int x, int y, int z, int face) 24 { 25 // Material m = level.getMaterial(x, y, z); 26 if (face == 1) return true; 27 // 4J - don't render faces if neighbouring tiles are also TopSnowTile with at least the same height as this one 28 // Otherwise we get horrible artifacts from the non-manifold geometry created. Fixes bug #8506 29 if ( ( level->getTile(x,y,z) == Tile_SPU::topSnow_Id ) && ( face >= 2 ) ) 30 { 31 int h0 = level->getData(x,y,z) & HEIGHT_MASK; 32 int xx = x; 33 int yy = y; 34 int zz = z; 35 // Work out coords of tile who's face we're considering (rather than it's neighbour which is passed in here as x,y,z already 36 // offsetting by the face direction) 37 switch(face) 38 { 39 case 2: 40 zz += 1; 41 break; 42 case 3: 43 zz -= 1; 44 break; 45 case 4: 46 xx += 1; 47 break; 48 case 5: 49 xx -= 1; 50 break; 51 default: 52 break; 53 } 54 int h1 = level->getData(xx,yy,zz) & HEIGHT_MASK; 55 if( h0 >= h1 ) return false; 56 } 57 // if (m == this.material) return false; 58 return Tile_SPU::shouldRenderFace(level, x, y, z, face); 59 60 } 61};