Wait for client settings

This commit is contained in:
Németh Noel 2021-05-05 18:11:24 +02:00
parent bea622db0b
commit 7881cea36c

View File

@ -2346,17 +2346,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
* based on which one is the lowest * based on which one is the lowest
*/ */
public int getChunkRange() { public int getChunkRange() {
final int playerRange = getSettings().viewDistance; return Math.min(getSettings().viewDistance, MinecraftServer.getChunkViewDistance());
if (playerRange < 1) {
// Didn't receive settings packet yet (is the case on login)
// In this case we send an arbitrary number of chunks
// Will be updated in PlayerSettings#refresh.
// Non-compliant clients might also be stuck with this view
return 7;
} else {
final int serverRange = MinecraftServer.getChunkViewDistance();
return Math.min(playerRange, serverRange);
}
} }
/** /**
@ -2588,6 +2578,10 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
private byte displayedSkinParts; private byte displayedSkinParts;
private MainHand mainHand; private MainHand mainHand;
public PlayerSettings() {
viewDistance = -1;
}
/** /**
* The player game language. * The player game language.
* *