From 51c1792d67f20a17f88abb92461833926f01f7f0 Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Fri, 15 Nov 2019 22:21:26 -0600 Subject: [PATCH] Only send one empty chunk upon login --- .../network/session/GeyserSession.java | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index b5be8cbc..8f4544d3 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -135,25 +135,22 @@ public class GeyserSession implements Player { Vector3f pos = Vector3f.ZERO; int chunkX = pos.getFloorX() >> 4; int chunkZ = pos.getFloorZ() >> 4; - for (int x = -5; x < 5; x++) { - for (int z = -5; z < 5; z++) { - NetworkChunkPublisherUpdatePacket chunkPublisherUpdatePacket = new NetworkChunkPublisherUpdatePacket(); - chunkPublisherUpdatePacket.setPosition(pos.toInt()); - chunkPublisherUpdatePacket.setRadius(renderDistance << 4); - upstream.sendPacket(chunkPublisherUpdatePacket); + NetworkChunkPublisherUpdatePacket chunkPublisherUpdatePacket = new NetworkChunkPublisherUpdatePacket(); + chunkPublisherUpdatePacket.setPosition(pos.toInt()); + chunkPublisherUpdatePacket.setRadius(renderDistance << 4); + upstream.sendPacket(chunkPublisherUpdatePacket); - LevelChunkPacket data = new LevelChunkPacket(); - data.setChunkX(chunkX + x); - data.setChunkZ(chunkZ + z); - data.setSubChunksLength(0); - data.setData(TranslatorsInit.EMPTY_LEVEL_CHUNK_DATA); - upstream.sendPacket(data); - } - } + LevelChunkPacket data = new LevelChunkPacket(); + data.setChunkX(chunkX); + data.setChunkZ(chunkZ); + data.setSubChunksLength(0); + data.setData(TranslatorsInit.EMPTY_LEVEL_CHUNK_DATA); + upstream.sendPacket(data); BiomeDefinitionListPacket biomePacket = new BiomeDefinitionListPacket(); biomePacket.setTag(CompoundTag.EMPTY); upstream.sendPacket(biomePacket); + AvailableEntityIdentifiersPacket entityPacket = new AvailableEntityIdentifiersPacket(); entityPacket.setTag(CompoundTag.EMPTY); upstream.sendPacket(entityPacket); @@ -161,8 +158,6 @@ public class GeyserSession implements Player { PlayStatusPacket playStatusPacket = new PlayStatusPacket(); playStatusPacket.setStatus(PlayStatusPacket.Status.PLAYER_SPAWN); upstream.sendPacket(playStatusPacket); - - connector.getLogger().debug("play status sent"); } public void authenticate(String username) {