From d0af50c149d857290141cc7f6ed275f7258df3db Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Wed, 29 Apr 2015 18:44:07 +0200 Subject: [PATCH] Finally fix faucet-redstone behaviour #834 --- .../tconstruct/smeltery/blocks/SearedBlock.java | 16 ++++++++++------ .../tconstruct/smeltery/logic/FaucetLogic.java | 1 + 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/main/java/tconstruct/smeltery/blocks/SearedBlock.java b/src/main/java/tconstruct/smeltery/blocks/SearedBlock.java index 8fcfc41f..af435046 100644 --- a/src/main/java/tconstruct/smeltery/blocks/SearedBlock.java +++ b/src/main/java/tconstruct/smeltery/blocks/SearedBlock.java @@ -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; } } diff --git a/src/main/java/tconstruct/smeltery/logic/FaucetLogic.java b/src/main/java/tconstruct/smeltery/logic/FaucetLogic.java index 56f80c84..4e57315a 100644 --- a/src/main/java/tconstruct/smeltery/logic/FaucetLogic.java +++ b/src/main/java/tconstruct/smeltery/logic/FaucetLogic.java @@ -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 () {