diff --git a/fml/src/main/java/net/minecraftforge/fml/common/event/FMLMissingMappingsEvent.java b/fml/src/main/java/net/minecraftforge/fml/common/event/FMLMissingMappingsEvent.java index a0049dc048..f1de7cc151 100644 --- a/fml/src/main/java/net/minecraftforge/fml/common/event/FMLMissingMappingsEvent.java +++ b/fml/src/main/java/net/minecraftforge/fml/common/event/FMLMissingMappingsEvent.java @@ -51,7 +51,11 @@ public class FMLMissingMappingsEvent extends FMLEvent { /** * Remap this name to a new name (add a migration mapping) */ - REMAP + REMAP, + /** + * Allow a block to exist without itemblock anymore + */ + BLOCKONLY } public static class MissingMapping { public final GameRegistry.Type type; @@ -72,7 +76,7 @@ public class FMLMissingMappingsEvent extends FMLEvent { @Deprecated public void setAction(Action target) { - if (target == Action.DEFAULT || target == Action.REMAP) throw new IllegalArgumentException(); + if (target == Action.DEFAULT || target == Action.REMAP || target == Action.BLOCKONLY) throw new IllegalArgumentException(); this.action = target; } @@ -137,6 +141,12 @@ public class FMLMissingMappingsEvent extends FMLEvent { this.target = target; } + public void skipItemBlock() + { + if (type != GameRegistry.Type.ITEM) throw new IllegalArgumentException("Cannot skip an item that is a block"); + if (GameData.getBlockRegistry().getRaw(id) == null) throw new IllegalArgumentException("Cannot skip an ItemBlock that doesn't have a Block"); + action = Action.BLOCKONLY; + } // internal public Action getAction() diff --git a/fml/src/main/java/net/minecraftforge/fml/common/registry/GameData.java b/fml/src/main/java/net/minecraftforge/fml/common/registry/GameData.java index a08c114c1d..e02f6544d5 100644 --- a/fml/src/main/java/net/minecraftforge/fml/common/registry/GameData.java +++ b/fml/src/main/java/net/minecraftforge/fml/common/registry/GameData.java @@ -554,6 +554,12 @@ public class GameData { (remap.type == Type.BLOCK ? remapBlocks : remapItems).put(newName, new Integer[] { currId, newId }); } } + else if (action == FMLMissingMappingsEvent.Action.BLOCKONLY) + { + // Pulled out specifically so the block doesn't get reassigned a new ID just because it's + // Item block has gone away + FMLLog.fine("The ItemBlock %s is no longer present in the game. The residual block will remain", remap.name); + } else { // block item missing, warn as requested and block the id