/** * Sets whether this pressure plate is pressed down * * @param block to set it of * @param pressed whether it is pressed */ public void setPressed(Block block, boolean pressed) { if (this.isPressed(block) != pressed) { block.setDataBits(0x1, pressed); GeneralEffects.BLOCK_PRESS.playGlobal(block.getPosition(), pressed); } block.resetDynamic(); }
@Override public void setToggled(Block block, boolean toggled) { if (this.isToggled(block) != toggled) { block.setDataBits(0x8, toggled); GeneralEffects.BLOCK_PRESS.playGlobal(block.getPosition(), toggled); } block.resetDynamic(); }
@Override public void onUpdate(BlockMaterial oldMaterial, Block block) { super.onUpdate(oldMaterial, block); boolean hasHook = VanillaMaterials.TRIPWIRE.findHook(block, getAttachedFace(block).getOpposite()) != null; if (!hasHook && !this.isToggled(block) && block.isDataBitSet(0x4)) { // play sound of wire snapping GeneralEffects.TRIPWIRE_SNAP.playGlobal(block.getPosition()); } block.setDataBits(0x4, hasHook); }
@Override public void setOpen(Block block, boolean open) { block.setDataBits(0x4, open); }
/** * Sets whether this liquid is flowing down * * @param block of the liquid * @param flowing down state of the liquid */ public void setFlowingDown(Block block, boolean flowing) { block.setDataBits(0x8, flowing); }