Paper/CraftBukkit-Patches/0125-Cross-World-Entity-Teleportation.patch
Zach Brown c7f1eed0bf Update from upstream SpigotMC
3beb7729816
a77ed5758a7
52c130fc6d9
2014-12-20 19:09:49 -06:00

31 lines
1.4 KiB
Diff

From 7b13a593684de51c52c719cfefd52a836f9540fe Mon Sep 17 00:00:00 2001
From: Andrew Krieger <Slizyboy@hotmail.com>
Date: Tue, 24 Dec 2013 07:55:23 -0800
Subject: [PATCH] Cross World Entity Teleportation
Use Entity.teleportTo for cross-world teleportation in CraftEntity.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index c50396d..7e87fed 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -212,7 +212,14 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
// If this entity is riding another entity, we must dismount before teleporting.
entity.mount(null);
- entity.world = ((CraftWorld) location.getWorld()).getHandle();
+ // Spigot start
+ if (!location.getWorld().equals(getWorld())) {
+ entity.teleportTo(location, cause.equals(TeleportCause.NETHER_PORTAL));
+ return true;
+ }
+
+ // entity.world = ((CraftWorld) location.getWorld()).getHandle();
+ // Spigot end
entity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
// entity.setLocation() throws no event, and so cannot be cancelled
return true;
--
2.1.0