Merge remote-tracking branch 'origin/1.7.10'

This commit is contained in:
cpw 2015-04-01 17:17:24 -04:00
commit 9d1f554075
2 changed files with 18 additions and 2 deletions

View file

@ -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()

View file

@ -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