From 9840c0e406f74cb86e44655969b93f3e5006122a Mon Sep 17 00:00:00 2001 From: Krapht Date: Sun, 15 Jul 2012 01:37:50 +0200 Subject: [PATCH] Moved facade adding to onItemUseFirst() in order to be able to add them to pipes with gates --- .../src/buildcraft/transport/ItemFacade.java | 33 +++++++------------ 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/common/net/minecraft/src/buildcraft/transport/ItemFacade.java b/common/net/minecraft/src/buildcraft/transport/ItemFacade.java index ed70e217..c823246b 100644 --- a/common/net/minecraft/src/buildcraft/transport/ItemFacade.java +++ b/common/net/minecraft/src/buildcraft/transport/ItemFacade.java @@ -53,33 +53,24 @@ public class ItemFacade extends ItemBuildCraft { } } - @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World worldObj, int x, int y, int z, int side) { - TileEntity tile = worldObj.getBlockTileEntity(x, y, z); - if (!(tile instanceof TileGenericPipe)) return false; - - if (((TileGenericPipe)tile).addFacade(Orientations.values()[side], ItemFacade.getBlockId(stack.getItemDamage()), ItemFacade.getMetaData(stack.getItemDamage()))){ - stack.stackSize--; - return true; - } - - return false; - } - @Override public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World worldObj, int x, int y, int z, int side) { if (worldObj.isRemote) return false; - if (!player.isSneaking()) return false; - TileEntity tile = worldObj.getBlockTileEntity(x, y, z); if (!(tile instanceof TileGenericPipe)) return false; - TileGenericPipe pipeTile = (TileGenericPipe)tile; - - if (!pipeTile.hasFacade(Orientations.dirs()[side])) return false; - - pipeTile.dropFacade(Orientations.dirs()[side]); - return true; + + if (player.isSneaking()) { //Strip facade + if (!pipeTile.hasFacade(Orientations.dirs()[side])) return false; + pipeTile.dropFacade(Orientations.dirs()[side]); + return true; + } else { + if (((TileGenericPipe)tile).addFacade(Orientations.values()[side], ItemFacade.getBlockId(stack.getItemDamage()), ItemFacade.getMetaData(stack.getItemDamage()))){ + stack.stackSize--; + return true; + } + return false; + } } @SuppressWarnings("rawtypes")