diff --git a/src/main/java/net/minecraftforge/registries/GameData.java b/src/main/java/net/minecraftforge/registries/GameData.java index 81f8a821e..b2f0984a7 100644 --- a/src/main/java/net/minecraftforge/registries/GameData.java +++ b/src/main/java/net/minecraftforge/registries/GameData.java @@ -273,6 +273,15 @@ public class GameData this.objectList.clear(); this.nextId = 0; } + + void remove(I key) + { + Integer prev = this.identityMap.remove(key); + if (prev != null) + { + this.objectList.set(prev, null); + } + } } private static class BlockCallbacks implements IForgeRegistry.AddCallback, IForgeRegistry.ClearCallback, IForgeRegistry.BakeCallback, IForgeRegistry.CreateCallback, IForgeRegistry.DummyFactory @@ -316,6 +325,14 @@ public class GameData } /* + if (oldBlock != null) + { + for (IBlockState state : oldBlock.getBlockState().getValidStates()) + { + blockstateMap.remove(state); + } + } + if ("minecraft:tripwire".equals(block.getRegistryName().toString())) //Tripwire is crap so we have to special case whee! { for (int meta = 0; meta < 15; meta++) @@ -424,6 +441,12 @@ public class GameData @Override public void onAdd(IForgeRegistryInternal owner, RegistryManager stage, int id, Item item, @Nullable Item oldItem) { + if (oldItem instanceof ItemBlock) + { + @SuppressWarnings("unchecked") + BiMap blockToItem = owner.getSlaveMap(BLOCK_TO_ITEM, BiMap.class); + blockToItem.remove(((ItemBlock)oldItem).getBlock()); + } if (item instanceof ItemBlock) { @SuppressWarnings("unchecked") @@ -511,6 +534,7 @@ public class GameData } if (entry.getEgg() != null) EntityList.ENTITY_EGGS.put(entry.getRegistryName(), entry.getEgg()); + } } } */