Skip to content

Commit

Permalink
Optimized packet splitting
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphiMC committed Dec 10, 2023
1 parent 7ad946c commit 58a1e66
Show file tree
Hide file tree
Showing 20 changed files with 36 additions and 119 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}),
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}),
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}),
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}),
Expand Down Expand Up @@ -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);
Expand All @@ -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) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}),
Expand Down Expand Up @@ -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);
Expand All @@ -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)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}),
Expand Down Expand Up @@ -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);
Expand All @@ -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)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) -> {
Expand Down

0 comments on commit 58a1e66

Please sign in to comment.