Skip to content

Commit 5118035

Browse files
committed
a
1 parent 7048cab commit 5118035

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

proxy/src/main/java/com/velocitypowered/proxy/protocol/StateRegistry.java

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_20_2;
3737
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_20_3;
3838
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_20_5;
39+
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_21;
3940
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_7_2;
4041
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_8;
4142
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_9;
@@ -52,6 +53,8 @@
5253
import com.velocitypowered.proxy.protocol.packet.BossBarPacket;
5354
import com.velocitypowered.proxy.protocol.packet.BundleDelimiterPacket;
5455
import com.velocitypowered.proxy.protocol.packet.ClientSettingsPacket;
56+
import com.velocitypowered.proxy.protocol.packet.ClientboundCookieRequestPacket;
57+
import com.velocitypowered.proxy.protocol.packet.ClientboundStoreCookiePacket;
5558
import com.velocitypowered.proxy.protocol.packet.DisconnectPacket;
5659
import com.velocitypowered.proxy.protocol.packet.EncryptionRequestPacket;
5760
import com.velocitypowered.proxy.protocol.packet.EncryptionResponsePacket;
@@ -73,6 +76,7 @@
7376
import com.velocitypowered.proxy.protocol.packet.ServerDataPacket;
7477
import com.velocitypowered.proxy.protocol.packet.ServerLoginPacket;
7578
import com.velocitypowered.proxy.protocol.packet.ServerLoginSuccessPacket;
79+
import com.velocitypowered.proxy.protocol.packet.ServerboundCookieResponsePacket;
7680
import com.velocitypowered.proxy.protocol.packet.SetCompressionPacket;
7781
import com.velocitypowered.proxy.protocol.packet.StatusPingPacket;
7882
import com.velocitypowered.proxy.protocol.packet.StatusRequestPacket;
@@ -91,6 +95,8 @@
9195
import com.velocitypowered.proxy.protocol.packet.chat.session.SessionPlayerCommandPacket;
9296
import com.velocitypowered.proxy.protocol.packet.chat.session.UnsignedPlayerCommandPacket;
9397
import com.velocitypowered.proxy.protocol.packet.config.ActiveFeaturesPacket;
98+
import com.velocitypowered.proxy.protocol.packet.config.ClientboundCustomReportDetailsPacket;
99+
import com.velocitypowered.proxy.protocol.packet.config.ClientboundServerLinksPacket;
94100
import com.velocitypowered.proxy.protocol.packet.config.FinishedUpdatePacket;
95101
import com.velocitypowered.proxy.protocol.packet.config.KnownPacksPacket;
96102
import com.velocitypowered.proxy.protocol.packet.config.RegistrySyncPacket;
@@ -213,6 +219,9 @@ public enum StateRegistry {
213219
m.readWrite(0x07, MINECRAFT_1_20_3);
214220
m.readWrite(0x09, MINECRAFT_1_20_5);
215221
});
222+
clientbound(ClientboundStoreCookiePacket.class, ClientboundStoreCookiePacket::new, m -> {
223+
m.readWrite(0x0A, MINECRAFT_1_20_5);
224+
});
216225
clientbound(TransferPacket.class, TransferPacket::new, m -> {
217226
m.readWrite(0x0B, MINECRAFT_1_20_5);
218227
});
@@ -229,6 +238,12 @@ public enum StateRegistry {
229238
clientbound(KnownPacksPacket.class, KnownPacksPacket::new, m -> {
230239
m.readWrite(0x0E, MINECRAFT_1_20_5);
231240
});
241+
clientbound(ClientboundCustomReportDetailsPacket.class, ClientboundCustomReportDetailsPacket::new, m -> {
242+
m.readWrite(0x0F, MINECRAFT_1_21);
243+
});
244+
clientbound(ClientboundServerLinksPacket.class, ClientboundServerLinksPacket::new, m -> {
245+
m.readWrite(0x10, MINECRAFT_1_21);
246+
});
232247
}
233248
},
234249
PLAY {
@@ -292,6 +307,9 @@ public enum StateRegistry {
292307
m.readWrite(0x09, MINECRAFT_1_20_2);
293308
m.readWrite(0x0A, MINECRAFT_1_20_5);
294309
});
310+
serverbound(ServerboundCookieResponsePacket.class, ServerboundCookieResponsePacket::new, m -> {
311+
m.readWrite(0x11, MINECRAFT_1_20_5);
312+
});
295313
serverbound(PluginMessagePacket.class, PluginMessagePacket::new, m -> {
296314
m.readWrite(0x17, MINECRAFT_1_7_2);
297315
m.readWrite(0x09, MINECRAFT_1_9);
@@ -385,6 +403,9 @@ public enum StateRegistry {
385403
m.readWrite(0x10, MINECRAFT_1_19_4);
386404
m.readWrite(0x11, MINECRAFT_1_20_2);
387405
});
406+
clientbound(ClientboundCookieRequestPacket.class, ClientboundCookieRequestPacket::new, m -> {
407+
m.readWrite(0x16, MINECRAFT_1_20_5);
408+
});
388409
clientbound(PluginMessagePacket.class, PluginMessagePacket::new, m -> {
389410
m.readWrite(0x3F, MINECRAFT_1_7_2);
390411
m.readWrite(0x18, MINECRAFT_1_9);
@@ -593,6 +614,9 @@ public enum StateRegistry {
593614
m.readWrite(0x3C, MINECRAFT_1_20_2);
594615
m.readWrite(0x3E, MINECRAFT_1_20_5);
595616
});
617+
clientbound(ClientboundStoreCookiePacket.class, ClientboundStoreCookiePacket::new, m -> {
618+
m.writeOnly(0x6B, MINECRAFT_1_20_5);
619+
});
596620
clientbound(SystemChatPacket.class, SystemChatPacket::new, m -> {
597621
m.writeOnly(0x5F, MINECRAFT_1_19);
598622
m.writeOnly(0x62, MINECRAFT_1_19_1);
@@ -629,6 +653,12 @@ public enum StateRegistry {
629653
clientbound(TransferPacket.class, TransferPacket::new, m -> {
630654
m.readWrite(0x73, MINECRAFT_1_20_5);
631655
});
656+
clientbound(ClientboundCustomReportDetailsPacket.class, ClientboundCustomReportDetailsPacket::new, m -> {
657+
m.readWrite(0x7A, MINECRAFT_1_21);
658+
});
659+
clientbound(ClientboundServerLinksPacket.class, ClientboundServerLinksPacket::new, m -> {
660+
m.readWrite(0x7B, MINECRAFT_1_21);
661+
});
632662
}
633663
},
634664
LOGIN {
@@ -645,6 +675,9 @@ public enum StateRegistry {
645675
serverbound(LoginAcknowledgedPacket.class, LoginAcknowledgedPacket::new, m -> {
646676
m.readWrite(0x03, MINECRAFT_1_20_2);
647677
});
678+
serverbound(ServerboundCookieResponsePacket.class, ServerboundCookieResponsePacket::new, m -> {
679+
m.readWrite(0x04, MINECRAFT_1_20_5);
680+
});
648681

649682
clientbound(DisconnectPacket.class, () -> new DisconnectPacket(this), m -> {
650683
m.readWrite(0x00, MINECRAFT_1_7_2);
@@ -661,6 +694,9 @@ public enum StateRegistry {
661694
clientbound(LoginPluginMessagePacket.class, LoginPluginMessagePacket::new, m -> {
662695
m.readWrite(0x04, MINECRAFT_1_13);
663696
});
697+
clientbound(ClientboundCookieRequestPacket.class, ClientboundCookieRequestPacket::new, m -> {
698+
m.readWrite(0x05, MINECRAFT_1_20_5);
699+
});
664700
}
665701
};
666702

@@ -670,11 +706,11 @@ public enum StateRegistry {
670706
protected final PacketRegistry clientbound = new PacketRegistry(CLIENTBOUND, this);
671707
protected final PacketRegistry serverbound = new PacketRegistry(SERVERBOUND, this);
672708

673-
<P extends MinecraftPacket> void clientbound(Class<P> clazz, Supplier<P> factory, Consumer<PacketMapper> mapper) {
709+
<P extends MinecraftPacket> void clientbound(Class<P> clazz, Supplier<P> factory, Consumer<PacketMapper> mapper) {
674710
this.clientbound.register(clazz, factory, mapper);
675711
}
676712

677-
<P extends MinecraftPacket> void serverbound(Class<P> clazz, Supplier<P> factory, Consumer<PacketMapper> mapper) {
713+
<P extends MinecraftPacket> void serverbound(Class<P> clazz, Supplier<P> factory, Consumer<PacketMapper> mapper) {
678714
this.serverbound.register(clazz, factory, mapper);
679715
}
680716

0 commit comments

Comments
 (0)