aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/world/item/ChorusFruitItem.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/item/ChorusFruitItem.java.patch')
-rw-r--r--patch-remap/mache-spigotflower-stripped/net/minecraft/world/item/ChorusFruitItem.java.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/item/ChorusFruitItem.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/item/ChorusFruitItem.java.patch
new file mode 100644
index 0000000000..7732cbb121
--- /dev/null
+++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/item/ChorusFruitItem.java.patch
@@ -0,0 +1,33 @@
+--- a/net/minecraft/world/item/ChorusFruitItem.java
++++ b/net/minecraft/world/item/ChorusFruitItem.java
+@@ -36,14 +35,23 @@
+
+ Vec3 vec3 = livingentity.position();
+
+- if (livingentity.randomTeleport(d0, d1, d2, true)) {
+- level.gameEvent(GameEvent.TELEPORT, vec3, GameEvent.Context.of((Entity) livingentity));
+- SoundEvent soundevent;
+- SoundSource soundsource;
++ // 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 (livingentity instanceof Fox) {
+- soundevent = SoundEvents.FOX_TELEPORT;
+- soundsource = SoundSource.NEUTRAL;
++ if (!status.isPresent()) {
++ // teleport event was canceled, no more tries
++ break;
++ }
++
++ if (status.get()) {
++ // CraftBukkit end
++ level.gameEvent(GameEvent.TELEPORT, vec3d, GameEvent.Context.of((Entity) entityLiving));
++ SoundEvent soundeffect;
++ SoundSource soundcategory;
++
++ if (entityLiving instanceof Fox) {
++ soundeffect = SoundEvents.FOX_TELEPORT;
++ soundcategory = SoundSource.NEUTRAL;
+ } else {
+ soundevent = SoundEvents.CHORUS_FRUIT_TELEPORT;
+ soundsource = SoundSource.PLAYERS;