Example #1
0
 @Override
 public void onUpdate(BlockMaterial oldMaterial, Block block) {
   super.onUpdate(oldMaterial, block);
   if (!(oldMaterial instanceof TrapDoor) && block.getMaterial().equals(this)) {
     boolean powered = this.isReceivingPower(block);
     if (powered != this.isOpen(block)) {
       this.setOpen(block, powered);
       playBlockEffect(block, null, PlayEffectMessage.Messages.RANDOM_DOOR);
     }
   }
 }
Example #2
0
 @Override
 public void onInteractBy(Entity entity, Block block, Action type, BlockFace clickedFace) {
   super.onInteractBy(entity, block, type, clickedFace);
   toggleOpen(block);
   playBlockEffect(block, entity, PlayEffectMessage.Messages.RANDOM_DOOR);
 }