the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 76 lines 2.1 kB view raw
1#include "stdafx.h" 2#include "WaterLilyTile.h" 3#include "net.minecraft.world.level.h" 4#include "net.minecraft.world.entity.item.h" 5#include "..\Minecraft.Client\Minecraft.h" 6#include "AABB.h" 7 8WaterlilyTile::WaterlilyTile(int id) : Bush(id) 9{ 10 this->updateDefaultShape(); 11} 12 13// 4J Added override 14void WaterlilyTile::updateDefaultShape() 15{ 16 float ss = 0.5f; 17 float hh = 0.25f / 16.0f; 18 setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, hh, 0.5f + ss); 19} 20 21int WaterlilyTile::getRenderShape() 22{ 23 return Tile::SHAPE_LILYPAD; 24} 25 26void WaterlilyTile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxes, shared_ptr<Entity> source) 27{ 28 if (source == NULL || !source->instanceof(eTYPE_BOAT)) 29 { 30 Bush::addAABBs(level, x, y, z, box, boxes, source); 31 } 32} 33 34AABB *WaterlilyTile::getAABB(Level *level, int x, int y, int z) 35{ 36 ThreadStorage *tls = (ThreadStorage *)TlsGetValue(Tile::tlsIdxShape); 37 // 4J Stu - Added this so that the TLS shape is correct for this tile 38 if(tls->tileId != this->id) updateDefaultShape(); 39 return AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + tls->yy1, z + tls->zz1); 40} 41 42int WaterlilyTile::getColor() const 43{ 44 return Minecraft::GetInstance()->getColourTable()->getColor(eMinecraftColour_Tile_WaterLily); //0x208030 45} 46 47int WaterlilyTile::getColor(int auxData) 48{ 49 return Minecraft::GetInstance()->getColourTable()->getColor(eMinecraftColour_Tile_WaterLily); //0x208030 50} 51 52int WaterlilyTile::getColor(LevelSource *level, int x, int y, int z) 53{ 54 return Minecraft::GetInstance()->getColourTable()->getColor(eMinecraftColour_Tile_WaterLily); //0x208030 55} 56 57int WaterlilyTile::getColor(LevelSource *level, int x, int y, int z, int data) //0x208030 58{ 59 return getColor(level, x, y, z); 60} 61 62bool WaterlilyTile::mayPlaceOn(int tile) 63{ 64 return tile == Tile::calmWater_Id; 65} 66 67bool WaterlilyTile::canSurvive(Level *level, int x, int y, int z) 68{ 69 if (y < 0 || y >= Level::maxBuildHeight) return false; 70 return level->getMaterial(x, y - 1, z) == Material::water && level->getData(x, y - 1, z) == 0; 71} 72 73bool WaterlilyTile::growTree(Level *level, int x, int y, int z, Random *random) 74{ 75 return false; 76}