Return false when recolouring block to it's original colour.

This commit is contained in:
ganymedes01 2014-12-15 02:10:49 -02:00
parent fb18a492e4
commit 6c43cddc72
2 changed files with 5 additions and 4 deletions

View file

@ -1312,8 +1312,7 @@ public class BlockGenericPipe extends BlockBuildCraft {
public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int colour) { public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int colour) {
TileGenericPipe pipeTile = (TileGenericPipe) world.getTileEntity(x, y, z); TileGenericPipe pipeTile = (TileGenericPipe) world.getTileEntity(x, y, z);
if (!pipeTile.hasPlug(side)) { if (!pipeTile.hasPlug(side)) {
pipeTile.setColor(colour); return pipeTile.setColor(colour);
return true;
} }
return false; return false;

View file

@ -434,13 +434,15 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
return worldObj.isRemote ? renderState.glassColor : this.glassColor; return worldObj.isRemote ? renderState.glassColor : this.glassColor;
} }
public void setColor(int color) { public boolean setColor(int color) {
// -1 = no color // -1 = no color
if (!worldObj.isRemote && color >= -1 && color < 16) { if (!worldObj.isRemote && color >= -1 && color < 16 && glassColor != color) {
glassColor = color; glassColor = color;
notifyBlockChanged(); notifyBlockChanged();
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, blockType); worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, blockType);
return true;
} }
return false;
} }
/** /**