Fixed iridium oregen. Closes #1330

This commit is contained in:
drcrazy 2017-11-13 18:29:16 +03:00
parent 150fb2a2c4
commit ffe115bee1

View file

@ -218,21 +218,27 @@ public class TechRebornWorldGen implements IWorldGenerator {
yPos = ore.minYHeight + random.nextInt(ore.maxYHeight - ore.minYHeight); yPos = ore.minYHeight + random.nextInt(ore.maxYHeight - ore.minYHeight);
zPos = chunkZ * 16 + random.nextInt(16); zPos = chunkZ * 16 + random.nextInt(16);
BlockPos pos = new BlockPos(xPos, yPos, zPos); BlockPos pos = new BlockPos(xPos, yPos, zPos);
if (ore.blockNiceName.equalsIgnoreCase("iridium")) { //Work around for iridium
BlockPos iridiumPos = pos.add(8, 0, 8); // standard worldgen offset is added here like in WorldGenMinable#generate if (ore.veinSize < 4){
IBlockState blockState = world.getBlockState(iridiumPos); // Workaround for small veins
if (blockState.getBlock().isReplaceableOreGen(blockState, world, iridiumPos, predicate)) { for (int j = 1; j < ore.veinSize; j++) {
world.setBlockState(iridiumPos, ore.state, 2); // standard worldgen offset is added here like in WorldGenMinable#generate
} BlockPos smallVeinPos = pos.add(8, 0, 8);
smallVeinPos.add(random.nextInt(2), random.nextInt(2), random.nextInt(2));
IBlockState blockState = world.getBlockState(smallVeinPos);
if (blockState.getBlock().isReplaceableOreGen(blockState, world, smallVeinPos, predicate)) {
world.setBlockState(smallVeinPos, ore.state, 2);
}
}
} else { } else {
try { try {
worldGenMinable.generate(world, random, pos); worldGenMinable.generate(world, random, pos);
} catch (ArrayIndexOutOfBoundsException e) { } catch (ArrayIndexOutOfBoundsException e) {
Core.logHelper.error("Something bad is happening during world gen the ore " + ore.blockNiceName + " caused a crash when generating. Report this to the TechReborn devs with a log"); Core.logHelper.error("Something bad is happening during world gen the ore "
+ ore.blockNiceName
+ " caused a crash when generating. Report this to the TechReborn devs with a log");
} }
} }
} }
} }
} }
@ -242,8 +248,7 @@ public class TechRebornWorldGen implements IWorldGenerator {
boolean isValidSpawn = false; boolean isValidSpawn = false;
Biome biomeGenBase = world.getBiomeForCoordsBody(new BlockPos(chunkX * 16, 72, chunkZ * 16)); Biome biomeGenBase = world.getBiomeForCoordsBody(new BlockPos(chunkX * 16, 72, chunkZ * 16));
if (BiomeDictionary.hasType(biomeGenBase, BiomeDictionary.Type.SWAMP)) { if (BiomeDictionary.hasType(biomeGenBase, BiomeDictionary.Type.SWAMP)) {
// TODO check the config file for bounds on this, might cause // TODO check the config file for bounds on this, might cause issues
// issues
chance -= random.nextInt(10) + 10; chance -= random.nextInt(10) + 10;
isValidSpawn = true; isValidSpawn = true;
} }