the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 74 lines 2.2 kB view raw
1#include "stdafx.h" 2#include "MycelTile.h" 3#include "net.minecraft.world.level.h" 4#include "net.minecraft.h" 5#include "net.minecraft.world.h" 6 7MycelTile::MycelTile(int id) : Tile(id, Material::grass) 8{ 9 iconTop = NULL; 10 iconSnowSide = NULL; 11 setTicking(true); 12} 13 14Icon *MycelTile::getTexture(int face, int data) 15{ 16 if (face == Facing::UP) return iconTop; 17 if (face == Facing::DOWN) return Tile::dirt->getTexture(face); 18 return icon; 19} 20 21Icon *MycelTile::getTexture(LevelSource *level, int x, int y, int z, int face) 22{ 23 if (face == Facing::UP) return iconTop; 24 if (face == Facing::DOWN) return Tile::dirt->getTexture(face); 25 Material *above = level->getMaterial(x, y + 1, z); 26 if (above == Material::topSnow || above == Material::snow) return iconSnowSide; 27 else return icon; 28} 29 30void MycelTile::registerIcons(IconRegister *iconRegister) 31{ 32 icon = iconRegister->registerIcon(L"mycel_side"); 33 iconTop = iconRegister->registerIcon(L"mycel_top"); 34 iconSnowSide = iconRegister->registerIcon(L"snow_side"); 35} 36 37void MycelTile::tick(Level *level, int x, int y, int z, Random *random) 38{ 39 if (level->isClientSide) return; 40 41 if (level->getRawBrightness(x, y + 1, z) < MIN_BRIGHTNESS && Tile::lightBlock[level->getTile(x, y + 1, z)] > 2) 42 { 43 level->setTileAndUpdate(x, y, z, Tile::dirt_Id); 44 } 45 else 46 { 47 if (level->getRawBrightness(x, y + 1, z) >= Level::MAX_BRIGHTNESS - 6) 48 { 49 for (int i=0; i<4; i++) 50 { 51 int xt = x + random->nextInt(3) - 1; 52 int yt = y + random->nextInt(5) - 3; 53 int zt = z + random->nextInt(3) - 1; 54 int above = level->getTile(xt, yt + 1, zt); 55 if (level->getTile(xt, yt, zt) == Tile::dirt_Id && level->getRawBrightness(xt, yt + 1, zt) >= MIN_BRIGHTNESS && Tile::lightBlock[above] <= 2) 56 { 57 level->setTileAndUpdate(xt, yt, zt, id); 58 } 59 } 60 } 61 } 62} 63 64void MycelTile::animateTick(Level *level, int x, int y, int z, Random *random) 65{ 66 Tile::animateTick(level, x, y, z, random); 67 if (random->nextInt(10) == 0) level->addParticle(eParticleType_townaura, x + random->nextFloat(), y + 1.1f, z + random->nextFloat(), 0, 0, 0); 68 69} 70 71int MycelTile::getResource(int data, Random *random, int playerBonusLevel) 72{ 73 return Tile::dirt->getResource(0, random, playerBonusLevel); 74}