From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Spyridon Pagkalos Date: Thu, 25 Mar 2021 20:28:04 +0200 Subject: [PATCH] Introduce beacon activation/deactivation events diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java index 8dfb9eb12d07c2d4737ecf3de1ae7f6de31891bf..c47c8c70b9f156e9a43c4555f3a38df628e4fbdf 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java +++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java @@ -201,6 +201,15 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic this.a(SoundEffects.BLOCK_BEACON_AMBIENT); } } + // Paper start - beacon activation/deactivation events + if (!(i1 > 0) && this.levels > 0) { + org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(world, position); + new io.papermc.paper.event.block.BeaconActivatedEvent(block).callEvent(); + } else if (i1 > 0 && !(this.levels > 0)) { + org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(world, position); + new io.papermc.paper.event.block.BeaconDeactivatedEvent(block).callEvent(); + } + // Paper end if (this.i >= l) { this.i = -1; @@ -257,6 +266,10 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic @Override public void al_() { + // Paper start - BeaconDeactivatedEvent + org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(world, position); + new io.papermc.paper.event.block.BeaconDeactivatedEvent(block).callEvent(); + // Paper end this.a(SoundEffects.BLOCK_BEACON_DEACTIVATE); super.al_(); }