Nether biome placement is now not-garbage

This commit is contained in:
Adubbz 2020-07-05 22:30:55 +10:00
parent d35095a2d0
commit a2b377f2d5
2 changed files with 14 additions and 35 deletions

View File

@ -32,7 +32,7 @@ public class BOPDimensionType extends DimensionType
private static ChunkGenerator bopNetherGenerator(long seed) private static ChunkGenerator bopNetherGenerator(long seed)
{ {
return new NoiseChunkGenerator(BOPNetherBiomeProvider.Preset.NETHER.biomeSource(seed), seed, DimensionSettings.Preset.NETHER.settings()); return new NoiseChunkGenerator(new BOPNetherBiomeProvider(seed), seed, DimensionSettings.Preset.NETHER.settings());
} }
public static SimpleRegistry<Dimension> bopDimensions(long seed) public static SimpleRegistry<Dimension> bopDimensions(long seed)

View File

@ -7,57 +7,36 @@
******************************************************************************/ ******************************************************************************/
package biomesoplenty.common.world; package biomesoplenty.common.world;
import biomesoplenty.api.enums.BOPClimates;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.mojang.datafixers.util.Pair;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.biome.Biome; 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.NetherBiomeProvider; import net.minecraft.world.biome.provider.NetherBiomeProvider;
import net.minecraft.world.gen.layer.Layer; import net.minecraft.world.gen.layer.Layer;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.function.LongFunction;
import java.util.stream.Collectors;
public class BOPNetherBiomeProvider extends NetherBiomeProvider public class BOPNetherBiomeProvider extends NetherBiomeProvider
{ {
private final Layer noiseBiomeLayer; private final Layer noiseBiomeLayer;
public BOPNetherBiomeProvider(long seed, List<Pair<Biome.Attributes, Biome>> parameters, Optional<NetherBiomeProvider.Preset> preset) public BOPNetherBiomeProvider(long seed)
{ {
super(seed, parameters, preset); super(seed, Lists.newArrayList(), Optional.empty());
this.noiseBiomeLayer = BOPNetherLayerUtil.createGenLayers(seed); this.noiseBiomeLayer = BOPNetherLayerUtil.createGenLayers(seed);
} }
public static NetherBiomeProvider bopNether(long seed) @Override
public Biome getNoiseBiome(int x, int y, int z)
{ {
List<Biome> biomeList = Lists.newArrayList(Biomes.NETHER_WASTES, Biomes.SOUL_SAND_VALLEY, Biomes.CRIMSON_FOREST, Biomes.WARPED_FOREST, Biomes.BASALT_DELTAS); return this.noiseBiomeLayer.get(x, z);
/* Add bop biomes to the biome list. */
for (Biome biome : BOPClimates.NETHER.getLandBiomes().stream().map((entry) -> entry.biome).collect(Collectors.toList()))
{
biomeList.add(biome);
} }
return new BOPNetherBiomeProvider(seed, biomeList.stream().flatMap((biome) -> biome.optimalParameters().map((attribute) -> Pair.of(attribute, biome))).collect(ImmutableList.toImmutableList()), Optional.of(Preset.NETHER)); @Override
} @OnlyIn(Dist.CLIENT)
public BiomeProvider withSeed(long seed)
// @Override
// public Biome getNoiseBiome(int x, int y, int z)
// {
// return this.noiseBiomeLayer.get(x, z);
// }
public static class Preset extends NetherBiomeProvider.Preset
{ {
public Preset(ResourceLocation location, LongFunction<NetherBiomeProvider> biomeProvider) return new BOPNetherBiomeProvider(seed);
{
super(location, biomeProvider);
} }
public static final NetherBiomeProvider.Preset NETHER = new NetherBiomeProvider.Preset(new ResourceLocation("nether"), (seed) -> BOPNetherBiomeProvider.bopNether(seed) );
};
} }