Fixed nether fortress generation. Closes #1523
This commit is contained in:
parent
f9d4959bc8
commit
ad525e7987
3 changed files with 40 additions and 14 deletions
|
@ -8,7 +8,9 @@
|
|||
package biomesoplenty.api.enums;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.Biomes;
|
||||
import net.minecraft.world.gen.INoiseRandom;
|
||||
|
@ -16,6 +18,8 @@ import net.minecraftforge.common.BiomeManager.BiomeType;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public enum BOPClimates
|
||||
{
|
||||
|
@ -172,6 +176,24 @@ public enum BOPClimates
|
|||
return out;
|
||||
}
|
||||
|
||||
public static ImmutableSet<Biome> getOverworldBiomes()
|
||||
{
|
||||
Set<Biome> set = Sets.newHashSet();
|
||||
|
||||
for (BOPClimates climate : BOPClimates.values())
|
||||
{
|
||||
if (climate == BOPClimates.NETHER)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
set.addAll(climate.getLandBiomes().stream().map(weightedBiomeEntry -> weightedBiomeEntry.biome).collect(Collectors.toSet()));
|
||||
set.addAll(climate.getIslandBiomes().stream().map(weightedBiomeEntry -> weightedBiomeEntry.biome).collect(Collectors.toSet()));
|
||||
}
|
||||
|
||||
return ImmutableSet.copyOf(set);
|
||||
}
|
||||
|
||||
public static class WeightedBiomeEntry
|
||||
{
|
||||
public final int weight;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
******************************************************************************/
|
||||
package biomesoplenty.common.world;
|
||||
|
||||
import biomesoplenty.api.enums.BOPClimates;
|
||||
import com.google.common.collect.Sets;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -26,21 +27,21 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class BOPBiomeProvider extends OverworldBiomeProvider
|
||||
public class BOPBiomeProvider extends BiomeProvider
|
||||
{
|
||||
private final Layer genBiomes;
|
||||
private final Layer noiseBiomeLayer;
|
||||
|
||||
public BOPBiomeProvider(OverworldBiomeProviderSettings settingsProvider)
|
||||
{
|
||||
super(settingsProvider);
|
||||
|
||||
this.genBiomes = BOPLayerUtil.createGenLayers(settingsProvider.getSeed(), settingsProvider.getGeneratorType(), settingsProvider.getGeneratorSettings())[0];
|
||||
super(BOPClimates.getOverworldBiomes());
|
||||
this.noiseBiomeLayer = BOPLayerUtil.createGenLayers(settingsProvider.getSeed(), settingsProvider.getGeneratorType(), settingsProvider.getGeneratorSettings())[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Biome getNoiseBiome(int x, int y, int z)
|
||||
{
|
||||
return this.genBiomes.get(x, z);
|
||||
return this.noiseBiomeLayer.get(x, z);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,17 +7,21 @@
|
|||
******************************************************************************/
|
||||
package biomesoplenty.common.world;
|
||||
|
||||
import biomesoplenty.api.enums.BOPClimates;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.Biomes;
|
||||
import net.minecraft.world.biome.provider.BiomeProvider;
|
||||
import net.minecraft.world.biome.provider.OverworldBiomeProvider;
|
||||
import net.minecraft.world.biome.provider.OverworldBiomeProviderSettings;
|
||||
import net.minecraft.world.gen.OverworldGenSettings;
|
||||
import net.minecraft.world.gen.feature.structure.Structure;
|
||||
import net.minecraft.world.gen.layer.Layer;
|
||||
import net.minecraft.world.gen.layer.LayerUtil;
|
||||
import net.minecraft.world.storage.WorldInfo;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -25,22 +29,21 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class NetherBiomeProvider extends OverworldBiomeProvider
|
||||
public class NetherBiomeProvider extends BiomeProvider
|
||||
{
|
||||
private final Layer genBiomes;
|
||||
private final Layer noiseBiomeLayer;
|
||||
|
||||
public NetherBiomeProvider(OverworldBiomeProviderSettings settingsProvider)
|
||||
{
|
||||
super(settingsProvider);
|
||||
|
||||
this.surfaceBlocks.add(Blocks.NETHERRACK.defaultBlockState());
|
||||
this.genBiomes = BOPNetherLayerUtil.createGenLayers(settingsProvider.getSeed(), settingsProvider.getGeneratorType(), settingsProvider.getGeneratorSettings())[0];
|
||||
super(BOPClimates.NETHER.getLandBiomes().stream().map(weightedBiomeEntry -> weightedBiomeEntry.biome).collect(Collectors.toSet()));
|
||||
this.noiseBiomeLayer = BOPNetherLayerUtil.createGenLayers(settingsProvider.getSeed(), settingsProvider.getGeneratorType(), settingsProvider.getGeneratorSettings())[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Biome getNoiseBiome(int x, int y, int z)
|
||||
{
|
||||
return this.genBiomes.get(x, z);
|
||||
return this.noiseBiomeLayer.get(x, z);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue