Archived
0

refactory world and clean classes

This commit is contained in:
2018-08-16 00:08:26 +03:00
parent 333150dd30
commit dc9e3512e7
24 changed files with 175 additions and 450 deletions

View File

@@ -8,6 +8,7 @@ import mc.core.network.proto_1_12_2.TeleportManager;
import mc.core.network.proto_1_12_2.packets.ChunkDataPacket;
import mc.core.network.proto_1_12_2.packets.PlayerPositionAndLookPacket;
import mc.core.utils.CompactedCoords;
import mc.core.world.chunk.Chunk;
import mc.core.world.chunk.ChunkSection;
@Slf4j
@@ -29,13 +30,13 @@ class PlayerEventListener {
for(Integer compressXZ : event.getNeedLoadChunks()) {
int[] xz = CompactedCoords.uncompressXZ(compressXZ);
ChunkSection chunkSection = event.getPlayer().getLocation().getWorld().getChunk(xz[0], 0, xz[1]);
Chunk chunk = event.getPlayer().getLocation().getWorld().getChunk(xz[0], xz[1]);
ChunkDataPacket packet = new ChunkDataPacket();
packet.setX(xz[0]);
packet.setZ(xz[1]);
packet.setInitChunk(true);
packet.getChunks().add(chunkSection);
packet.setChunk(chunk);
event.getPlayer().getChannel().write(packet);
}

View File

@@ -85,7 +85,7 @@ public class LoginHandler extends AbstractStateHandler implements LoginStateHand
ChunkDataPacket pkt8 = new ChunkDataPacket();
pkt8.setX(0);
pkt8.setZ(0);
pkt8.getChunks().add(world.getChunk(0, 0,0));
pkt8.setChunk(world.getChunk(0, 0));
pkt8.setInitChunk(true);
channel.writeAndFlush(pkt8);
player.getLoadedChunks().add(CompactedCoords.compressXZ(0, 0));