Changed Door Item Mapping Code

1. Changed EventHookContainer to remove a check against
BaseItemDoor.getDoorToPlace().  The checks performed there can be done
in BaseItemDoor.tryToPlaceDoor(), which removes the need for callers to
know more internal details about how doors are handled. I moved the
checks inside.
2. Renamed vanillaDoorMapping to doorItemMapping. It now maps dim door
items to themselves to remove the need for various checks we were
performing. Updated BaseItemDoor's constructor to reflect this change.
3. Removed BaseItemDoor.getDoorToPlace() and integrated its
functionality into BaseItemDoor.tryToPlaceDoor().
4. Changed BaseItemDoor.tryToPlaceDoor() so that it simply returns false
if a given item stack cannot be used to place any doors. We don't need
to check if the item is an ItemDoor or anything like that now.
This commit is contained in:
SenseiKiwi
2014-06-25 14:56:59 -04:00
parent 660ff4255e
commit e4e84644ac
2 changed files with 20 additions and 30 deletions

View File

@@ -88,14 +88,11 @@ public class EventHookContainer
ItemStack stack = event.entityPlayer.inventory.getCurrentItem();
if (stack != null && stack.getItem() instanceof ItemDoor)
{
if (BaseItemDoor.getDoorToPlace(stack.getItem()) != null)
if (BaseItemDoor.tryToPlaceDoor(stack, event.entityPlayer, world,
event.x, event.y, event.z, event.face))
{
if (BaseItemDoor.tryToPlaceDoor(stack, event.entityPlayer, world,
event.x, event.y, event.z, event.face))
{
// Cancel the event so that we don't get two doors from vanilla doors
event.setCanceled(true);
}
// Cancel the event so that we don't get two doors from vanilla doors
event.setCanceled(true);
}
}
}