Finally fix faucet-redstone behaviour #834

This commit is contained in:
Bernhard Bonigl committed 2015-04-29 18:44:07 +02:00
1 parent 4f78717bb6
commit d0af50c149
2 files changed
+11 -6

No files matched your search

@@ -281,20 +281,24 @@ public class SearedBlock extends InventoryBlock
return world.getBlockMetadata(x, y, z) == 1;
}
private boolean wasPowered = false;
@Override
public void onNeighborBlockChange (World world, int x, int y, int z, Block neighborBlockID)
{
if (world.getBlockMetadata(x, y, z) == 1)
{
boolean isPowered = world.isBlockIndirectlyGettingPowered(x, y, z);
if (!wasPowered && isPowered)
{
FaucetLogic logic = (FaucetLogic) world.getTileEntity(x, y, z);
TileEntity te = world.getTileEntity(x, y, z);
if(!(te instanceof FaucetLogic))
return;
FaucetLogic logic = (FaucetLogic) te;
// was it a low->high pulse
if(!logic.hasRedstonePower && isPowered) {
logic.hasRedstonePower = true;
logic.setActive(true);
}
wasPowered = isPowered;
// update its state
logic.hasRedstonePower = isPowered;
}
}
@@ -15,6 +15,7 @@ public class FaucetLogic extends TileEntity implements IFacingLogic, IActiveLogi
byte direction;
boolean active;
public FluidStack liquid;
public boolean hasRedstonePower = false;
public boolean activateFaucet ()
{