diff options
author | md_5 <git@md-5.net> | 2017-01-05 20:44:26 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2017-01-05 20:44:26 +1100 |
commit | d5e7885c2e3c6a9bf6ba2af51896800d748877ad (patch) | |
tree | 894db9b3cf5e91490227a7df23029a7ba658cfc5 /nms-patches | |
parent | c91863850dadd71f53e83b85510c2886cffe219b (diff) | |
download | craftbukkit-d5e7885c2e3c6a9bf6ba2af51896800d748877ad.tar craftbukkit-d5e7885c2e3c6a9bf6ba2af51896800d748877ad.tar.gz craftbukkit-d5e7885c2e3c6a9bf6ba2af51896800d748877ad.tar.lz craftbukkit-d5e7885c2e3c6a9bf6ba2af51896800d748877ad.tar.xz craftbukkit-d5e7885c2e3c6a9bf6ba2af51896800d748877ad.zip |
SPIGOT-2990: EntityTeleportEvent for tameable animals following owner
Diffstat (limited to 'nms-patches')
-rw-r--r-- | nms-patches/PathfinderGoalFollowOwner.patch | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/nms-patches/PathfinderGoalFollowOwner.patch b/nms-patches/PathfinderGoalFollowOwner.patch new file mode 100644 index 00000000..4d9f8f16 --- /dev/null +++ b/nms-patches/PathfinderGoalFollowOwner.patch @@ -0,0 +1,34 @@ +--- 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 { + + private final EntityTameableAnimal d; +@@ -79,7 +85,18 @@ + for (int l = 0; l <= 4; ++l) { + for (int i1 = 0; i1 <= 4; ++i1) { + if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) && this.a.getType(new BlockPosition(i + l, k - 1, j + i1)).r() && this.a(new BlockPosition(i + l, k, j + i1)) && this.a(new BlockPosition(i + l, k + 1, j + i1))) { +- this.d.setPositionRotation((double) ((float) (i + l) + 0.5F), (double) k, (double) ((float) (j + i1) + 0.5F), this.d.yaw, this.d.pitch); ++ // CraftBukkit start ++ CraftEntity entity = this.d.getBukkitEntity(); ++ Location to = new Location(entity.getWorld(), (double) ((float) (i + l) + 0.5F), (double) k, (double) ((float) (j + i1) + 0.5F), this.d.yaw, this.d.pitch); ++ EntityTeleportEvent event = new EntityTeleportEvent(entity, entity.getLocation(), to); ++ this.d.world.getServer().getPluginManager().callEvent(event); ++ if (event.isCancelled()) { ++ return; ++ } ++ to = event.getTo(); ++ ++ this.d.setPositionRotation(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch()); ++ // CraftBukkit end + this.g.o(); + return; + } |