craftbukkit/nms-patches/net/minecraft/world/item/ItemChorusFruit.patch

21 lines
999 B
Diff
Raw Normal View History

2021-03-16 09:00:00 +11:00
--- a/net/minecraft/world/item/ItemChorusFruit.java
+++ b/net/minecraft/world/item/ItemChorusFruit.java
2022-06-08 02:00:00 +10:00
@@ -39,7 +39,16 @@
Vec3D vec3d = entityliving.position();
2021-11-22 09:00:00 +11:00
- if (entityliving.randomTeleport(d3, d4, d5, true)) {
+ // CraftBukkit start - handle canceled status of teleport event
2021-11-22 09:00:00 +11:00
+ java.util.Optional<Boolean> status = entityliving.randomTeleport(d3, d4, d5, true, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.CHORUS_FRUIT);
2016-11-17 12:41:03 +11:00
+
+ if (!status.isPresent()) {
+ // teleport event was canceled, no more tries
+ break;
+ }
+
+ if (status.get()) {
+ // CraftBukkit end
2022-06-08 02:00:00 +10:00
world.gameEvent(GameEvent.TELEPORT, vec3d, GameEvent.a.of((Entity) entityliving));
2021-06-11 15:00:00 +10:00
SoundEffect soundeffect = entityliving instanceof EntityFox ? SoundEffects.FOX_TELEPORT : SoundEffects.CHORUS_FRUIT_TELEPORT;