Extracted method dropFacadeItem to avoid code duplication

This commit is contained in:
Krapht 2013-03-23 23:09:10 +01:00
parent ada2bad7b0
commit 86d69f4078

View file

@ -566,10 +566,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
return false; return false;
if (hasFacade(direction)) { if (hasFacade(direction)) {
Utils.dropItems( dropFacadeItem(direction);
worldObj,
new ItemStack(BuildCraftTransport.facadeItem, 1,
ItemFacade.encode(this.facadeBlocks[direction.ordinal()], this.facadeMeta[direction.ordinal()])), this.xCoord, this.yCoord, this.zCoord);
} }
this.facadeBlocks[direction.ordinal()] = blockid; this.facadeBlocks[direction.ordinal()] = blockid;
@ -584,16 +581,17 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
return renderState.facadeMatrix.isConnected(direction); return renderState.facadeMatrix.isConnected(direction);
return (this.facadeBlocks[direction.ordinal()] != 0); return (this.facadeBlocks[direction.ordinal()] != 0);
} }
private void dropFacadeItem(ForgeDirection direction){
Utils.dropItems(worldObj, new ItemStack(BuildCraftTransport.facadeItem, 1, ItemFacade.encode(this.facadeBlocks[direction.ordinal()], this.facadeMeta[direction.ordinal()])), this.xCoord, this.yCoord, this.zCoord);
}
public void dropFacade(ForgeDirection direction) { public void dropFacade(ForgeDirection direction) {
if (this.worldObj.isRemote) if (this.worldObj.isRemote)
return; return;
if (!hasFacade(direction)) if (!hasFacade(direction))
return; return;
Utils.dropItems( dropFacadeItem(direction);
worldObj,
new ItemStack(BuildCraftTransport.facadeItem, 1,
ItemFacade.encode(this.facadeBlocks[direction.ordinal()], this.facadeMeta[direction.ordinal()])), this.xCoord, this.yCoord, this.zCoord);
this.facadeBlocks[direction.ordinal()] = 0; this.facadeBlocks[direction.ordinal()] = 0;
this.facadeMeta[direction.ordinal()] = 0; this.facadeMeta[direction.ordinal()] = 0;
worldObj.notifyBlockChange(this.xCoord, this.yCoord, this.zCoord, worldObj.getBlockId(this.xCoord, this.yCoord, this.zCoord)); worldObj.notifyBlockChange(this.xCoord, this.yCoord, this.zCoord, worldObj.getBlockId(this.xCoord, this.yCoord, this.zCoord));