mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 06:30:46 +01:00
Proper 'otherworld' chunkloading
By: Erik Broes <erikbroes@grum.nl>
This commit is contained in:
parent
5ddeb60d33
commit
87d721733f
1 changed files with 7 additions and 1 deletions
|
@ -113,10 +113,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void teleportTo(Location location) {
|
public void teleportTo(Location location) {
|
||||||
if (location.getWorld() != getWorld()) {
|
boolean worldChange = location.getWorld() != getWorld();
|
||||||
|
if (worldChange) {
|
||||||
|
// Unload player from current chunks
|
||||||
server.getServer().f.d.b(entity);
|
server.getServer().f.d.b(entity);
|
||||||
}
|
}
|
||||||
entity.world = ((CraftWorld)location.getWorld()).getHandle();
|
entity.world = ((CraftWorld)location.getWorld()).getHandle();
|
||||||
entity.b(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
entity.b(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||||
|
if (worldChange) {
|
||||||
|
// Forceload the chunks around player
|
||||||
|
server.getServer().f.d.a(entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue