Jump to content

How do you deal with block / item ID changes?


Insane96MCP

Recommended Posts

16 hours ago, V0idWa1k3r said:

I think you can use the RegistryEvent.MissingMappings event to deal with this. From that event you can get the list of mappings. Get the one that was changed and use Mapping#remap to point to the thing with the new name.

Thanks this worked out thanks to numerical IDs, but the question now is, afaik in 1.13 they removed numerical IDs so how will remapping work?

Link to comment
Share on other sites

It'll operate on strings, obviously. "Oh no can't find modid:someblock".

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

4 hours ago, Insane96MCP said:

Ok, but right now remapping seems to use numerical ids, since there will be no more, and string ids get changed, when you need remapping, how can this work?

Numerical ids won't ever go away, they are and still will be used for serialization(as far as I know).

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

5 minutes ago, Animefan8888 said:

they are and still will be used for serialization(as far as I know).

As I understand the new system only chunks will use numerical IDs to resolve a blockstate at a given location. So while they are not going away and are still used for serialization you have no control over them and the mappings won't hold them since each chunk has it's own set of IDs <-> Name pairs.

 

4 hours ago, Insane96MCP said:

when you need remapping, how can this work?

You will simply tell the game in this event that "Oh, X actually equals Y". Kinda like telling the game that modid:some_name is just a pointer to modid:some_other_name. So when the game asks for modid:some_name it will just be resolved to modid:some_other_name. Think of it as making a symlink.

Link to comment
Share on other sites

1 hour ago, V0idWa1k3r said:

since each chunk has it's own set of IDs <-> Name pairs. 

This just sounds horrible to me.

1 hour ago, V0idWa1k3r said:

and the mappings won't hold

I'm not sure if that is correct, I also don't know if I am understanding it. But just in case.

Quote

A word about integer ID's

  • For Items and Blocks, you should have already switched to fully using registry names for everything. The registry name <-> int ID maps still exist in vanilla for performance purposes, but they should never be used for anything other than network communication because they are NOT guaranteed to be the same after joining a different world. This should already be an established modding convention since 1.8, but people still break it, so I'll mention it again :P

From the update primer.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

19 hours ago, Insane96MCP said:

Ok, but right now remapping seems to use numerical ids, since there will be no more, and string ids get changed, when you need remapping, how can this work?

The event's fields would change, duh.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Hey guys I tried to make my own, but it failed, Where did I make my mistake

    @SubscribeEvent
    public void missingMapping(RegistryEvent.MissingMappings<Item> event) {
        for (MissingMappings.Mapping<Item> entry : event.getAllMappings()) {
            if (entry.key.toString().equals(DragonMounts.MODID + ":ender_dragonscales"))  {
                ResourceLocation newTotem = new ResourceLocation(DragonMounts.MODID + ":ender_dragonscales1");
                entry.remap(ForgeRegistries.ITEMS.getValue(newTotem));
            }
        }
    }

 

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.