Nether biomes now work

This commit is contained in:
Adubbz 2020-07-05 22:00:41 +10:00
parent 965aa0551f
commit d35095a2d0
7 changed files with 128 additions and 49 deletions

View file

@ -5,6 +5,7 @@ import biomesoplenty.api.enums.BOPClimates;
import biomesoplenty.common.biome.NetherBiomeBOP;
import biomesoplenty.common.world.biome.BiomeFeatureHelper;
import biomesoplenty.common.world.gen.feature.BOPBiomeFeatures;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.Blocks;
import net.minecraft.client.audio.BackgroundMusicTracks;
import net.minecraft.entity.EntityClassification;
@ -22,7 +23,7 @@ public class UndergardenBiome extends NetherBiomeBOP
{
public UndergardenBiome()
{
super((new Biome.Builder()).surfaceBuilder(SurfaceBuilder.NETHER, SurfaceBuilder.CONFIG_HELL).precipitation(Biome.RainType.NONE).biomeCategory(Biome.Category.NETHER).depth(0.1F).scale(0.2F).temperature(2.0F).downfall(0.0F).specialEffects((new BiomeAmbience.Builder()).waterColor(4159204).waterFogColor(329011).fogColor(0x243308).ambientLoopSound(SoundEvents.AMBIENT_WARPED_FOREST_LOOP).ambientMoodSound(new MoodSoundAmbience(SoundEvents.AMBIENT_CRIMSON_FOREST_MOOD, 6000, 8, 2.0D)).ambientAdditionsSound(new SoundAdditionsAmbience(SoundEvents.AMBIENT_NETHER_WASTES_ADDITIONS, 0.0111D)).backgroundMusic(BackgroundMusicTracks.createGameMusic(SoundEvents.MUSIC_BIOME_NETHER_WASTES)).build()).parent((String)null));
super((new Biome.Builder()).surfaceBuilder(SurfaceBuilder.NETHER, SurfaceBuilder.CONFIG_HELL).precipitation(Biome.RainType.NONE).biomeCategory(Biome.Category.NETHER).depth(0.1F).scale(0.2F).temperature(2.0F).downfall(0.0F).specialEffects((new BiomeAmbience.Builder()).waterColor(4159204).waterFogColor(329011).fogColor(0x243308).ambientLoopSound(SoundEvents.AMBIENT_WARPED_FOREST_LOOP).ambientMoodSound(new MoodSoundAmbience(SoundEvents.AMBIENT_CRIMSON_FOREST_MOOD, 6000, 8, 2.0D)).ambientAdditionsSound(new SoundAdditionsAmbience(SoundEvents.AMBIENT_NETHER_WASTES_ADDITIONS, 0.0111D)).backgroundMusic(BackgroundMusicTracks.createGameMusic(SoundEvents.MUSIC_BIOME_NETHER_WASTES)).build()).parent((String)null).optimalParameters(ImmutableList.of(new Biome.Attributes(0.0F, 0.5F, 0.0F, 0.0F, 0.0F))));
//Terrain
this.addStructureStart(DefaultBiomeFeatures.RUINED_PORTAL_NETHER);

View file

@ -4,6 +4,7 @@ import biomesoplenty.api.enums.BOPClimates;
import biomesoplenty.common.biome.NetherBiomeBOP;
import biomesoplenty.common.world.biome.BiomeFeatureHelper;
import biomesoplenty.common.world.gen.feature.BOPBiomeFeatures;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.Blocks;
import net.minecraft.client.audio.BackgroundMusicTracks;
import net.minecraft.entity.EntityClassification;
@ -21,7 +22,7 @@ public class VisceralHeapBiome extends NetherBiomeBOP
{
public VisceralHeapBiome()
{
super((new Builder()).surfaceBuilder(SurfaceBuilder.NETHER, SurfaceBuilder.CONFIG_HELL).precipitation(RainType.NONE).biomeCategory(Category.NETHER).depth(0.1F).scale(0.2F).temperature(2.0F).downfall(0.0F).specialEffects((new BiomeAmbience.Builder()).waterColor(4159204).waterFogColor(329011).fogColor(0x420A1B).ambientLoopSound(SoundEvents.AMBIENT_NETHER_WASTES_LOOP).ambientMoodSound(new MoodSoundAmbience(SoundEvents.AMBIENT_SOUL_SAND_VALLEY_MOOD, 6000, 8, 2.0D)).ambientAdditionsSound(new SoundAdditionsAmbience(SoundEvents.AMBIENT_CRIMSON_FOREST_ADDITIONS, 0.0111D)).backgroundMusic(BackgroundMusicTracks.createGameMusic(SoundEvents.MUSIC_BIOME_CRIMSON_FOREST)).build()).parent((String)null));
super((new Builder()).surfaceBuilder(SurfaceBuilder.NETHER, SurfaceBuilder.CONFIG_HELL).precipitation(RainType.NONE).biomeCategory(Category.NETHER).depth(0.1F).scale(0.2F).temperature(2.0F).downfall(0.0F).specialEffects((new BiomeAmbience.Builder()).waterColor(4159204).waterFogColor(329011).fogColor(0x420A1B).ambientLoopSound(SoundEvents.AMBIENT_NETHER_WASTES_LOOP).ambientMoodSound(new MoodSoundAmbience(SoundEvents.AMBIENT_SOUL_SAND_VALLEY_MOOD, 6000, 8, 2.0D)).ambientAdditionsSound(new SoundAdditionsAmbience(SoundEvents.AMBIENT_CRIMSON_FOREST_ADDITIONS, 0.0111D)).backgroundMusic(BackgroundMusicTracks.createGameMusic(SoundEvents.MUSIC_BIOME_CRIMSON_FOREST)).build()).parent((String)null).optimalParameters(ImmutableList.of(new Biome.Attributes(0.0F, 0.5F, 0.0F, 0.0F, 0.0F))));
//Terrain
this.addStructureStart(DefaultBiomeFeatures.RUINED_PORTAL_NETHER);

View file

@ -8,14 +8,16 @@
package biomesoplenty.common.world;
import net.minecraft.client.gui.screen.BiomeGeneratorTypeScreens;
import net.minecraft.world.biome.provider.OverworldBiomeProvider;
import net.minecraft.server.IDynamicRegistries;
import net.minecraft.world.DimensionType;
import net.minecraft.world.gen.ChunkGenerator;
import net.minecraft.world.gen.DimensionSettings;
import net.minecraft.world.gen.NoiseChunkGenerator;
import net.minecraft.world.gen.settings.DimensionGeneratorSettings;
public class BiomeGeneratorTypeScreenBOP extends BiomeGeneratorTypeScreens
public class BOPBiomeGeneratorTypeScreen extends BiomeGeneratorTypeScreens
{
public BiomeGeneratorTypeScreenBOP()
public BOPBiomeGeneratorTypeScreen()
{
super("biomesoplenty");
}
@ -25,4 +27,10 @@ public class BiomeGeneratorTypeScreenBOP extends BiomeGeneratorTypeScreens
{
return new NoiseChunkGenerator(new BOPBiomeProvider(seed), seed, DimensionSettings.Preset.OVERWORLD.settings());
}
@Override
public DimensionGeneratorSettings create(IDynamicRegistries.Impl registries, long seed, boolean generateFeatures, boolean generateBonusChest)
{
return new DimensionGeneratorSettings(seed, generateFeatures, generateBonusChest, DimensionGeneratorSettings.withOverworld(BOPDimensionType.bopDimensions(seed), this.generator(seed)));
}
}

View file

@ -0,0 +1,47 @@
package biomesoplenty.common.world;
import com.mojang.serialization.Lifecycle;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.SimpleRegistry;
import net.minecraft.world.Dimension;
import net.minecraft.world.DimensionType;
import net.minecraft.world.biome.provider.EndBiomeProvider;
import net.minecraft.world.biome.provider.NetherBiomeProvider;
import net.minecraft.world.gen.ChunkGenerator;
import net.minecraft.world.gen.DimensionSettings;
import net.minecraft.world.gen.NoiseChunkGenerator;
import java.util.OptionalLong;
/***
* This class mainly exists as a means of putting static methods in the same place Vanilla has them and access to protected methods.
* We don't need to create our own BOPDimensionType instances.
*/
public class BOPDimensionType extends DimensionType
{
protected BOPDimensionType(OptionalLong p_i241242_1_, boolean p_i241242_2_, boolean p_i241242_3_, boolean p_i241242_4_, boolean p_i241242_5_, boolean p_i241242_6_, boolean p_i241242_7_, boolean p_i241242_8_, boolean p_i241242_9_, boolean p_i241242_10_, int p_i241242_11_, ResourceLocation p_i241242_12_, float p_i241242_13_)
{
super(p_i241242_1_, p_i241242_2_, p_i241242_3_, p_i241242_4_, p_i241242_5_, p_i241242_6_, p_i241242_7_, p_i241242_8_, p_i241242_9_, p_i241242_10_, p_i241242_11_, p_i241242_12_, p_i241242_13_);
}
private static ChunkGenerator bopEndGenerator(long seed)
{
return new NoiseChunkGenerator(new EndBiomeProvider(seed), seed, DimensionSettings.Preset.END.settings());
}
private static ChunkGenerator bopNetherGenerator(long seed)
{
return new NoiseChunkGenerator(BOPNetherBiomeProvider.Preset.NETHER.biomeSource(seed), seed, DimensionSettings.Preset.NETHER.settings());
}
public static SimpleRegistry<Dimension> bopDimensions(long seed)
{
SimpleRegistry<Dimension> registry = new SimpleRegistry<>(Registry.LEVEL_STEM_REGISTRY, Lifecycle.experimental());
registry.register(Dimension.NETHER, new Dimension(() -> DEFAULT_NETHER, bopNetherGenerator(seed)));
registry.register(Dimension.END, new Dimension(() -> DEFAULT_END, bopEndGenerator(seed)));
registry.setPersistent(Dimension.NETHER);
registry.setPersistent(Dimension.END);
return registry;
}
}

View file

@ -0,0 +1,63 @@
/*******************************************************************************
* Copyright 2014-2019, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.world;
import biomesoplenty.api.enums.BOPClimates;
import com.google.common.collect.ImmutableList;
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.Biomes;
import net.minecraft.world.biome.provider.NetherBiomeProvider;
import net.minecraft.world.gen.layer.Layer;
import java.util.List;
import java.util.Optional;
import java.util.function.LongFunction;
import java.util.stream.Collectors;
public class BOPNetherBiomeProvider extends NetherBiomeProvider
{
private final Layer noiseBiomeLayer;
public BOPNetherBiomeProvider(long seed, List<Pair<Biome.Attributes, Biome>> parameters, Optional<NetherBiomeProvider.Preset> preset)
{
super(seed, parameters, preset);
this.noiseBiomeLayer = BOPNetherLayerUtil.createGenLayers(seed);
}
public static NetherBiomeProvider bopNether(long seed)
{
List<Biome> biomeList = Lists.newArrayList(Biomes.NETHER_WASTES, Biomes.SOUL_SAND_VALLEY, Biomes.CRIMSON_FOREST, Biomes.WARPED_FOREST, Biomes.BASALT_DELTAS);
/* 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
// 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)
{
super(location, biomeProvider);
}
public static final NetherBiomeProvider.Preset NETHER = new NetherBiomeProvider.Preset(new ResourceLocation("nether"), (seed) -> BOPNetherBiomeProvider.bopNether(seed) );
};
}

View file

@ -1,41 +0,0 @@
/*******************************************************************************
* Copyright 2014-2019, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.world;
import com.google.common.collect.ImmutableList;
import com.mojang.datafixers.util.Pair;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes;
import net.minecraft.world.biome.provider.NetherBiomeProvider;
import net.minecraft.world.gen.layer.Layer;
import java.util.List;
import java.util.Optional;
public class NetherBiomeProviderBOP extends NetherBiomeProvider
{
private final Layer noiseBiomeLayer;
public NetherBiomeProviderBOP(long seed)
{
super(seed, getParameters(), Optional.of(NetherBiomeProvider.Preset.NETHER));
this.noiseBiomeLayer = BOPNetherLayerUtil.createGenLayers(seed);
}
@Override
public Biome getNoiseBiome(int x, int y, int z)
{
return this.noiseBiomeLayer.get(x, z);
}
private static List<Pair<Biome.Attributes, Biome>> getParameters()
{
ImmutableList<Biome> biomeList = ImmutableList.of(Biomes.NETHER_WASTES, Biomes.SOUL_SAND_VALLEY, Biomes.CRIMSON_FOREST, Biomes.WARPED_FOREST, Biomes.BASALT_DELTAS);
return biomeList.stream().flatMap((biome) -> biome.optimalParameters().map((attribute) -> Pair.of(attribute, biome))).collect(ImmutableList.toImmutableList());
}
}

View file

@ -12,7 +12,7 @@ import biomesoplenty.common.biome.BiomeBOP;
import biomesoplenty.common.biome.BiomeRegistry;
import biomesoplenty.common.biome.nether.*;
import biomesoplenty.common.biome.overworld.*;
import biomesoplenty.common.world.BiomeGeneratorTypeScreenBOP;
import biomesoplenty.common.world.BOPBiomeGeneratorTypeScreen;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
@ -34,14 +34,14 @@ import static biomesoplenty.api.biome.BOPBiomes.*;
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public class ModBiomes
{
public static BiomeGeneratorTypeScreenBOP biomeGeneratorTypeScreenBOP;
public static BOPBiomeGeneratorTypeScreen biomeGeneratorTypeScreenBOP;
public static Multimap<Integer, WeightedSubBiome> subBiomes = HashMultimap.create();
public static List<Integer> islandBiomeIds = Lists.newArrayList();
public static void setup()
{
biomeGeneratorTypeScreenBOP = new BiomeGeneratorTypeScreenBOP();
biomeGeneratorTypeScreenBOP = new BOPBiomeGeneratorTypeScreen();
BiomeGeneratorTypeScreens.PRESETS.add(biomeGeneratorTypeScreenBOP);
}