From adaf7c3ae8b162e7f9018f65cbc4502248547c63 Mon Sep 17 00:00:00 2001 From: Andrew Krieger Date: Tue, 24 Dec 2013 10:18:01 +1100 Subject: [PATCH] Use Entity.teleportTo in CraftEntity.teleport Entity.teleportTo is largely stable and correct. CraftEntity.teleport, however, still cannot properly handle cross-world teleportation. Fix it to defer to the better code in core Minecraft. --- ...y.teleportTo-in-CraftEntity.teleport.patch | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 CraftBukkit-Patches/0086-Use-Entity.teleportTo-in-CraftEntity.teleport.patch diff --git a/CraftBukkit-Patches/0086-Use-Entity.teleportTo-in-CraftEntity.teleport.patch b/CraftBukkit-Patches/0086-Use-Entity.teleportTo-in-CraftEntity.teleport.patch new file mode 100644 index 0000000000..8db98c373a --- /dev/null +++ b/CraftBukkit-Patches/0086-Use-Entity.teleportTo-in-CraftEntity.teleport.patch @@ -0,0 +1,30 @@ +From 9c4d436d0c863fd3839cd93ededc55bad112f11f Mon Sep 17 00:00:00 2001 +From: Andrew Krieger +Date: Tue, 24 Dec 2013 10:17:46 +1100 +Subject: [PATCH] Use Entity.teleportTo in CraftEntity.teleport + +Entity.teleportTo is largely stable and correct. CraftEntity.teleport, +however, still cannot properly handle cross-world teleportation. Fix it +to defer to the better code in core Minecraft. + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +index 96d763b..5ff5fe4 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +@@ -205,8 +205,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { + return false; + } + +- entity.world = ((CraftWorld) location.getWorld()).getHandle(); +- entity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); ++ // Spigot Start ++ // entity.world = ((CraftWorld) location.getWorld()).getHandle(); ++ // entity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); ++ entity.teleportTo( location, cause == TeleportCause.NETHER_PORTAL ); ++ // Spigot End + // entity.setLocation() throws no event, and so cannot be cancelled + return true; + } +-- +1.8.3.2 +