mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 04:56:50 +01:00
Cross World Entity Teleportation
Use Entity.teleportTo for cross-world teleportation in CraftEntity.
This commit is contained in:
parent
7deba1c606
commit
6e842759cc
1 changed files with 6 additions and 1 deletions
|
@ -306,7 +306,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||||
// If this entity is riding another entity, we must dismount before teleporting.
|
// If this entity is riding another entity, we must dismount before teleporting.
|
||||||
entity.stopRiding();
|
entity.stopRiding();
|
||||||
|
|
||||||
entity.world = ((CraftWorld) location.getWorld()).getHandle();
|
// Let the server handle cross world teleports
|
||||||
|
if (!location.getWorld().equals(getWorld())) {
|
||||||
|
entity.teleportTo(location, cause == TeleportCause.NETHER_PORTAL);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// entity.setLocation() throws no event, and so cannot be cancelled
|
// entity.setLocation() throws no event, and so cannot be cancelled
|
||||||
entity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
entity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||||
// SPIGOT-619: Force sync head rotation also
|
// SPIGOT-619: Force sync head rotation also
|
||||||
|
|
Loading…
Reference in a new issue