예제 #1
0
 @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);
 }
예제 #2
0
 @Override
 public void onDynamicUpdate(Block block, long updateTime, int data) {
   if (this.isToggled(block)) {
     BlockFace direction = getAttachedFace(block).getOpposite();
     this.setToggled(block, false);
     block = VanillaMaterials.TRIPWIRE.findHook(block, direction);
     if (block != null) {
       this.setToggled(block, false);
     }
   }
 }