PaperMC/paper-server/nms-patches/PathfinderGoalFollowOwner.patch
CraftBukkit/Spigot b2efd58164 Organise imports
By: md_5 <git@md-5.net>
2021-03-09 08:47:33 +11:00

35 lines
1.4 KiB
Diff

--- a/net/minecraft/server/PathfinderGoalFollowOwner.java
+++ b/net/minecraft/server/PathfinderGoalFollowOwner.java
@@ -2,6 +2,12 @@
import java.util.EnumSet;
+// CraftBukkit start
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftEntity;
+import org.bukkit.event.entity.EntityTeleportEvent;
+// CraftBukkit end
+
public class PathfinderGoalFollowOwner extends PathfinderGoal {
private final EntityTameableAnimal a;
@@ -104,7 +110,18 @@
} else if (!this.a(new BlockPosition(i, j, k))) {
return false;
} else {
- this.a.setPositionRotation((double) i + 0.5D, (double) j, (double) k + 0.5D, this.a.yaw, this.a.pitch);
+ // CraftBukkit start
+ CraftEntity entity = this.a.getBukkitEntity();
+ Location to = new Location(entity.getWorld(), (double) i + 0.5D, (double) j, (double) k + 0.5D, this.a.yaw, this.a.pitch);
+ EntityTeleportEvent event = new EntityTeleportEvent(entity, entity.getLocation(), to);
+ this.a.world.getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return false;
+ }
+ to = event.getTo();
+
+ this.a.setPositionRotation(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
+ // CraftBukkit end
this.e.o();
return true;
}