the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 46 lines 1.4 kB view raw
1#include "stdafx.h" 2#include "net.minecraft.world.level.h" 3#include "net.minecraft.world.level.tile.h" 4#include "ReedsFeature.h" 5 6bool ReedsFeature::place(Level *level, Random *random, int x, int y, int z) 7{ 8 for (int i = 0; i < 20; i++) 9 { 10 int x2 = x + random->nextInt(4) - random->nextInt(4); 11 int y2 = y; 12 int z2 = z + random->nextInt(4) - random->nextInt(4); 13 14 // 4J Stu Added to stop reed features generating areas previously place by game rule generation 15 if(app.getLevelGenerationOptions() != NULL) 16 { 17 LevelGenerationOptions *levelGenOptions = app.getLevelGenerationOptions(); 18 bool intersects = levelGenOptions->checkIntersects(x2, y2, z2, x2, y2, z2); 19 if(intersects) 20 { 21 //app.DebugPrintf("Skipping reeds feature generation as it overlaps a game rule structure\n"); 22 continue; 23 } 24 } 25 if (level->isEmptyTile(x2, y2, z2)) 26 { 27 if (level->getMaterial(x2-1, y2-1, z2) == Material::water || 28 level->getMaterial(x2+1, y2-1, z2) == Material::water || 29 level->getMaterial(x2, y2-1, z2-1) == Material::water || 30 level->getMaterial(x2, y2-1, z2+1) == Material::water) 31 { 32 33 int h = 2 + random->nextInt(random->nextInt(3) + 1); 34 for (int yy = 0; yy < h; yy++) 35 { 36 if ( Tile::reeds->canSurvive(level, x2, y2 + yy, z2) ) 37 { 38 level->setTileAndData(x2, y2 + yy, z2, Tile::reeds_Id, 0, Tile::UPDATE_CLIENTS); 39 } 40 } 41 } 42 } 43 } 44 45 return true; 46}