Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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!

  • Author

I have also been told that implementing a biome through JSON can (and should) be done in some cases. How would you register a JSON biome?

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.