mirror of
https://github.com/Nan1t/NanoLimbo.git
synced 2025-07-15 13:40:14 +02:00
Remove empty chunk packet
This commit is contained in:
parent
7fb11d2ffb
commit
0a98b8257f
@ -154,9 +154,6 @@ public class ClientConnection extends ChannelInboundHandlerAdapter {
|
||||
if (PacketSnapshots.PACKET_HEADER_AND_FOOTER != null)
|
||||
writePacket(PacketSnapshots.PACKET_HEADER_AND_FOOTER);
|
||||
|
||||
if (clientVersion.moreOrEqual(Version.V1_18_2))
|
||||
writePacket(PacketSnapshots.PACKET_EMPTY_CHUNK);
|
||||
|
||||
sendKeepAlive();
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,6 @@ public final class PacketSnapshots {
|
||||
public static PacketSnapshot PACKET_JOIN_MESSAGE;
|
||||
public static PacketSnapshot PACKET_BOSS_BAR;
|
||||
public static PacketSnapshot PACKET_HEADER_AND_FOOTER;
|
||||
public static PacketSnapshot PACKET_EMPTY_CHUNK;
|
||||
|
||||
public static PacketSnapshot PACKET_TITLE_TITLE;
|
||||
public static PacketSnapshot PACKET_TITLE_SUBTITLE;
|
||||
@ -110,8 +109,6 @@ public final class PacketSnapshots {
|
||||
|
||||
PACKET_DECLARE_COMMANDS = PacketSnapshot.of(declareCommands);
|
||||
|
||||
PACKET_EMPTY_CHUNK = PacketSnapshot.of(new PacketEmptyChunk());
|
||||
|
||||
if (server.getConfig().isUseHeaderAndFooter()) {
|
||||
PacketPlayerListHeader header = new PacketPlayerListHeader();
|
||||
header.setHeader(server.getConfig().getPlayerListHeader());
|
||||
|
@ -1,51 +0,0 @@
|
||||
package ru.nanit.limbo.protocol.packets.play;
|
||||
|
||||
import io.netty.buffer.ByteBufOutputStream;
|
||||
import ru.nanit.limbo.protocol.ByteMessage;
|
||||
import ru.nanit.limbo.protocol.PacketOut;
|
||||
import ru.nanit.limbo.protocol.registry.Version;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class PacketEmptyChunk implements PacketOut {
|
||||
|
||||
@Override
|
||||
public void encode(ByteMessage msg, Version version) {
|
||||
msg.writeInt(0);
|
||||
msg.writeInt(0);
|
||||
|
||||
writeHeightmaps(msg, version.getProtocolNumber());
|
||||
|
||||
byte[] sectionData = new byte[]{0, 0, 0, 0, 0, 0, 1, 0};
|
||||
msg.writeVarInt(sectionData.length * 16);
|
||||
for (int i = 0; i < 16; i++) {
|
||||
msg.writeBytes(sectionData);
|
||||
}
|
||||
|
||||
msg.writeVarInt(0);
|
||||
|
||||
byte[] lightData = new byte[]{1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 3, -1, -1, 0, 0};
|
||||
msg.writeBytes(lightData);
|
||||
}
|
||||
|
||||
private void writeHeightmaps(ByteMessage buf, int version) {
|
||||
try (ByteBufOutputStream output = new ByteBufOutputStream(buf)) {
|
||||
output.writeByte(10); //CompoundTag
|
||||
output.writeUTF(""); // CompoundName
|
||||
output.writeByte(10); //CompoundTag
|
||||
output.writeUTF("root"); //root compound
|
||||
output.writeByte(12); //long array
|
||||
output.writeUTF("MOTION_BLOCKING");
|
||||
long[] longArrayTag = new long[version < Version.V1_18.getProtocolNumber() ? 36 : 37];
|
||||
output.writeInt(longArrayTag.length);
|
||||
for (int i = 0, length = longArrayTag.length; i < length; i++) {
|
||||
output.writeLong(longArrayTag[i]);
|
||||
}
|
||||
buf.writeByte(0); //end of compound
|
||||
buf.writeByte(0); //end of compound
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
}
|
@ -202,9 +202,6 @@ public enum State {
|
||||
map(0x5E, V1_17, V1_17_1),
|
||||
map(0x5F, V1_18, V1_18_2)
|
||||
);
|
||||
clientBound.register(PacketEmptyChunk::new,
|
||||
map(0x22, V1_18, V1_18_2)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user