Moved facade adding to onItemUseFirst() in order to be able to add them to pipes with gates
This commit is contained in:
parent
ebe9e3a020
commit
9840c0e406
1 changed files with 12 additions and 21 deletions
|
@ -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
|
@Override
|
||||||
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World worldObj, int x, int y, int z, int side) {
|
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World worldObj, int x, int y, int z, int side) {
|
||||||
if (worldObj.isRemote) return false;
|
if (worldObj.isRemote) return false;
|
||||||
if (!player.isSneaking()) return false;
|
|
||||||
|
|
||||||
TileEntity tile = worldObj.getBlockTileEntity(x, y, z);
|
TileEntity tile = worldObj.getBlockTileEntity(x, y, z);
|
||||||
if (!(tile instanceof TileGenericPipe)) return false;
|
if (!(tile instanceof TileGenericPipe)) return false;
|
||||||
|
|
||||||
TileGenericPipe pipeTile = (TileGenericPipe)tile;
|
TileGenericPipe pipeTile = (TileGenericPipe)tile;
|
||||||
|
|
||||||
if (!pipeTile.hasFacade(Orientations.dirs()[side])) return false;
|
if (player.isSneaking()) { //Strip facade
|
||||||
|
if (!pipeTile.hasFacade(Orientations.dirs()[side])) return false;
|
||||||
pipeTile.dropFacade(Orientations.dirs()[side]);
|
pipeTile.dropFacade(Orientations.dirs()[side]);
|
||||||
return true;
|
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")
|
@SuppressWarnings("rawtypes")
|
||||||
|
|
Loading…
Reference in a new issue