mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-01 05:58:00 +01:00
Fix glitchy chunk loading when you first login and don't send chunks to a player that are out of the player's render distance.
This commit is contained in:
parent
542d603d60
commit
74c99e8886
@ -558,7 +558,8 @@ public class Player extends LivingEntity implements CommandSender {
|
||||
viewableChunks.add(chunk);
|
||||
chunk.addViewer(this);
|
||||
instance.sendChunk(this, chunk);
|
||||
updateViewPosition(chunk);
|
||||
if (chunk.getChunkX() == Math.floorDiv((int) getPosition().getX(), 16) && chunk.getChunkZ() == Math.floorDiv((int) getPosition().getZ(), 16))
|
||||
updateViewPosition(chunk);
|
||||
}
|
||||
final boolean isLast = counter.get() == length - 1;
|
||||
if (isLast) {
|
||||
@ -1170,8 +1171,8 @@ public class Player extends LivingEntity implements CommandSender {
|
||||
* @param newChunk the current/new player chunk
|
||||
*/
|
||||
protected void onChunkChange(Chunk lastChunk, Chunk newChunk) {
|
||||
final long[] lastVisibleChunks = ChunkUtils.getChunksInRange(new Position(16 * lastChunk.getChunkX(), 0, 16 * lastChunk.getChunkZ()), MinecraftServer.CHUNK_VIEW_DISTANCE);
|
||||
final long[] updatedVisibleChunks = ChunkUtils.getChunksInRange(new Position(16 * newChunk.getChunkX(), 0, 16 * newChunk.getChunkZ()), MinecraftServer.CHUNK_VIEW_DISTANCE);
|
||||
final long[] lastVisibleChunks = ChunkUtils.getChunksInRange(new Position(16 * lastChunk.getChunkX(), 0, 16 * lastChunk.getChunkZ()), getChunkRange());
|
||||
final long[] updatedVisibleChunks = ChunkUtils.getChunksInRange(new Position(16 * newChunk.getChunkX(), 0, 16 * newChunk.getChunkZ()), getChunkRange());
|
||||
final int[] oldChunks = ArrayUtils.getDifferencesBetweenArray(lastVisibleChunks, updatedVisibleChunks);
|
||||
final int[] newChunks = ArrayUtils.getDifferencesBetweenArray(updatedVisibleChunks, lastVisibleChunks);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user