mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-04 23:47:59 +01:00
hollow-cube/fix-slow-dimension-change
This commit is contained in:
parent
54e839e58a
commit
388dbf71b9
@ -518,6 +518,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
||||
* Sends necessary packets to synchronize player data after a {@link RespawnPacket}
|
||||
*/
|
||||
private void refreshClientStateAfterRespawn() {
|
||||
sendPacket(new ServerDifficultyPacket(MinecraftServer.getDifficulty(), false));
|
||||
sendPacket(new UpdateHealthPacket(this.getHealth(), food, foodSaturation));
|
||||
sendPacket(new SetExperiencePacket(exp, level, 0));
|
||||
triggerStatus((byte) (24 + permissionLevel)); // Set permission level
|
||||
@ -682,7 +683,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
||||
*/
|
||||
private void spawnPlayer(@NotNull Instance instance, @NotNull Pos spawnPosition,
|
||||
boolean firstSpawn, boolean dimensionChange, boolean updateChunks) {
|
||||
if (!firstSpawn) {
|
||||
if (!firstSpawn && !dimensionChange) {
|
||||
// Player instance changed, clear current viewable collections
|
||||
if (updateChunks)
|
||||
ChunkUtils.forChunksInRange(spawnPosition, MinecraftServer.getChunkViewDistance(), chunkRemover);
|
||||
@ -722,9 +723,16 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
||||
}
|
||||
|
||||
synchronizePosition(true); // So the player doesn't get stuck
|
||||
sendPacket(new SpawnPositionPacket(spawnPosition, 0));
|
||||
|
||||
if (dimensionChange) {
|
||||
instance.getWorldBorder().init(this);
|
||||
sendPacket(new TimeUpdatePacket(instance.getWorldAge(), instance.getTime()));
|
||||
}
|
||||
|
||||
if (dimensionChange || firstSpawn) {
|
||||
this.inventory.update();
|
||||
sendPacket(new HeldItemChangePacket(heldSlot));
|
||||
}
|
||||
|
||||
EventDispatcher.call(new PlayerSpawnEvent(this, instance, firstSpawn));
|
||||
|
Loading…
Reference in New Issue
Block a user