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 "SpringFeature.h"
5
6SpringFeature::SpringFeature(int tile)
7{
8 this->tile = tile;
9}
10
11bool SpringFeature::place(Level *level, Random *random, int x, int y, int z)
12{
13 // 4J Stu Added to stop spring features generating areas previously place by game rule generation
14 if(app.getLevelGenerationOptions() != NULL)
15 {
16 LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions();
17 bool intersects = levelGenOptions->checkIntersects(x, y, z, x, y, z);
18 if(intersects)
19 {
20 //app.DebugPrintf("Skipping spring feature generation as it overlaps a game rule structure\n");
21 return false;
22 }
23 }
24
25 if (level->getTile(x, y + 1, z) != Tile::stone_Id) return false;
26 if (level->getTile(x, y - 1, z) != Tile::stone_Id) return false;
27
28 if (level->getTile(x, y, z) != 0 && level->getTile(x, y, z) != Tile::stone_Id) return false;
29
30 int rockCount = 0;
31 if (level->getTile(x - 1, y, z) == Tile::stone_Id) rockCount++;
32 if (level->getTile(x + 1, y, z) == Tile::stone_Id) rockCount++;
33 if (level->getTile(x, y, z - 1) == Tile::stone_Id) rockCount++;
34 if (level->getTile(x, y, z + 1) == Tile::stone_Id) rockCount++;
35
36 int holeCount = 0;
37 if (level->isEmptyTile(x - 1, y, z)) holeCount++;
38 if (level->isEmptyTile(x + 1, y, z)) holeCount++;
39 if (level->isEmptyTile(x, y, z - 1)) holeCount++;
40 if (level->isEmptyTile(x, y, z + 1)) holeCount++;
41
42 if (rockCount == 3 && holeCount == 1)
43 {
44 level->setTileAndData(x, y, z, tile, 0, Tile::UPDATE_CLIENTS);
45 level->setInstaTick(true);
46 Tile::tiles[tile]->tick(level, x, y, z, random);
47 level->setInstaTick(false);
48 }
49
50 return true;
51}