Jump to content

[1.16.3] How to register new biomes?


kiou.23

Recommended Posts

So I know biomes now are registered through json files, but I've found very little information on how to actually implement them. I also know that there is a data generator for biomes, but I also didn't find any resources on it.

I'd appreciate if anyone could give me the steps to implementing biomes, or simply point me to a 1.16.3 repo that adds biomes

Link to comment
Share on other sites

You can still register your biomes through registries like before..take a look at this: https://github.com/Choonster-Minecraft-Mods/TestMod3/blob/1.16.x/src/main/java/choonster/testmod3/init/ModBiomes.java

Also, lot of open source mods that add biomes to the dimensions exists, for example, biome o' plenty, oh the biomes you'll go and others..

Edited by Beethoven92

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

Link to comment
Share on other sites

6 hours ago, Beethoven92 said:

You can still register your biomes through registries like before..take a look at this: https://github.com/Choonster-Minecraft-Mods/TestMod3/blob/1.16.x/src/main/java/choonster/testmod3/init/ModBiomes.java

Also, lot of open source mods that add biomes to the dimensions exists, for example, biome o' plenty, oh the biomes you'll go and others..

I took a look at the source for Traverse, but it looked like a hacky way of doing it. I'm gonna look how it was done before, and how other mods do it then

thanks

Link to comment
Share on other sites

So:

1) Use DeferredRegister to register your biome like you do with every other registry entry

2) Use the biome builder to define your biome properties, features, spawns etc..

3) Add your biome to the BiomeManager

That's all you should need to have your custom biome generating in the overworld. Now, if you want to make a nether or end biome, that's where things get a bit hacky

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

Link to comment
Share on other sites

2 hours ago, Beethoven92 said:

1) Use DeferredRegister to register your biome like you do with every other registry entry

2) Use the biome builder to define your biome properties, features, spawns etc..

Something like this?

@Mod.EventBusSubscriber(modid = TutorialMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class ModBiomes {

    public static final DeferredRegister<Biome> BIOMES = DeferredRegister.create(ForgeRegistries.BIOMES, TutorialMod.MOD_ID);

    public static final RegistryObject<Biome> TEST_BIOME = BIOMES.register("test_biome", () ->
        new Biome.Builder()
            .category(Biome.Category.FOREST)
            .withTemperatureModifier(Biome.TemperatureModifier.NONE)
            .withGenerationSettings(BiomeGenerationSettings.DEFAULT_SETTINGS)
            .withGenerationSettings(new BiomeGenerationSettings.Builder()
                .withCarver(GenerationStage.Carving.AIR, ConfiguredCarvers.field_243767_a)
                .withCarver(GenerationStage.Carving.AIR, ConfiguredCarvers.field_243768_b)
                .withFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Features.FANCY_OAK)
                .withStructure(StructureFeatures.RUINED_PORTAL)
                .withSurfaceBuilder(ConfiguredSurfaceBuilders.field_244178_j)    
                .build()
            )
            .withMobSpawnSettings(new MobSpawnInfo.Builder()
                .withSpawner(EntityClassification.CREATURE, new MobSpawnInfo.Spawners(EntityType.PIG, 15, 2, 7))
                .withSpawner(EntityClassification.CREATURE, new MobSpawnInfo.Spawners(EntityType.COW, 25, 3, 8))
                .copy()
            )
            .scale(0.8f)
            .downfall(.4f)
            .precipitation(Biome.RainType.SNOW)
            .temperature(.8f)
            .depth(0.135f)
            .setEffects(new BiomeAmbience.Builder()
                .setWaterColor(0xCF21B8)
                .withGrassColor(0xDA67C1)
                .build()
            )
            .build()
    );

    @SubscribeEvent
    public void registerBiomes(FMLCommonSetupEvent event) {
        BiomeManager.addBiome();
    }

}

 

2 hours ago, Beethoven92 said:

3) Add your biome to the BiomeManager

And what do I pass to the Biome Manager? how do I get Biome Type and a Biome Entry?

And do I need to add it to the BiomeDictionary along with the Types?

Link to comment
Share on other sites

1 minute ago, kiou.23 said:

