Optimized packet splitting

This commit is contained in:
RaphiMC 2023-12-10 22:48:37 +01:00
parent 7ad946c172
commit 58a1e66ed6
No known key found for this signature in database
GPG Key ID: 0F6BB0657A03AC94
20 changed files with 36 additions and 119 deletions

View File

@ -51,15 +51,10 @@ public enum ServerboundPacketsb1_8 implements ServerboundPacketType, PreNettyPac
HELD_ITEM_CHANGE(16, (user, buf) -> buf.skipBytes(2)),
ANIMATION(18, (user, buf) -> buf.skipBytes(5)),
ENTITY_ACTION(19, (user, buf) -> buf.skipBytes(5)),
POSITION(27, (user, buf) -> {
buf.skipBytes(16);
buf.readBoolean();
buf.readBoolean();
}),
POSITION(27, (user, buf) -> buf.skipBytes(18)),
CLOSE_WINDOW(101, (user, buf) -> buf.skipBytes(1)),
CLICK_WINDOW(102, (user, buf) -> {
buf.skipBytes(6);
buf.readBoolean();
buf.skipBytes(7);
readItemStackb1_2(buf);
}),
WINDOW_CONFIRMATION(106, (user, buf) -> buf.skipBytes(4)),

View File

@ -54,11 +54,7 @@ public enum ServerboundPacketsb1_4 implements ServerboundPacketType, PreNettyPac
HELD_ITEM_CHANGE(16, (user, buf) -> buf.skipBytes(2)),
ANIMATION(18, (user, buf) -> buf.skipBytes(5)),
ENTITY_ACTION(19, (user, buf) -> buf.skipBytes(5)),
POSITION(27, (user, buf) -> {
buf.skipBytes(16);
buf.readBoolean();
buf.readBoolean();
}),
POSITION(27, (user, buf) -> buf.skipBytes(18)),
CLOSE_WINDOW(101, (user, buf) -> buf.skipBytes(1)),
CLICK_WINDOW(102, (user, buf) -> {
buf.skipBytes(6);

View File

@ -53,15 +53,10 @@ public enum ServerboundPacketsb1_5 implements ServerboundPacketType, PreNettyPac
HELD_ITEM_CHANGE(16, (user, buf) -> buf.skipBytes(2)),
ANIMATION(18, (user, buf) -> buf.skipBytes(5)),
ENTITY_ACTION(19, (user, buf) -> buf.skipBytes(5)),
POSITION(27, (user, buf) -> {
buf.skipBytes(16);
buf.readBoolean();
buf.readBoolean();
}),
POSITION(27, (user, buf) -> buf.skipBytes(18)),
CLOSE_WINDOW(101, (user, buf) -> buf.skipBytes(1)),
CLICK_WINDOW(102, (user, buf) -> {
buf.skipBytes(6);
buf.readBoolean();
buf.skipBytes(7);
readItemStackb1_2(buf);
}),
WINDOW_CONFIRMATION(106, (user, buf) -> buf.skipBytes(4)),

View File

@ -52,15 +52,10 @@ public enum ServerboundPacketsb1_7 implements ServerboundPacketType, PreNettyPac
HELD_ITEM_CHANGE(16, (user, buf) -> buf.skipBytes(2)),
ANIMATION(18, (user, buf) -> buf.skipBytes(5)),
ENTITY_ACTION(19, (user, buf) -> buf.skipBytes(5)),
POSITION(27, (user, buf) -> {
buf.skipBytes(16);
buf.readBoolean();
buf.readBoolean();
}),
POSITION(27, (user, buf) -> buf.skipBytes(18)),
CLOSE_WINDOW(101, (user, buf) -> buf.skipBytes(1)),
CLICK_WINDOW(102, (user, buf) -> {
buf.skipBytes(6);
buf.readBoolean();
buf.skipBytes(7);
readItemStackb1_2(buf);
}),
WINDOW_CONFIRMATION(106, (user, buf) -> buf.skipBytes(4)),

View File

@ -51,15 +51,10 @@ public enum ServerboundPackets1_0 implements ServerboundPacketType, PreNettyPack
HELD_ITEM_CHANGE(16, (user, buf) -> buf.skipBytes(2)),
ANIMATION(18, (user, buf) -> buf.skipBytes(5)),
ENTITY_ACTION(19, (user, buf) -> buf.skipBytes(5)),
POSITION(27, (user, buf) -> {
buf.skipBytes(16);
buf.readBoolean();
buf.readBoolean();
}),
POSITION(27, (user, buf) -> buf.skipBytes(18)),
CLOSE_WINDOW(101, (user, buf) -> buf.skipBytes(1)),
CLICK_WINDOW(102, (user, buf) -> {
buf.skipBytes(6);
buf.readBoolean();
buf.skipBytes(7);
readItemStack1_0(buf);
}),
WINDOW_CONFIRMATION(106, (user, buf) -> buf.skipBytes(4)),

View File

@ -58,8 +58,7 @@ public enum ServerboundPackets1_1 implements ServerboundPacketType, PreNettyPack
ENTITY_ACTION(19, (user, buf) -> buf.skipBytes(5)),
CLOSE_WINDOW(101, (user, buf) -> buf.skipBytes(1)),
CLICK_WINDOW(102, (user, buf) -> {
buf.skipBytes(6);
buf.readBoolean();
buf.skipBytes(7);
readItemStack1_0(buf);
}),
WINDOW_CONFIRMATION(106, (user, buf) -> buf.skipBytes(4)),

View File

@ -94,9 +94,7 @@ public enum ClientboundPackets1_2_1 implements ClientboundPacketType, PreNettyPa
SET_EXPERIENCE(43, (user, buf) -> buf.skipBytes(8)),
PRE_CHUNK(50, (user, buf) -> buf.skipBytes(9)),
CHUNK_DATA(51, (user, buf) -> {
buf.skipBytes(8);
buf.readBoolean();
buf.skipBytes(4);
buf.skipBytes(13);
int x = buf.readInt();
buf.skipBytes(4);
for (int i = 0; i < x; i++) buf.readByte();

View File

@ -57,8 +57,7 @@ public enum ServerboundPackets1_2_1 implements ServerboundPacketType, PreNettyPa
ENTITY_ACTION(19, (user, buf) -> buf.skipBytes(5)),
CLOSE_WINDOW(101, (user, buf) -> buf.skipBytes(1)),
CLICK_WINDOW(102, (user, buf) -> {
buf.skipBytes(6);
buf.readBoolean();
buf.skipBytes(7);
readItemStack1_0(buf);
}),
WINDOW_CONFIRMATION(106, (user, buf) -> buf.skipBytes(4)),

View File

@ -94,9 +94,7 @@ public enum ClientboundPackets1_2_4 implements ClientboundPacketType, PreNettyPa
SET_EXPERIENCE(43, (user, buf) -> buf.skipBytes(8)),
PRE_CHUNK(50, (user, buf) -> buf.skipBytes(9)),
CHUNK_DATA(51, (user, buf) -> {
buf.skipBytes(8);
buf.readBoolean();
buf.skipBytes(4);
buf.skipBytes(13);
int x = buf.readInt();
buf.skipBytes(4);
for (int i = 0; i < x; i++) buf.readByte();
@ -157,12 +155,7 @@ public enum ClientboundPackets1_2_4 implements ClientboundPacketType, PreNettyPa
readString(buf);
buf.skipBytes(3);
}),
PLAYER_ABILITIES(202, (user, buf) -> {
buf.readBoolean();
buf.readBoolean();
buf.readBoolean();
buf.readBoolean();
}),
PLAYER_ABILITIES(202, (user, buf) -> buf.skipBytes(4)),
PLUGIN_MESSAGE(250, (user, buf) -> {
readString(buf);
short s = buf.readShort();

View File

@ -57,8 +57,7 @@ public enum ServerboundPackets1_2_4 implements ServerboundPacketType, PreNettyPa
ENTITY_ACTION(19, (user, buf) -> buf.skipBytes(5)),
CLOSE_WINDOW(101, (user, buf) -> buf.skipBytes(1)),
CLICK_WINDOW(102, (user, buf) -> {
buf.skipBytes(6);
buf.readBoolean();
buf.skipBytes(7);
readItemStack1_0(buf);
}),
WINDOW_CONFIRMATION(106, (user, buf) -> buf.skipBytes(4)),
@ -74,12 +73,7 @@ public enum ServerboundPackets1_2_4 implements ServerboundPacketType, PreNettyPa
readString(buf);
readString(buf);
}),
PLAYER_ABILITIES(202, (user, buf) -> {
buf.readBoolean();
buf.readBoolean();
buf.readBoolean();
buf.readBoolean();
}),
PLAYER_ABILITIES(202, (user, buf) -> buf.skipBytes(4)),
PLUGIN_MESSAGE(250, (user, buf) -> {
readString(buf);
short s = buf.readShort();

View File

@ -98,9 +98,7 @@ public enum ClientboundPackets1_3_1 implements ClientboundPacketType, PreNettyPa
REMOVE_ENTITY_EFFECT(42, (user, buf) -> buf.skipBytes(5)),
SET_EXPERIENCE(43, (user, buf) -> buf.skipBytes(8)),
CHUNK_DATA(51, (user, buf) -> {
buf.skipBytes(8);
buf.readBoolean();
buf.skipBytes(4);
buf.skipBytes(13);
int x = buf.readInt();
for (int i = 0; i < x; i++) buf.readByte();
}),

View File

@ -61,8 +61,7 @@ public enum ServerboundPackets1_3_1 implements ServerboundPacketType, PreNettyPa
ENTITY_ACTION(19, (user, buf) -> buf.skipBytes(5)),
CLOSE_WINDOW(101, (user, buf) -> buf.skipBytes(1)),
CLICK_WINDOW(102, (user, buf) -> {
buf.skipBytes(6);
buf.readBoolean();
buf.skipBytes(7);
readItemStack1_3_1(buf);
}),
WINDOW_CONFIRMATION(106, (user, buf) -> buf.skipBytes(4)),

View File

@ -102,9 +102,7 @@ public enum ClientboundPackets1_4_2 implements ClientboundPacketType, PreNettyPa
REMOVE_ENTITY_EFFECT(42, (user, buf) -> buf.skipBytes(5)),
SET_EXPERIENCE(43, (user, buf) -> buf.skipBytes(8)),
CHUNK_DATA(51, (user, buf) -> {
buf.skipBytes(8);
buf.readBoolean();
buf.skipBytes(4);
buf.skipBytes(13);
int x = buf.readInt();
for (int i = 0; i < x; i++) buf.readByte();
}),
@ -132,10 +130,7 @@ public enum ClientboundPackets1_4_2 implements ClientboundPacketType, PreNettyPa
}
buf.skipBytes(12);
}),
EFFECT(61, (user, buf) -> {
buf.skipBytes(17);
buf.readBoolean();
}),
EFFECT(61, (user, buf) -> buf.skipBytes(18)),
NAMED_SOUND(62, (user, buf) -> {
readString(buf);
buf.skipBytes(17);

View File

@ -101,9 +101,7 @@ public enum ClientboundPackets1_4_4 implements ClientboundPacketType, PreNettyPa
REMOVE_ENTITY_EFFECT(42, (user, buf) -> buf.skipBytes(5)),
SET_EXPERIENCE(43, (user, buf) -> buf.skipBytes(8)),
CHUNK_DATA(51, (user, buf) -> {
buf.skipBytes(8);
buf.readBoolean();
buf.skipBytes(4);
buf.skipBytes(13);
int x = buf.readInt();
for (int i = 0; i < x; i++) buf.readByte();
}),
@ -131,10 +129,7 @@ public enum ClientboundPackets1_4_4 implements ClientboundPacketType, PreNettyPa
}
buf.skipBytes(12);
}),
EFFECT(61, (user, buf) -> {
buf.skipBytes(17);
buf.readBoolean();
}),
EFFECT(61, (user, buf) -> buf.skipBytes(18)),
NAMED_SOUND(62, (user, buf) -> {
PreNettyTypes.readString(buf);
buf.skipBytes(17);

View File

@ -97,9 +97,7 @@ public enum ClientboundPackets1_4_6 implements ClientboundPacketType, PreNettyPa
REMOVE_ENTITY_EFFECT(42, (user, buf) -> buf.skipBytes(5)),
SET_EXPERIENCE(43, (user, buf) -> buf.skipBytes(8)),
CHUNK_DATA(51, (user, buf) -> {
buf.skipBytes(8);
buf.readBoolean();
buf.skipBytes(4);
buf.skipBytes(13);
int x = buf.readInt();
for (int i = 0; i < x; i++) buf.readByte();
}),
@ -128,10 +126,7 @@ public enum ClientboundPackets1_4_6 implements ClientboundPacketType, PreNettyPa
}
buf.skipBytes(12);
}),
EFFECT(61, (user, buf) -> {
buf.skipBytes(17);
buf.readBoolean();
}),
EFFECT(61, (user, buf) -> buf.skipBytes(18)),
NAMED_SOUND(62, (user, buf) -> {
PreNettyTypes.readString(buf);
buf.skipBytes(17);

View File

@ -98,9 +98,7 @@ public enum ClientboundPackets1_5_2 implements ClientboundPacketType, PreNettyPa
REMOVE_ENTITY_EFFECT(42, (user, buf) -> buf.skipBytes(5)),
SET_EXPERIENCE(43, (user, buf) -> buf.skipBytes(8)),
CHUNK_DATA(51, (user, buf) -> {
buf.skipBytes(8);
buf.readBoolean();
buf.skipBytes(4);
buf.skipBytes(13);
int x = buf.readInt();
for (int i = 0; i < x; i++) buf.readByte();
}),
@ -129,10 +127,7 @@ public enum ClientboundPackets1_5_2 implements ClientboundPacketType, PreNettyPa
}
buf.skipBytes(12);
}),
EFFECT(61, (user, buf) -> {
buf.skipBytes(17);
buf.readBoolean();
}),
EFFECT(61, (user, buf) -> buf.skipBytes(18)),
NAMED_SOUND(62, (user, buf) -> {
readString(buf);
buf.skipBytes(17);
@ -146,8 +141,7 @@ public enum ClientboundPackets1_5_2 implements ClientboundPacketType, PreNettyPa
OPEN_WINDOW(100, (user, buf) -> {
buf.skipBytes(2);
readString(buf);
buf.skipBytes(1);
buf.readBoolean();
buf.skipBytes(2);
}),
CLOSE_WINDOW(101, (user, buf) -> buf.skipBytes(1)),
SET_SLOT(103, (user, buf) -> {

View File

@ -81,8 +81,7 @@ public enum ServerboundPackets1_5_2 implements ServerboundPacketType, PreNettyPa
TAB_COMPLETE(203, (user, buf) -> readString(buf)),
CLIENT_SETTINGS(204, (user, buf) -> {
readString(buf);
buf.skipBytes(3);
buf.readBoolean();
buf.skipBytes(4);
}),
CLIENT_STATUS(205, (user, buf) -> buf.skipBytes(1)),
PLUGIN_MESSAGE(250, (user, buf) -> {

View File

@ -106,9 +106,7 @@ public enum ClientboundPackets1_6_1 implements ClientboundPacketType, PreNettyPa
}
}),
CHUNK_DATA(51, (user, buf) -> {
buf.skipBytes(8);
buf.readBoolean();
buf.skipBytes(4);
buf.skipBytes(13);
int x = buf.readInt();
for (int i = 0; i < x; i++) buf.readByte();
}),
@ -137,10 +135,7 @@ public enum ClientboundPackets1_6_1 implements ClientboundPacketType, PreNettyPa
}
buf.skipBytes(12);
}),
EFFECT(61, (user, buf) -> {
buf.skipBytes(17);
buf.readBoolean();
}),
EFFECT(61, (user, buf) -> buf.skipBytes(18)),
NAMED_SOUND(62, (user, buf) -> {
readString(buf);
buf.skipBytes(17);
@ -155,8 +150,7 @@ public enum ClientboundPackets1_6_1 implements ClientboundPacketType, PreNettyPa
buf.skipBytes(1);
int x = buf.readByte();
readString(buf);
buf.skipBytes(1);
buf.readBoolean();
buf.skipBytes(2);
if (x == 11) buf.readInt();
}),
CLOSE_WINDOW(101, (user, buf) -> buf.skipBytes(1)),

