the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "net.minecraft.world.level.h"
3#include "net.minecraft.world.level.tile.h"
4#include "TallGrassFeature.h"
5
6TallGrassFeature::TallGrassFeature(int tile, int type)
7{
8 this->tile = tile;
9 this->type = type;
10}
11
12bool TallGrassFeature::place(Level *level, Random *random, int x, int y, int z)
13{
14 int t = 0;
15 while (((t = level->getTile(x, y, z)) == 0 || t == Tile::leaves_Id) && y > 0)
16 y--;
17
18 for (int i = 0; i < 128; i++)
19 {
20 int x2 = x + random->nextInt(8) - random->nextInt(8);
21 int y2 = y + random->nextInt(4) - random->nextInt(4);
22 int z2 = z + random->nextInt(8) - random->nextInt(8);
23 if (level->isEmptyTile(x2, y2, z2))
24 {
25 if (Tile::tiles[tile]->canSurvive(level, x2, y2, z2))
26 {
27 level->setTileAndData(x2, y2, z2, tile, type, Tile::UPDATE_CLIENTS);
28 }
29 }
30 }
31
32 return true;
33}