PaperMC/paper-server/nms-patches/net/minecraft/world/item/ItemChorusFruit.patch
CraftBukkit/Spigot 65bc2541a3 Update to Minecraft 1.20.5
By: md_5 <git@md-5.net>
2024-04-24 01:15:00 +10:00

20 lines
955 B
Diff

--- a/net/minecraft/world/item/ItemChorusFruit.java
+++ b/net/minecraft/world/item/ItemChorusFruit.java
@@ -36,7 +36,16 @@
Vec3D vec3d = entityliving.position();
- if (entityliving.randomTeleport(d0, d1, d2, true)) {
+ // CraftBukkit start - handle canceled status of teleport event
+ java.util.Optional<Boolean> status = entityliving.randomTeleport(d0, d1, d2, true, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.CHORUS_FRUIT);
+
+ if (!status.isPresent()) {
+ // teleport event was canceled, no more tries
+ break;
+ }
+
+ if (status.get()) {
+ // CraftBukkit end
world.gameEvent((Holder) GameEvent.TELEPORT, vec3d, GameEvent.a.of((Entity) entityliving));
SoundEffect soundeffect;
SoundCategory soundcategory;