the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 43 lines 1.2 kB view raw
1#include "stdafx.h" 2#include "net.minecraft.world.level.h" 3#include "net.minecraft.world.level.tile.h" 4#include "GroundBushFeature.h" 5 6GroundBushFeature::GroundBushFeature(int trunkType, int leafType) 7{ 8 trunkTileType = trunkType; 9 leafTileType = leafType; 10} 11 12bool GroundBushFeature::place(Level *level, Random *random, int x, int y, int z) 13{ 14 PIXBeginNamedEvent(0,"Placing GroundBushFeature"); 15 int t = 0; 16 while (((t = level->getTile(x, y, z)) == 0 || t == Tile::leaves_Id) && y > 0) 17 y--; 18 19 int tile = level->getTile(x, y, z); 20 if (tile == Tile::dirt_Id || tile == Tile::grass_Id) 21 { 22 y++; 23 placeBlock(level, x, y, z, Tile::treeTrunk_Id, trunkTileType); 24 25 for (int yy = y; yy <= y + 2; yy++) 26 { 27 int yo = yy - y; 28 int offs = 2 - yo; 29 for (int xx = x - offs; xx <= x + offs; xx++) 30 { 31 int xo = xx - (x); 32 for (int zz = z - offs; zz <= z + offs; zz++) 33 { 34 int zo = zz - (z); 35 if (abs(xo) == offs && abs(zo) == offs && random->nextInt(2) == 0) continue; 36 if (!Tile::solid[level->getTile(xx, yy, zz)]) placeBlock(level, xx, yy, zz, Tile::leaves_Id, leafTileType); 37 } 38 } 39 } 40 } 41 PIXEndNamedEvent(); 42 return true; 43}