Paper/Spigot-Server-Patches/0719-Introduce-beacon-activation-deactivation-events.patch
2021-06-11 08:29:15 +02:00

38 lines
1.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spyridon Pagkalos <spyridon@ender.gr>
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 cd28a731a56eb7534faae5b120195b62d5d15bd4..f7b210e6d60533d9faf60183a80a562b25f945d0 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_();
}