Jump to content

[Solved] Error "unidentified mapping" after changing mod id


Recommended Posts

Posted (edited)

For private uses I've rewritten the MoarOres mod. Because it was not conforming to the conventional naming scheme (e.g. it was "SteelSword" instead of "steel_sword") I renamed everything properly and process the appropriate MissingMappings events to not break old worlds, which after some troubleshooting worked fine.

 

Then due to the amount of changes made, I found it adequate to change the mod id from "moarores" to "moaroresreforged". It's no trouble for new worlds, but for some odd reason it seems the MissingMappings stopped working. Or rather: The MissingMappings handling *still works*, but Forge now rejects it.

 

The code is (the methods are called from the main class which is listening for those events)

 

Spoiler

	public static void remapBlocks(MissingMappings<Block> event) {
		for (MissingMappings.Mapping<Block> miss : event.getMappings()) {
			Block block = blockMap.get(miss.key.toString());
			if (block != null) {
				miss.remap(block);
			}
			else {
				System.out.println("Couldn't remap "+miss.key);
			}
		}
	}
	
	public static void remapItems(MissingMappings<Item> event) {
		for (MissingMappings.Mapping<Item> miss : event.getMappings()) {
			Item item = itemMap.get(miss.key.toString());
			if (item != null) {
				miss.remap(item);
			}
			else {
				System.out.println("Couldn't remap "+miss.key);
			}
		}
	}

 

 

And the output that gets produced (I reduced the listings to one block and one item each in favor of readability):

Spoiler

[22:48:02] [Server thread/INFO] [FML]: Registry Block: Found a missing id from t
he world moarores:mythrilore
[22:48:02] [Server thread/INFO] [FML]: Registry Item: Found a missing id from th
e world moarores:mythrilingot
[22:48:02] [Server thread/INFO] [STDOUT]: [main.java.moaroresreforged.MoarOresRe
forgedMod:remapBlock:59]: Remapping blocks called!
[22:48:02] [Server thread/ERROR] [FML]: Unidentified mapping from registry minec
raft:blocks
[22:48:02] [Server thread/ERROR] [FML]:     moarores:mythrilore: 258
[22:48:02] [Server thread/INFO] [STDOUT]: [main.java.moaroresreforged.MoarOresRe
forgedMod:remapItem:65]: Remapping items called!
[22:48:02] [Server thread/ERROR] [FML]: Unidentified mapping from registry minec
raft:items
[22:48:02] [Server thread/ERROR] [FML]:     moarores:mythrilingot: 4104

 

It's worth noting that the printing "Couldn't remap ..." is *not* made, so the remapping worked, but forge doesn't like it.

How can I tell forge to accept the change?

Edited by HariboTer
Marked as solved
Posted

It looks like you're not setting a new registry name for the blocks before remapping them, so they map to their old mappings...if I'm reading it correctly.

 

If I'm right, then changing this...
 

miss.remap(block);

 

...to this...

 

miss.remap(block.setRegistryName(~~~enter correct registry name here, using new modid and block name~~~));

 

Should solve the immediate issue.  Make sure to do the same for items if that works for the blocks ofc

Posted

Thanks for your input. You should know though that the itemMap and the blockMap contain the registered and valid current items/blocks, keyed by their old names, which are not changed by the remapping because they are the target, not the source. So unfortunately your proposal doesn't fix the problem.

Posted

Rummaging around the MissingMappings code I found that getMappings() filters the mappings for only those whose mod ID matches the mod for which the event is called, which were empty due to the different mod ID. getAllMappings() does not perform this filtration, thus replacing getMappings() with getAllMappings() in both cases solved the issue ?

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.