2021-06-11 12:02:28 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
|
|
Date: Wed, 24 Jun 2020 15:14:51 -0600
|
|
|
|
Subject: [PATCH] Added firing of PlayerChangeBeaconEffectEvent
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
2022-03-01 05:43:03 +00:00
|
|
|
index 063998751c21b4f75cf3bfff6c51c4e8c42bd5f3..a515898e718effe92c91fd0ac45fbb70ddb5d626 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
2022-03-01 05:43:03 +00:00
|
|
|
@@ -160,10 +160,16 @@ public class BeaconMenu extends AbstractContainerMenu {
|
2021-06-11 12:02:28 +00:00
|
|
|
|
|
|
|
public void updateEffects(int primaryEffectId, int secondaryEffectId) {
|
|
|
|
if (this.paymentSlot.hasItem()) {
|
|
|
|
- this.beaconData.set(1, primaryEffectId);
|
|
|
|
- this.beaconData.set(2, secondaryEffectId);
|
|
|
|
+ // Paper start
|
2021-06-14 19:58:32 +00:00
|
|
|
+ io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent event = new io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent((org.bukkit.entity.Player) this.player.player.getBukkitEntity(), org.bukkit.potion.PotionEffectType.getById(primaryEffectId), org.bukkit.potion.PotionEffectType.getById(secondaryEffectId), this.access.getLocation().getBlock());
|
2021-06-11 12:02:28 +00:00
|
|
|
+ if (event.callEvent()) {
|
|
|
|
+ this.beaconData.set(1, event.getPrimary() == null ? 0 : event.getPrimary().getId());
|
|
|
|
+ this.beaconData.set(2, event.getSecondary() == null ? 0 : event.getSecondary().getId());
|
|
|
|
+ if (!event.willConsumeItem()) return;
|
2021-06-14 19:58:32 +00:00
|
|
|
this.paymentSlot.remove(1);
|
2021-12-10 14:24:07 +00:00
|
|
|
this.access.execute(Level::blockEntityChanged);
|
2021-06-11 12:02:28 +00:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|