Jump to content

Biome not working (1.16.5)


Giga_5

Recommended Posts

I am still very new to biomes and world generation as a whole, but i thought i'd give it a shot anyways. My game refuses to acknowledge the biome, what did I do wrong?

 

Biome class:


import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntityType;
import net.minecraft.world.biome.*;
import net.minecraft.world.gen.GenerationStage;
import net.minecraft.world.gen.carver.ConfiguredCarvers;
import net.minecraft.world.gen.feature.Features;
import net.minecraft.world.gen.feature.structure.StructureFeatures;
import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder;

public class wastelandBiome {
    public static Biome wastelandBiomeGen() {
                BiomeGenerationSettings gen = new BiomeGenerationSettings.Builder()
                .surfaceBuilder(SurfaceBuilder.DEFAULT.configured(SurfaceBuilder.CONFIG_DESERT))
                .addCarver(GenerationStage.Carving.AIR, ConfiguredCarvers.CAVE)
                .addFeature(GenerationStage.Decoration.LAKES, Features.LAKE_WATER)
                .addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Features.ORE_COAL)
                .addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Features.ORE_IRON)
                .addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Features.ORE_GOLD)
                .addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Features.ORE_REDSTONE)
                .addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Features.ORE_DIAMOND)
                .addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Features.ORE_LAPIS)
                .addStructureStart(StructureFeatures.MINESHAFT)
                .addStructureStart(StructureFeatures.STRONGHOLD)
                .addFeature(GenerationStage.Decoration.LAKES, Features.LAKE_LAVA)
                .build();

                BiomeAmbience ambience = new BiomeAmbience.Builder()
                .waterColor(0x2e284f)
                .grassColorOverride(0x665c50)
                .waterFogColor(0x00d0c17)
                .fogColor(0x606769)
                .skyColor(0x3d4142)
                .build();


                MobSpawnInfo mobStuff = new MobSpawnInfo.Builder()
                .addSpawn(EntityClassification.MONSTER, new MobSpawnInfo.Spawners(EntityType.SPIDER, 100, 4, 8))
                .addSpawn(EntityClassification.MONSTER, new MobSpawnInfo.Spawners(EntityType.ZOMBIE, 100, 4, 8))
                .addSpawn(EntityClassification.MONSTER, new MobSpawnInfo.Spawners(EntityType.ZOMBIE_VILLAGER, 5, 1, 1))
                .addSpawn(EntityClassification.MONSTER, new MobSpawnInfo.Spawners(EntityType.SKELETON, 100, 4, 8))
                .addSpawn(EntityClassification.MONSTER, new MobSpawnInfo.Spawners(EntityType.CREEPER, 100, 4, 4))
                .addSpawn(EntityClassification.MONSTER, new MobSpawnInfo.Spawners(EntityType.SLIME, 100, 4, 4))
                .addSpawn(EntityClassification.MONSTER, new MobSpawnInfo.Spawners(EntityType.ENDERMAN, 10, 1, 4))
                .addSpawn(EntityClassification.MONSTER, new MobSpawnInfo.Spawners(EntityType.WITCH, 5, 1, 1))
                .build();

       

        return new Biome.Builder()
                .generationSettings(gen)
                .specialEffects(ambience)
                .mobSpawnSettings(mobStuff)
                .biomeCategory(Biome.Category.PLAINS)
                .temperatureAdjustment(Biome.TemperatureModifier.NONE)
                .depth(0.12f)
                .scale(0.01f)
                .precipitation(Biome.RainType.RAIN)
                .temperature(0.5f)
                .downfall(0.4f)
                .build();
    }
}

 

Biome initializer:

import mod.giga5.deepmod.holder;
import net.minecraft.util.RegistryKey;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.BiomeManager;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.registries.ForgeRegistries;

import java.util.Objects;

@Mod.EventBusSubscriber(modid = "deepmod", bus = Mod.EventBusSubscriber.Bus.MOD)
public class biomeInit {

    @SubscribeEvent
    public static void setupBiomes(FMLCommonSetupEvent event) {
        event.enqueueWork(() ->
                setupBiome(holder.WASTELAND_BIOME, BiomeManager.BiomeType.DESERT, 100000,
                        BiomeDictionary.Type.OVERWORLD, BiomeDictionary.Type.DEAD, BiomeDictionary.Type.FOREST, BiomeDictionary.Type.HILLS)
        );
    }
    private static void setupBiome(Biome biome, BiomeManager.BiomeType type, int weight, BiomeDictionary.Type... types) {
        RegistryKey<Biome> key = RegistryKey.create(
                ForgeRegistries.Keys.BIOMES,
                Objects.requireNonNull(ForgeRegistries.BIOMES.getKey(biome))
        );

        BiomeDictionary.addTypes(key, types);
        BiomeManager.addBiome(type, new BiomeManager.BiomeEntry(key, weight));
    }
}

 

Registerer:

import mod.giga5.deepmod.biomes.wastelandBiome;
import mod.giga5.deepmod.main;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;

@Mod.EventBusSubscriber(modid = "deepmod", bus = Mod.EventBusSubscriber.Bus.MOD)
public class deferredregister {
    public static final DeferredRegister<Biome> BIOMES = DeferredRegister.create(ForgeRegistries.BIOMES, main.MODID);
    public static final RegistryObject<Biome> WASTELAND_BIOME = BIOMES.register("wasteland_biome", wastelandBiome::wastelandBiomeGen);

    public static void register() {
        IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
        BIOMES.register(modEventBus);
    }
}

I am not usually familiar with DeferredRegister, as I usually just use the RegistryEvents. However I was told biomes can be screwed up if done with the standard RegistryEvents, so I went with deferred.

thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.