mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-03 09:19:38 +01:00
31 lines
1.4 KiB
Diff
31 lines
1.4 KiB
Diff
From 53ee60cb03a718db23c05a44991b29186c01b0c0 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 0fc57de..6f4b46f 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
@@ -244,7 +244,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.setLocation() throws no event, and so cannot be cancelled
|
|
return true;
|
|
--
|
|
2.5.0
|
|
|