mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 19:34:09 +01:00
eed041d629
By: md_5 <git@md-5.net>
31 lines
1.3 KiB
Diff
31 lines
1.3 KiB
Diff
--- a/net/minecraft/world/entity/EntityTameableAnimal.java
|
|
+++ b/net/minecraft/world/entity/EntityTameableAnimal.java
|
|
@@ -27,6 +27,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;
|
|
@@ -281,7 +287,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;
|
|
}
|