the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 87 lines 1.7 kB view raw
1#include "stdafx.h" 2#include "net.minecraft.world.level.h" 3#include "GrassTile.h" 4#include "Bush.h" 5 6void Bush::_init() 7{ 8 setTicking(true); 9 updateDefaultShape(); 10} 11 12Bush::Bush(int id, Material *material) : Tile(id, material, isSolidRender()) 13{ 14 _init(); 15} 16 17Bush::Bush(int id) : Tile(id, Material::plant, isSolidRender()) 18{ 19 _init(); 20} 21 22// 4J Added override 23void Bush::updateDefaultShape() 24{ 25 float ss = 0.2f; 26 setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, ss * 3, 0.5f + ss); 27} 28 29bool Bush::mayPlace(Level *level, int x, int y, int z) 30{ 31 return Tile::mayPlace(level, x, y, z) && mayPlaceOn(level->getTile(x, y - 1, z)); 32} 33 34bool Bush::mayPlaceOn(int tile) 35{ 36 return tile == Tile::grass_Id || tile == Tile::dirt_Id || tile == Tile::farmland_Id; 37} 38 39void Bush::neighborChanged(Level *level, int x, int y, int z, int type) 40{ 41 Tile::neighborChanged(level, x, y, z, type); 42 checkAlive(level, x, y, z); 43} 44 45void Bush::tick(Level *level, int x, int y, int z, Random *random) 46{ 47 checkAlive(level, x, y, z); 48} 49 50void Bush::checkAlive(Level *level, int x, int y, int z) 51{ 52 if (!canSurvive(level, x, y, z)) 53 { 54 this->spawnResources(level, x, y, z, level->getData(x, y, z), 0); 55 level->setTileAndData(x, y, z, 0, 0, UPDATE_CLIENTS); 56 } 57} 58 59bool Bush::canSurvive(Level *level, int x, int y, int z) 60{ 61 return ( level->getDaytimeRawBrightness(x, y, z) >= 8 || (level->canSeeSky(x, y, z))) && mayPlaceOn(level->getTile(x, y - 1, z)); 62} 63 64AABB *Bush::getAABB(Level *level, int x, int y, int z) 65{ 66 return NULL; 67} 68 69bool Bush::blocksLight() 70{ 71 return false; 72} 73 74bool Bush::isSolidRender(bool isServerLevel) 75{ 76 return false; 77} 78 79bool Bush::isCubeShaped() 80{ 81 return false; 82} 83 84int Bush::getRenderShape() 85{ 86 return Tile::SHAPE_CROSS_TEXTURE; 87}