spigot/CraftBukkit-Patches/0111-Cross-World-Entity-Teleportation.patch
2016-04-01 10:59:39 +01:00

30 lines
1.4 KiB
Diff

From 787f876ad4c8db6e0f9e80f1c21f684102eec3cd 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 5207b70..8a1df54 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -233,7 +233,14 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
// If this entity is riding another entity, we must dismount before teleporting.
entity.stopRiding();
- 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.world.entityJoinedWorld(entity, false); // Spigot - register to new chunk
// entity.setLocation() throws no event, and so cannot be cancelled
--
1.9.1