Archived
0

one chunk

This commit is contained in:
2018-04-27 22:58:31 +03:00
parent 6f7f2ad813
commit 3350c9aff0
2 changed files with 47 additions and 41 deletions

View File

@@ -66,7 +66,7 @@ public class PacketHandler extends SimpleChannelInboundHandler<CSPacket> {
}
public void onLoginPacket(Channel channel, LoginPacket packet) {
final Location spawnLoc = new Location(0, 65, 0);
final Location spawnLoc = new Location(0, 6, 0);
Player player;
Optional<Player> optPlayer = playerManager.getPlayer(packet.getPlayerName());
@@ -120,41 +120,15 @@ public class PacketHandler extends SimpleChannelInboundHandler<CSPacket> {
chInitPkt.setInitChunk(true);
channel.write(chInitPkt);
for (int x = -17; x <= 17; x++) {
for (int z = -17; z <= 17; z++) {
if (x == 0 && z == 0) continue;
chInitPkt = new ChunkAllocationPacket();
chInitPkt.setX(x);
chInitPkt.setZ(z);
chInitPkt.setInitChunk(true);
channel.write(chInitPkt);
}
}
// send Chunk data
ChunkDataPacket chDataPkt = new ChunkDataPacket();
chDataPkt.setX(0);
chDataPkt.setZ(0);
chDataPkt.setNeedInitChunk(false);
chDataPkt.setYMin(0);
chDataPkt.setNeedInitChunk(true);
chDataPkt.setYMin(1);
chDataPkt.setYMax(0);
channel.write(chDataPkt);
for (int x = -17; x <= 17; x++) {
for (int z = -17; z <= 17; z++) {
if (x == 0 && z == 0) continue;
chDataPkt = new ChunkDataPacket();
chDataPkt.setX(x);
chDataPkt.setZ(z);
chDataPkt.setNeedInitChunk(false);
chDataPkt.setYMin(0);
chDataPkt.setYMax(0);
channel.write(chDataPkt);
}
}
// send Position and look
PositionAndLookPacket posLookPkt = new PositionAndLookPacket();
posLookPkt.setLocation(player.getLocation());