Allow oregen in non-vanilla dimensions. Closes #1571

This commit is contained in:
drcrazy 2018-08-08 17:00:02 +03:00
parent 1cd5e06757
commit fb957e9dac
2 changed files with 39 additions and 36 deletions

View file

@ -114,8 +114,8 @@ public class TechRebornWorldGen implements IWorldGenerator {
for (OreConfig ore : config) {
if (ore.blockName.equals(defaultOre.blockName) && ore.meta == defaultOre.meta) {
hasFoundOre = true;
ore.state = defaultOre.state; // Should allow for states to
// be saved/loaded
// Should allow for states to be saved/loaded
ore.state = defaultOre.state;
}
}
if (!hasFoundOre) {
@ -194,23 +194,25 @@ public class TechRebornWorldGen implements IWorldGenerator {
boolean genTree = false;
List<OreConfig> list = new ArrayList<>();
Predicate<IBlockState> predicate = BlockMatcher.forBlock(Blocks.STONE);
if (world.provider.isSurfaceWorld()) {
list.addAll(getAllGenOresFromList(config.overworldOres));
genTree = true;
} else if (world.provider.getDimension() == -1) {
if (world.provider.getDimension() == -1) {
list.addAll(getAllGenOresFromList(config.neatherOres));
predicate = BlockMatcher.forBlock(Blocks.NETHERRACK);
} else if (world.provider.getDimension() == 1) {
list.addAll(getAllGenOresFromList(config.endOres));
predicate = BlockMatcher.forBlock(Blocks.END_STONE);
}
else if (config.overworldOresInModdedDims || world.provider.getDimension() == 0) {
list.addAll(getAllGenOresFromList(config.overworldOres));
genTree = true;
}
if (!list.isEmpty() && config.generateOres) {
int xPos, yPos, zPos;
for (OreConfig ore : list) {
WorldGenMinable worldGenMinable = new WorldGenMinable(ore.state, ore.veinSize, predicate);
if (ore.state != null) {
if (ore.state == null) {
continue;
}
for (int i = 0; i < ore.veinsPerChunk; i++) {
xPos = chunkX * 16 + random.nextInt(16);
if (ore.maxYHeight == -1 || ore.minYHeight == -1) {
@ -220,7 +222,7 @@ public class TechRebornWorldGen implements IWorldGenerator {
zPos = chunkZ * 16 + random.nextInt(16);
BlockPos pos = new BlockPos(xPos, yPos, zPos);
if (ore.veinSize < 4){
if (ore.veinSize < 4) {
// Workaround for small veins
for (int j = 1; j < ore.veinSize; j++) {
// standard worldgen offset is added here like in WorldGenMinable#generate
@ -243,7 +245,6 @@ public class TechRebornWorldGen implements IWorldGenerator {
}
}
}
}
if (genTree && config.rubberTreeConfig.shouldSpawn) {
int chance = config.rubberTreeConfig.chance;
boolean isValidSpawn = false;

View file

@ -37,6 +37,8 @@ public class WorldGenConfig {
public boolean retroGenOres = false;
public boolean overworldOresInModdedDims = true;
public List<OreConfig> overworldOres;
public List<OreConfig> neatherOres;