And what do I pass to the Biome Manager? how do I get Biome Type and a Biome Entry?

And do I need to add it to the BiomeDictionary along with the Types?

Have you taken a look at the link i posted above? There is everything you need to get your biome working. Also yes, you should add your biome to the dictionary

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

Link to comment
Share on other sites

1 hour ago, Beethoven92 said:

Have you taken a look at the link i posted above? There is everything you need to get your biome working. Also yes, you should add your biome to the dictionary

I totally forgot to look at the link, and yeah, what I needed was there.

just for reference here is my code, I'd appreciate if you could check if everything is already, or if there is something I could do to better the code (like for instance, do I need to add every ore manually?)

@Mod.EventBusSubscriber(modid = TutorialMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class ModBiomes {

    public static final DeferredRegister<Biome> BIOMES = DeferredRegister.create(ForgeRegistries.BIOMES, TutorialMod.MOD_ID);

    public static final RegistryObject<Biome> TEST_BIOME = BIOMES.register("test_biome", () ->
        new Biome.Builder()
            .category(Biome.Category.FOREST)
            .withTemperatureModifier(Biome.TemperatureModifier.NONE)
            .withGenerationSettings(new BiomeGenerationSettings.Builder()
                .withCarver(GenerationStage.Carving.AIR, ConfiguredCarvers.field_243767_a)
                .withCarver(GenerationStage.Carving.AIR, ConfiguredCarvers.field_243768_b)
                .withFeature(GenerationStage.Decoration.VEGETAL_DECORATION, Features.FANCY_OAK)
                .withFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Features.ORE_COAL)
                .withFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Features.ORE_GOLD)
                .withFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Features.ORE_IRON)
                .withFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Features.ORE_DIAMOND)
                .withStructure(StructureFeatures.RUINED_PORTAL)
                .withSurfaceBuilder(ConfiguredSurfaceBuilders.field_244178_j)
                .build()
            )
            .withMobSpawnSettings(new MobSpawnInfo.Builder()
                .withSpawner(EntityClassification.CREATURE, new MobSpawnInfo.Spawners(EntityType.PIG, 15, 2, 7))
                .withSpawner(EntityClassification.CREATURE, new MobSpawnInfo.Spawners(EntityType.COW, 25, 3, 8))
                .copy()
            )
            .scale(0.4f)
            .downfall(.4f)
            .precipitation(Biome.RainType.SNOW)
            .temperature(.8f)
            .depth(0.123f)
            .setEffects(new BiomeAmbience.Builder()
                .withGrassColor(0xDA67C1)
                .setFogColor(0xEEEEEE)
                .setWaterColor(0xCF21B8)
                .setWaterFogColor(0xCF78C5)
                .withSkyColor(0xE83452)
                .withFoliageColor(0xCA57C1)
                .build()
            )
            .build()
    );

    @SubscribeEvent
    public static void setupBiomes(FMLCommonSetupEvent event) {
        event.enqueueWork(() ->
            setupBiome(TEST_BIOME.get(), BiomeManager.BiomeType.WARM, 1500,
                Type.FOREST, Type.COLD, Type.OVERWORLD, Type.WET)
        );
    }

    private static void setupBiome(Biome biome, BiomeManager.BiomeType biomeType, int weight, BiomeDictionary.Type... types) {
        RegistryKey<Biome> key = RegistryKey.getOrCreateKey(
            ForgeRegistries.Keys.BIOMES,
            Objects.requireNonNull(ForgeRegistries.BIOMES.getKey(biome), "Biome registry name was null"));
      
        BiomeDictionary.addTypes(key, types);
        BiomeManager.addBiome(biomeType, new BiomeManager.BiomeEntry(key, weight));
    }
}

 

Link to comment
Share on other sites

Yep, you need to add all the features manually. If you need to add all the vanilla ores, you could also use the utility method withOverworldOres, which you can find inside the DefaultBiomeFeatures class, among many other method that add specific groups of features in one go..its not really necessary though, you have better control if you add features one by one manually. To improve readability of your code, i suggest moving the whole biome definition into on separate utility method that returns the Biome object

Edited by Beethoven92
  • Like 1

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

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.



×
×
  • Create New...

Important Information

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