mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-02 17:32:03 +01:00
Made teleporting between worlds 'smoother'. Thanks Raphfrk!
By: EvilSeph <evilseph@unaligned.org>
This commit is contained in:
parent
8dcebbc6fd
commit
c06f71942e
1 changed files with 11 additions and 0 deletions
|
@ -12,6 +12,7 @@ import net.minecraft.server.Packet54PlayNoteBlock;
|
|||
import net.minecraft.server.Packet6SpawnPosition;
|
||||
import net.minecraft.server.ServerConfigurationManager;
|
||||
import net.minecraft.server.WorldServer;
|
||||
import net.minecraft.server.ChunkCoordIntPair;
|
||||
import org.bukkit.Achievement;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
@ -194,6 +195,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||
if (teleportSuccess) {
|
||||
manager.server.tracker.trackPlayer(entity);
|
||||
manager.server.tracker.untrackEntity(entity);
|
||||
int cx = (int) location.getBlockX() >> 4;
|
||||
int cz = (int) location.getBlockZ() >> 4;
|
||||
for (int x = -10 ; x <= 10 ; x++ ) {
|
||||
for (int z = -10 ; z <= 10 ; z++ ) {
|
||||
ChunkCoordIntPair chunkPosition = new ChunkCoordIntPair(cx + x, cz + z);
|
||||
if (entity.g.remove(chunkPosition)) {
|
||||
newEntity.g.add(chunkPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
oldWorld.manager.removePlayer(entity);
|
||||
manager.players.remove(entity);
|
||||
oldWorld.removeEntity(entity);
|
||||
|
|
Loading…
Reference in a new issue