View File

@ -110,9 +110,7 @@ public enum ClientboundPackets1_6_4 implements ClientboundPacketType, PreNettyPa
}
}),
CHUNK_DATA(51, (user, buf) -> {
buf.skipBytes(8);
buf.readBoolean();
buf.skipBytes(4);
buf.skipBytes(13);
int x = buf.readInt();
for (int i = 0; i < x; i++) buf.readByte();
}),
@ -141,10 +139,7 @@ public enum ClientboundPackets1_6_4 implements ClientboundPacketType, PreNettyPa
}
buf.skipBytes(12);
}),
EFFECT(61, (user, buf) -> {
buf.skipBytes(17);
buf.readBoolean();
}),
EFFECT(61, (user, buf) -> buf.skipBytes(18)),
NAMED_SOUND(62, (user, buf) -> {
readString(buf);
buf.skipBytes(17);
@ -159,8 +154,7 @@ public enum ClientboundPackets1_6_4 implements ClientboundPacketType, PreNettyPa
buf.skipBytes(1);
int x = buf.readByte();
readString(buf);
buf.skipBytes(1);
buf.readBoolean();
buf.skipBytes(2);
if (x == 11) buf.readInt();
}),
CLOSE_WINDOW(101, (user, buf) -> buf.skipBytes(1)),

