mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 19:59:55 +00:00
Finally fix faucet-redstone behaviour #834
This commit is contained in:
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 ()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user