mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-03-11 20:25:36 +00:00
fixing two common worldgen cascades in meteorites and flowers
This commit is contained in:
parent
9ba40044ed
commit
278a7b5dfb
@ -576,8 +576,8 @@ public class HbmWorldGen implements IWorldGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(WorldConfig.meteoriteSpawn > 0 && rand.nextInt(WorldConfig.meteoriteSpawn) == 0) {
|
if(WorldConfig.meteoriteSpawn > 0 && rand.nextInt(WorldConfig.meteoriteSpawn) == 0) {
|
||||||
int x = i + rand.nextInt(16);
|
int x = i + rand.nextInt(16) + 8;
|
||||||
int z = j + rand.nextInt(16);
|
int z = j + rand.nextInt(16) + 8;
|
||||||
int y = world.getHeightValue(x, z) - rand.nextInt(10);
|
int y = world.getHeightValue(x, z) - rand.nextInt(10);
|
||||||
if(y > 1) (new Meteorite()).generate(world, rand, x, y, z, false, false, false);
|
if(y > 1) (new Meteorite()).generate(world, rand, x, y, z, false, false, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,12 +13,12 @@ import net.minecraft.world.gen.feature.WorldGenFlowers;
|
|||||||
import net.minecraft.world.gen.feature.WorldGenMinable;
|
import net.minecraft.world.gen.feature.WorldGenMinable;
|
||||||
|
|
||||||
public class DungeonToolbox {
|
public class DungeonToolbox {
|
||||||
|
|
||||||
public static void generateBox(World world, int x, int y, int z, int sx, int sy, int sz, List<MetaBlock> blocks) {
|
public static void generateBox(World world, int x, int y, int z, int sx, int sy, int sz, List<MetaBlock> blocks) {
|
||||||
|
|
||||||
if(blocks.isEmpty())
|
if(blocks.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(int i = x; i < x + sx; i++) {
|
for(int i = x; i < x + sx; i++) {
|
||||||
for(int j = y; j < y + sy; j++) {
|
for(int j = y; j < y + sy; j++) {
|
||||||
for(int k = z; k < z + sz; k++) {
|
for(int k = z; k < z + sz; k++) {
|
||||||
@ -28,68 +28,68 @@ public class DungeonToolbox {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void generateBox(World world, int x, int y, int z, int sx, int sy, int sz, Block block) {
|
public static void generateBox(World world, int x, int y, int z, int sx, int sy, int sz, Block block) {
|
||||||
generateBox(world, x, y, z, sx, sy, sz, new MetaBlock(block));
|
generateBox(world, x, y, z, sx, sy, sz, new MetaBlock(block));
|
||||||
}
|
}
|
||||||
|
|
||||||
//i know it's copy paste, but it's a better strat than using a wrapper and generating single-entry lists for no good reason
|
//i know it's copy paste, but it's a better strat than using a wrapper and generating single-entry lists for no good reason
|
||||||
public static void generateBox(World world, int x, int y, int z, int sx, int sy, int sz, MetaBlock block) {
|
public static void generateBox(World world, int x, int y, int z, int sx, int sy, int sz, MetaBlock block) {
|
||||||
|
|
||||||
for(int i = x; i < x + sx; i++) {
|
for(int i = x; i < x + sx; i++) {
|
||||||
|
|
||||||
for(int j = y; j < y + sy; j++) {
|
for(int j = y; j < y + sy; j++) {
|
||||||
|
|
||||||
for(int k = z; k < z + sz; k++) {
|
for(int k = z; k < z + sz; k++) {
|
||||||
|
|
||||||
world.setBlock(i, j, k, block.block, block.meta, 2);
|
world.setBlock(i, j, k, block.block, block.meta, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//now with vectors to provide handy rotations
|
//now with vectors to provide handy rotations
|
||||||
public static void generateBox(World world, int x, int y, int z, Vec3 size, List<MetaBlock> blocks) {
|
public static void generateBox(World world, int x, int y, int z, Vec3 size, List<MetaBlock> blocks) {
|
||||||
|
|
||||||
generateBox(world, x, y, z, (int)size.xCoord, (int)size.yCoord, (int)size.zCoord, blocks);
|
generateBox(world, x, y, z, (int)size.xCoord, (int)size.yCoord, (int)size.zCoord, blocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> T getRandom(List<T> list, Random rand) {
|
public static <T> T getRandom(List<T> list, Random rand) {
|
||||||
|
|
||||||
if(list.isEmpty())
|
if(list.isEmpty())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return list.get(rand.nextInt(list.size()));
|
return list.get(rand.nextInt(list.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void generateOre(World world, Random rand, int chunkX, int chunkZ, int veinCount, int amount, int minHeight, int variance, Block ore) {
|
public static void generateOre(World world, Random rand, int chunkX, int chunkZ, int veinCount, int amount, int minHeight, int variance, Block ore) {
|
||||||
generateOre(world, rand, chunkX, chunkZ, veinCount, amount, minHeight, variance, ore, 0, Blocks.stone);
|
generateOre(world, rand, chunkX, chunkZ, veinCount, amount, minHeight, variance, ore, 0, Blocks.stone);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void generateOre(World world, Random rand, int chunkX, int chunkZ, int veinCount, int amount, int minHeight, int variance, Block ore, int meta) {
|
public static void generateOre(World world, Random rand, int chunkX, int chunkZ, int veinCount, int amount, int minHeight, int variance, Block ore, int meta) {
|
||||||
generateOre(world, rand, chunkX, chunkZ, veinCount, amount, minHeight, variance, ore, meta, Blocks.stone);
|
generateOre(world, rand, chunkX, chunkZ, veinCount, amount, minHeight, variance, ore, meta, Blocks.stone);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void generateOre(World world, Random rand, int chunkX, int chunkZ, int veinCount, int amount, int minHeight, int variance, Block ore, Block target) {
|
public static void generateOre(World world, Random rand, int chunkX, int chunkZ, int veinCount, int amount, int minHeight, int variance, Block ore, Block target) {
|
||||||
generateOre(world, rand, chunkX, chunkZ, veinCount, amount, minHeight, variance, ore, 0, target);
|
generateOre(world, rand, chunkX, chunkZ, veinCount, amount, minHeight, variance, ore, 0, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void generateOre(World world, Random rand, int chunkX, int chunkZ, int veinCount, int amount, int minHeight, int variance, Block ore, int meta, Block target) {
|
public static void generateOre(World world, Random rand, int chunkX, int chunkZ, int veinCount, int amount, int minHeight, int variance, Block ore, int meta, Block target) {
|
||||||
|
|
||||||
for(int i = 0; i < veinCount; i++) {
|
for(int i = 0; i < veinCount; i++) {
|
||||||
|
|
||||||
int x = chunkX + rand.nextInt(16);
|
int x = chunkX + rand.nextInt(16);
|
||||||
int y = minHeight + (variance > 0 ? rand.nextInt(variance) : 0);
|
int y = minHeight + (variance > 0 ? rand.nextInt(variance) : 0);
|
||||||
int z = chunkZ + rand.nextInt(16);
|
int z = chunkZ + rand.nextInt(16);
|
||||||
|
|
||||||
(new WorldGenMinable(ore, meta, amount, target)).generate(world, rand, x, y, z);
|
(new WorldGenMinable(ore, meta, amount, target)).generate(world, rand, x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static WorldGenFlowers genFlowers = new WorldGenFlowers(null);
|
private static WorldGenFlowers genFlowers = new WorldGenFlowers(null);
|
||||||
public static void generateFlowers(World world, Random rand, int chunkX, int chunkZ, Block flower, int meta) {
|
public static void generateFlowers(World world, Random rand, int chunkX, int chunkZ, Block flower, int meta) {
|
||||||
int x = chunkX + rand.nextInt(16);
|
int x = chunkX + rand.nextInt(16) + 8;
|
||||||
int z = chunkZ + rand.nextInt(16);
|
int z = chunkZ + rand.nextInt(16) + 8;
|
||||||
int y = world.getHeightValue(x, z);
|
int y = world.getHeightValue(x, z);
|
||||||
genFlowers.func_150550_a(flower, meta);
|
genFlowers.func_150550_a(flower, meta);
|
||||||
genFlowers.generate(world, rand, x, y, z);
|
genFlowers.generate(world, rand, x, y, z);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user