View File

@ -59,11 +59,7 @@ public enum ServerboundPackets1_6_4 implements ServerboundPacketType, PreNettyPa
HELD_ITEM_CHANGE(16, (user, buf) -> buf.skipBytes(2)),
ANIMATION(18, (user, buf) -> buf.skipBytes(5)),
ENTITY_ACTION(19, (user, buf) -> buf.skipBytes(9)),
STEER_VEHICLE(27, (user, buf) -> {
buf.skipBytes(8);
buf.readBoolean();
buf.readBoolean();
}),
STEER_VEHICLE(27, (user, buf) -> buf.skipBytes(10)),
CLOSE_WINDOW(101, (user, buf) -> buf.skipBytes(1)),
CLICK_WINDOW(102, (user, buf) -> {
buf.skipBytes(7);
@ -86,8 +82,7 @@ public enum ServerboundPackets1_6_4 implements ServerboundPacketType, PreNettyPa
TAB_COMPLETE(203, (user, buf) -> readString(buf)),
CLIENT_SETTINGS(204, (user, buf) -> {
readString(buf);
buf.skipBytes(3);
buf.readBoolean();
buf.skipBytes(4);
}),
CLIENT_STATUS(205, (user, buf) -> buf.skipBytes(1)),
PLUGIN_MESSAGE(250, (user, buf) -> {