PaperMC/paper-server/patches/sources/net/minecraft/world/entity/EntityTameableAnimal.patch
CraftBukkit/Spigot a265d64138 Move CraftBukkit per-file patches
By: Initial <noreply+automated@papermc.io>
2024-12-11 22:26:36 +01:00

31 lines
1.3 KiB
Diff

--- a/net/minecraft/world/entity/EntityTameableAnimal.java
+++ b/net/minecraft/world/entity/EntityTameableAnimal.java
@@ -28,6 +28,12 @@
import net.minecraft.world.level.pathfinder.PathfinderNormal;
import net.minecraft.world.scores.ScoreboardTeam;
+// CraftBukkit start
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.EntityTeleportEvent;
+// CraftBukkit end
+
public abstract class EntityTameableAnimal extends EntityAnimal implements OwnableEntity {
public static final int TELEPORT_WHEN_DISTANCE_IS_SQ = 144;
@@ -295,7 +301,14 @@
if (!this.canTeleportTo(new BlockPosition(i, j, k))) {
return false;
} else {
- this.moveTo((double) i + 0.5D, (double) j, (double) k + 0.5D, this.getYRot(), this.getXRot());
+ // CraftBukkit start
+ EntityTeleportEvent event = CraftEventFactory.callEntityTeleportEvent(this, (double) i + 0.5D, (double) j, (double) k + 0.5D);
+ if (event.isCancelled()) {
+ return false;
+ }
+ Location to = event.getTo();
+ this.moveTo(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
+ // CraftBukkit end
this.navigation.stop();
return true;
}