Jump to content

[1.20.2] Fix biome id when renamed


JimiIT92

Recommended Posts

Hi everyone :D I've renamed a Biome Id in my mod, and as such, when I load a pre-existing world, I get this error when teleporting to said biome

 

[Server thread/ERROR] [minecraft/ChunkSerializer]: Recoverable errors when loading section [-9, 0, 159]: (Unknown registry key in ResourceKey[minecraft:root / minecraft:worldgen/biome]: mineworld:volcanic_peak -> using default) -> volcanic peaks identified as plains

 where volcanic_peak is the old Id and volcanic_peaks is the new one. As such, the pre-generated biome is now identified as plains, causing some unintended behaviors in that biome (like rain and mobs spawning, wich my custom biome overrides).

Is there a way to automatically convert the biome Id for old worlds? For example when loading the world or the chunk?

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

Posted (edited)

Hi, thank you for your response. Unfortunately it seems like the MissingMappingsEvent is not fired in this scenario. What I did is creating a world with the old biome ID, change the biome ID and then load the world ath the biome location.
When the world is loaded I get the errors but the breakpoint inside the event listener is never hit

This is how I registered the event listener

@Mod.EventBusSubscriber(modid = MineWorld.MOD_ID)
public final class MissingMappingEvents {

    /**
     * Handle the missing mappings and replace them with a valid one
     *
     * @param event {@link MissingMappingsEvent The Missing Mappings Event}
     */
    @SubscribeEvent
    public static void onMissingMapping(final MissingMappingsEvent event) {
        if(event.getKey().location().equals(new ResourceLocation("mineworld", "volcanic_peak"))) {
            //Do Stuff
        }
    }

}

If I set the breakpoint directly on the if statement it never gets hit. I've also tried to add a Sysout before the if statement just to see if something gets logged, but it doesn't, so it looks like the event is never called (at least for biomes). I've tried removing an Item and in that case the breakpoint got hit, so I'm assuming is just the biomes?

EDIT: I don't know if it matters but I'm using Terrablender for adding Biomes to the world. You can also see how I'm registering biomes here: https://github.com/JimiIT92/MineWorld/blob/master/src/main/java/org/mineworld/core/MWBiomes.java

Edited by JimiIT92
Added source link

Don't blame me if i always ask for your help. I just want to learn to be better :)

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.