diff --git a/src/main/java/net/minecraftforge/registries/ForgeRegistry.java b/src/main/java/net/minecraftforge/registries/ForgeRegistry.java index 7af663afa1..a63e62595d 100644 --- a/src/main/java/net/minecraftforge/registries/ForgeRegistry.java +++ b/src/main/java/net/minecraftforge/registries/ForgeRegistry.java @@ -563,6 +563,9 @@ public class ForgeRegistry> implements IForgeRe Integer id = this.ids.inverse().remove(value); if (id == null) throw new IllegalStateException("Removed a entry that did not have an associated id: " + key + " " + value.toString() + " This should never happen unless hackery!"); + + if (DEBUG) + FMLLog.log.trace("Registry {} remove: {} {}", this.superType.getSimpleName(), key, id); } return value; @@ -702,10 +705,28 @@ public class ForgeRegistry> implements IForgeRe V dummy = this.dummyFactory.createDummy(key); if (DEBUG) - FMLLog.log.trace("Registry Dummy Add: {} {} -> {}", key, id, dummy); + FMLLog.log.debug("Registry Dummy Add: {} {} -> {}", key, id, dummy); //It was blocked before so we need to unset the blocking map this.availabilityMap.clear(id); + if (this.containsKey(key)) + { + //If the entry already exists, we need to delete it so we can add a dummy... + V value = this.names.remove(key); + if (value == null) + throw new IllegalStateException("ContainsKey for " + key + " was true, but removing by name returned no value.. This should never happen unless hackery!"); + + + Integer oldid = this.ids.inverse().remove(value); + if (oldid == null) + throw new IllegalStateException("Removed a entry that did not have an associated id: " + key + " " + value.toString() + " This should never happen unless hackery!"); + + if (oldid != id) + FMLLog.log.debug("Registry {}: Dummy ID mismatch {} {} -> {}", this.superType.getSimpleName(), key, oldid, id); + + if (DEBUG) + FMLLog.log.debug("Registry {} remove: {} {}", this.superType.getSimpleName(), key, oldid); + } int realId = this.add(id, dummy); if (realId != id) diff --git a/src/main/java/net/minecraftforge/registries/GameData.java b/src/main/java/net/minecraftforge/registries/GameData.java index 29bbff79cc..7d73c0b3b1 100644 --- a/src/main/java/net/minecraftforge/registries/GameData.java +++ b/src/main/java/net/minecraftforge/registries/GameData.java @@ -544,7 +544,7 @@ public class GameData // The server believes this is a dummy block identity, but we seem to have one locally. This is likely a conflict // in mod setup - Mark this entry as a dummy int id = reg.getID(dummy); - FMLLog.log.warn("Registry {}: The ID {} is currently locally mapped - it will be replaced with a dummy for this session", key, id); + FMLLog.log.warn("Registry {}: The ID {} @ {} is currently locally mapped - it will be replaced with a dummy for this session", dummy, key, id); reg.markDummy(dummy, id); } });