3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-23 23:00:08 +01:00
Paper/nms-patches/PathfinderGoalFollowOwner.patch

35 Zeilen
2.0 KiB
Diff

--- a/net/minecraft/server/PathfinderGoalFollowOwner.java
+++ b/net/minecraft/server/PathfinderGoalFollowOwner.java
@@ -1,5 +1,11 @@
package net.minecraft.server;
+// 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 {
2018-07-15 02:00:00 +02:00
private final EntityTameableAnimal b;
2017-05-19 13:00:13 +02:00
@@ -73,7 +79,18 @@
for (int l = 0; l <= 4; ++l) {
for (int i1 = 0; i1 <= 4; ++i1) {
2017-05-14 04:00:00 +02:00
if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) && this.a(i, j, k, l, i1)) {
2018-07-15 02:00:00 +02:00
- this.b.setPositionRotation((double) ((float) (i + l) + 0.5F), (double) k, (double) ((float) (j + i1) + 0.5F), this.b.yaw, this.b.pitch);
+ // CraftBukkit start
2018-07-15 02:00:00 +02:00
+ CraftEntity entity = this.b.getBukkitEntity();
+ Location to = new Location(entity.getWorld(), (double) ((float) (i + l) + 0.5F), (double) k, (double) ((float) (j + i1) + 0.5F), this.b.yaw, this.b.pitch);
+ EntityTeleportEvent event = new EntityTeleportEvent(entity, entity.getLocation(), to);
2018-07-15 02:00:00 +02:00
+ this.b.world.getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }
+ to = event.getTo();
+
2018-07-15 02:00:00 +02:00
+ this.b.setPositionRotation(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
+ // CraftBukkit end
2018-07-22 04:00:00 +02:00
this.e.q();
return;
}