Skip to content

Commit b9f7aaa

Browse files
authored
Merge pull request #16 from PaperMC/dev/3.0.0
[pull] main from PaperMC:dev/3.0.0
2 parents b4f11ac + d2cd791 commit b9f7aaa

File tree

9 files changed

+102
-55
lines changed

9 files changed

+102
-55
lines changed

api/src/main/java/com/velocitypowered/api/network/ProtocolVersion.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ public boolean isSupported() {
8989
MINECRAFT_1_20_5(766, "1.20.5", "1.20.6"),
9090
MINECRAFT_1_21(767, "1.21", "1.21.1"),
9191
MINECRAFT_1_21_2(768, "1.21.2", "1.21.3"),
92-
MINECRAFT_1_21_4(769, "1.21.4");
92+
MINECRAFT_1_21_4(769, "1.21.4"),
93+
MINECRAFT_1_21_5(770, /*1073742067,*/ "1.21.5");
9394

9495
private static final int SNAPSHOT_BIT = 30;
9596

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

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_21;
4040
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_21_2;
4141
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_21_4;
42+
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_21_5;
4243
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_7_2;
4344
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_8;
4445
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_9;
@@ -376,7 +377,8 @@ public enum StateRegistry {
376377
map(0x0D, MINECRAFT_1_17, false),
377378
map(0x0A, MINECRAFT_1_19, false),
378379
map(0x0B, MINECRAFT_1_19_4, false),
379-
map(0x0A, MINECRAFT_1_20_2, false));
380+
map(0x0A, MINECRAFT_1_20_2, false),
381+
map(0x09, MINECRAFT_1_21_5, false));
380382
clientbound.register(
381383
LegacyChatPacket.class,
382384
LegacyChatPacket::new,
@@ -397,7 +399,8 @@ public enum StateRegistry {
397399
map(0x0E, MINECRAFT_1_19, false),
398400
map(0x0D, MINECRAFT_1_19_3, false),
399401
map(0x0F, MINECRAFT_1_19_4, false),
400-
map(0x10, MINECRAFT_1_20_2, false));
402+
map(0x10, MINECRAFT_1_20_2, false),
403+
map(0x0F, MINECRAFT_1_21_5, false));
401404
clientbound.register(
402405
AvailableCommandsPacket.class,
403406
AvailableCommandsPacket::new,
@@ -409,10 +412,12 @@ public enum StateRegistry {
409412
map(0x0F, MINECRAFT_1_19, false),
410413
map(0x0E, MINECRAFT_1_19_3, false),
411414
map(0x10, MINECRAFT_1_19_4, false),
412-
map(0x11, MINECRAFT_1_20_2, false));
415+
map(0x11, MINECRAFT_1_20_2, false),
416+
map(0x10, MINECRAFT_1_21_5, false));
413417
clientbound.register(
414418
ClientboundCookieRequestPacket.class, ClientboundCookieRequestPacket::new,
415-
map(0x16, MINECRAFT_1_20_5, false));
419+
map(0x16, MINECRAFT_1_20_5, false),
420+
map(0x15, MINECRAFT_1_21_5, false));
416421
clientbound.register(
417422
PluginMessagePacket.class,
418423
PluginMessagePacket::new,
@@ -429,7 +434,8 @@ public enum StateRegistry {
429434
map(0x15, MINECRAFT_1_19_3, false),
430435
map(0x17, MINECRAFT_1_19_4, false),
431436
map(0x18, MINECRAFT_1_20_2, false),
432-
map(0x19, MINECRAFT_1_20_5, false));
437+
map(0x19, MINECRAFT_1_20_5, false),
438+
map(0x18, MINECRAFT_1_21_5, false));
433439
clientbound.register(
434440
DisconnectPacket.class,
435441
() -> new DisconnectPacket(this),
@@ -446,7 +452,8 @@ public enum StateRegistry {
446452
map(0x17, MINECRAFT_1_19_3, false),
447453
map(0x1A, MINECRAFT_1_19_4, false),
448454
map(0x1B, MINECRAFT_1_20_2, false),
449-
map(0x1D, MINECRAFT_1_20_5, false));
455+
map(0x1D, MINECRAFT_1_20_5, false),
456+
map(0x1C, MINECRAFT_1_21_5, false));
450457
clientbound.register(
451458
KeepAlivePacket.class,
452459
KeepAlivePacket::new,
@@ -464,7 +471,8 @@ public enum StateRegistry {
464471
map(0x23, MINECRAFT_1_19_4, false),
465472
map(0x24, MINECRAFT_1_20_2, false),
466473
map(0x26, MINECRAFT_1_20_5, false),
467-
map(0x27, MINECRAFT_1_21_2, false));
474+
map(0x27, MINECRAFT_1_21_2, false),
475+
map(0x26, MINECRAFT_1_21_5, false));
468476
clientbound.register(
469477
JoinGamePacket.class,
470478
JoinGamePacket::new,
@@ -482,7 +490,8 @@ public enum StateRegistry {
482490
map(0x28, MINECRAFT_1_19_4, false),
483491
map(0x29, MINECRAFT_1_20_2, false),
484492
map(0x2B, MINECRAFT_1_20_5, false),
485-
map(0x2C, MINECRAFT_1_21_2, false));
493+
map(0x2C, MINECRAFT_1_21_2, false),
494+
map(0x2B, MINECRAFT_1_21_5, false));
486495
clientbound.register(
487496
RespawnPacket.class,
488497
RespawnPacket::new,
@@ -503,13 +512,15 @@ public enum StateRegistry {
503512
map(0x43, MINECRAFT_1_20_2, true),
504513
map(0x45, MINECRAFT_1_20_3, true),
505514
map(0x47, MINECRAFT_1_20_5, true),
506-
map(0x4C, MINECRAFT_1_21_2, true));
515+
map(0x4C, MINECRAFT_1_21_2, true),
516+
map(0x4B, MINECRAFT_1_21_5, true));
507517
clientbound.register(
508518
RemoveResourcePackPacket.class,
509519
RemoveResourcePackPacket::new,
510520
map(0x43, MINECRAFT_1_20_3, false),
511521
map(0x45, MINECRAFT_1_20_5, false),
512-
map(0x4A, MINECRAFT_1_21_2, false));
522+
map(0x4A, MINECRAFT_1_21_2, false),
523+
map(0x49, MINECRAFT_1_21_5, false));
513524
clientbound.register(
514525
ResourcePackRequestPacket.class,
515526
ResourcePackRequestPacket::new,
@@ -530,7 +541,8 @@ public enum StateRegistry {
530541
map(0x42, MINECRAFT_1_20_2, false),
531542
map(0x44, MINECRAFT_1_20_3, false),
532543
map(0x46, MINECRAFT_1_20_5, false),
533-
map(0x4B, MINECRAFT_1_21_2, false));
544+
map(0x4B, MINECRAFT_1_21_2, false),
545+
map(0x4A, MINECRAFT_1_21_5, false));
534546
clientbound.register(
535547
HeaderAndFooterPacket.class,
536548
HeaderAndFooterPacket::new,
@@ -552,7 +564,8 @@ public enum StateRegistry {
552564
map(0x68, MINECRAFT_1_20_2, true),
553565
map(0x6A, MINECRAFT_1_20_3, true),
554566
map(0x6D, MINECRAFT_1_20_5, true),
555-
map(0x74, MINECRAFT_1_21_2, true));
567+
map(0x74, MINECRAFT_1_21_2, true),
568+
map(0x73, MINECRAFT_1_21_5, true));
556569
clientbound.register(
557570
LegacyTitlePacket.class,
558571
LegacyTitlePacket::new,
@@ -573,7 +586,8 @@ public enum StateRegistry {
573586
map(0x5F, MINECRAFT_1_20_2, true),
574587
map(0x61, MINECRAFT_1_20_3, true),
575588
map(0x63, MINECRAFT_1_20_5, true),
576-
map(0x6A, MINECRAFT_1_21_2, true));
589+
map(0x6A, MINECRAFT_1_21_2, true),
590+
map(0x69, MINECRAFT_1_21_5, true));
577591
clientbound.register(
578592
TitleTextPacket.class,
579593
TitleTextPacket::new,
@@ -585,7 +599,8 @@ public enum StateRegistry {
585599
map(0x61, MINECRAFT_1_20_2, true),
586600
map(0x63, MINECRAFT_1_20_3, true),
587601
map(0x65, MINECRAFT_1_20_5, true),
588-
map(0x6C, MINECRAFT_1_21_2, true));
602+
map(0x6C, MINECRAFT_1_21_2, true),
603+
map(0x6B, MINECRAFT_1_21_5, true));
589604
clientbound.register(
590605
TitleActionbarPacket.class,
591606
TitleActionbarPacket::new,
@@ -597,7 +612,8 @@ public enum StateRegistry {
597612
map(0x48, MINECRAFT_1_20_2, true),
598613
map(0x4A, MINECRAFT_1_20_3, true),
599614
map(0x4C, MINECRAFT_1_20_5, true),
600-
map(0x51, MINECRAFT_1_21_2, true));
615+
map(0x51, MINECRAFT_1_21_2, true),
616+
map(0x50, MINECRAFT_1_21_5, true));
601617
clientbound.register(
602618
TitleTimesPacket.class,
603619
TitleTimesPacket::new,
@@ -609,15 +625,17 @@ public enum StateRegistry {
609625
map(0x62, MINECRAFT_1_20_2, true),
610626
map(0x64, MINECRAFT_1_20_3, true),
611627
map(0x66, MINECRAFT_1_20_5, true),
612-
map(0x6D, MINECRAFT_1_21_2, true));
628+
map(0x6D, MINECRAFT_1_21_2, true),
629+
map(0x6C, MINECRAFT_1_21_5, true));
613630
clientbound.register(
614631
TitleClearPacket.class,
615632
TitleClearPacket::new,
616633
map(0x10, MINECRAFT_1_17, true),
617634
map(0x0D, MINECRAFT_1_19, true),
618635
map(0x0C, MINECRAFT_1_19_3, true),
619636
map(0x0E, MINECRAFT_1_19_4, true),
620-
map(0x0F, MINECRAFT_1_20_2, true));
637+
map(0x0F, MINECRAFT_1_20_2, true),
638+
map(0x0E, MINECRAFT_1_21_5, true));
621639
clientbound.register(
622640
LegacyPlayerListItemPacket.class,
623641
LegacyPlayerListItemPacket::new,
@@ -637,19 +655,22 @@ public enum StateRegistry {
637655
map(0x39, MINECRAFT_1_19_4, false),
638656
map(0x3B, MINECRAFT_1_20_2, false),
639657
map(0x3D, MINECRAFT_1_20_5, false),
640-
map(0x3F, MINECRAFT_1_21_2, false));
658+
map(0x3F, MINECRAFT_1_21_2, false),
659+
map(0x3E, MINECRAFT_1_21_5, false));
641660
clientbound.register(
642661
UpsertPlayerInfoPacket.class,
643662
UpsertPlayerInfoPacket::new,
644663
map(0x36, MINECRAFT_1_19_3, false),
645664
map(0x3A, MINECRAFT_1_19_4, false),
646665
map(0x3C, MINECRAFT_1_20_2, false),
647666
map(0x3E, MINECRAFT_1_20_5, false),
648-
map(0x40, MINECRAFT_1_21_2, false));
667+
map(0x40, MINECRAFT_1_21_2, false),
668+
map(0x3F, MINECRAFT_1_21_5, false));
649669
clientbound.register(
650670
ClientboundStoreCookiePacket.class, ClientboundStoreCookiePacket::new,
651671
map(0x6B, MINECRAFT_1_20_5, false),
652-
map(0x72, MINECRAFT_1_21_2, false));
672+
map(0x72, MINECRAFT_1_21_2, false),
673+
map(0x71, MINECRAFT_1_21_5, false));
653674
clientbound.register(
654675
SystemChatPacket.class,
655676
SystemChatPacket::new,
@@ -660,15 +681,17 @@ public enum StateRegistry {
660681
map(0x67, MINECRAFT_1_20_2, true),
661682
map(0x69, MINECRAFT_1_20_3, true),
662683
map(0x6C, MINECRAFT_1_20_5, true),
663-
map(0x73, MINECRAFT_1_21_2, true));
684+
map(0x73, MINECRAFT_1_21_2, true),
685+
map(0x72, MINECRAFT_1_21_5, true));
664686
clientbound.register(
665687
PlayerChatCompletionPacket.class,
666688
PlayerChatCompletionPacket::new,
667689
map(0x15, MINECRAFT_1_19_1, true),
668690
map(0x14, MINECRAFT_1_19_3, true),
669691
map(0x16, MINECRAFT_1_19_4, true),
670692
map(0x17, MINECRAFT_1_20_2, true),
671-
map(0x18, MINECRAFT_1_20_5, true));
693+
map(0x18, MINECRAFT_1_20_5, true),
694+
map(0x17, MINECRAFT_1_21_5, true));
672695
clientbound.register(
673696
ServerDataPacket.class,
674697
ServerDataPacket::new,
@@ -679,14 +702,16 @@ public enum StateRegistry {
679702
map(0x47, MINECRAFT_1_20_2, false),
680703
map(0x49, MINECRAFT_1_20_3, false),
681704
map(0x4B, MINECRAFT_1_20_5, false),
682-
map(0x50, MINECRAFT_1_21_2, false));
705+
map(0x50, MINECRAFT_1_21_2, false),
706+
map(0x4F, MINECRAFT_1_21_5, false));
683707
clientbound.register(
684708
StartUpdatePacket.class,
685709
() -> StartUpdatePacket.INSTANCE,
686710
map(0x65, MINECRAFT_1_20_2, false),
687711
map(0x67, MINECRAFT_1_20_3, false),
688712
map(0x69, MINECRAFT_1_20_5, false),
689-
map(0x70, MINECRAFT_1_21_2, false));
713+
map(0x70, MINECRAFT_1_21_2, false),
714+
map(0x6F, MINECRAFT_1_21_5, false));
690715
clientbound.register(
691716
BundleDelimiterPacket.class,
692717
() -> BundleDelimiterPacket.INSTANCE,

proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentIdentifier.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ private ArgumentIdentifier(String identifier, VersionSet... versions) {
5858
this.versionById = ImmutableMap.copyOf(temp);
5959
}
6060

61+
@Override
62+
public String toString() {
63+
return "ArgumentIdentifier{" +
64+
"identifier='" + identifier + '\'' +
65+
'}';
66+
}
67+
6168
public String getIdentifier() {
6269
return identifier;
6370
}

proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentPropertyRegistry.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_19_4;
2323
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_20_3;
2424
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_20_5;
25+
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_21_5;
2526
import static com.velocitypowered.proxy.protocol.packet.brigadier.ArgumentIdentifier.id;
2627
import static com.velocitypowered.proxy.protocol.packet.brigadier.ArgumentIdentifier.mapSet;
2728
import static com.velocitypowered.proxy.protocol.packet.brigadier.DoubleArgumentPropertySerializer.DOUBLE;
@@ -254,17 +255,20 @@ public void serialize(BoolArgumentType object, ByteBuf buf,
254255
register(id("minecraft:resource_key", mapSet(MINECRAFT_1_20_5, 46), mapSet(MINECRAFT_1_20_3, 45), mapSet(MINECRAFT_1_19_3, 44)),
255256
RegistryKeyArgumentList.ResourceKey.class,
256257
RegistryKeyArgumentList.ResourceKey.Serializer.REGISTRY);
258+
register(id("minecraft:resource_selector", mapSet(MINECRAFT_1_21_5, 47)),
259+
RegistryKeyArgumentList.ResourceSelector.class,
260+
RegistryKeyArgumentList.ResourceSelector.Serializer.REGISTRY);
257261

258-
empty(id("minecraft:template_mirror", mapSet(MINECRAFT_1_20_5, 47), mapSet(MINECRAFT_1_20_3, 46), mapSet(MINECRAFT_1_19, 45))); // 1.19
259-
empty(id("minecraft:template_rotation", mapSet(MINECRAFT_1_20_5, 48), mapSet(MINECRAFT_1_20_3, 47), mapSet(MINECRAFT_1_19, 46))); // 1.19
260-
empty(id("minecraft:heightmap", mapSet(MINECRAFT_1_20_3, 49), mapSet(MINECRAFT_1_19_4, 47))); // 1.19.4
262+
empty(id("minecraft:template_mirror", mapSet(MINECRAFT_1_21_5, 48), mapSet(MINECRAFT_1_20_5, 47), mapSet(MINECRAFT_1_20_3, 46), mapSet(MINECRAFT_1_19, 45))); // 1.19
263+
empty(id("minecraft:template_rotation", mapSet(MINECRAFT_1_21_5, 49), mapSet(MINECRAFT_1_20_5, 48), mapSet(MINECRAFT_1_20_3, 47), mapSet(MINECRAFT_1_19, 46))); // 1.19
264+
empty(id("minecraft:heightmap", mapSet(MINECRAFT_1_21_5, 50), mapSet(MINECRAFT_1_20_3, 49), mapSet(MINECRAFT_1_19_4, 47))); // 1.19.4
261265

262-
empty(id("minecraft:uuid", mapSet(MINECRAFT_1_20_5, 53), mapSet(MINECRAFT_1_20_3, 48), mapSet(MINECRAFT_1_19_4, 48),
266+
empty(id("minecraft:uuid", mapSet(MINECRAFT_1_21_5, 54),mapSet(MINECRAFT_1_20_5, 53), mapSet(MINECRAFT_1_20_3, 48), mapSet(MINECRAFT_1_19_4, 48),
263267
mapSet(MINECRAFT_1_19, 47))); // added in 1.16
264268

265-
empty(id("minecraft:loot_table", mapSet(MINECRAFT_1_20_5, 50)));
266-
empty(id("minecraft:loot_predicate", mapSet(MINECRAFT_1_20_5, 51)));
267-
empty(id("minecraft:loot_modifier", mapSet(MINECRAFT_1_20_5, 52)));
269+
empty(id("minecraft:loot_table", mapSet(MINECRAFT_1_21_5, 51), mapSet(MINECRAFT_1_20_5, 50)));
270+
empty(id("minecraft:loot_predicate", mapSet(MINECRAFT_1_21_5, 52), mapSet(MINECRAFT_1_20_5, 51)));
271+
empty(id("minecraft:loot_modifier", mapSet(MINECRAFT_1_21_5, 53), mapSet(MINECRAFT_1_20_5, 52)));
268272

269273
// Crossstitch support
270274
register(id("crossstitch:mod_argument", mapSet(MINECRAFT_1_19, -256)), ModArgumentProperty.class, MOD);

proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/RegistryKeyArgumentList.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,23 @@ public void serialize(ResourceOrTagKey object, ByteBuf buf, ProtocolVersion prot
6767
}
6868
}
6969

70-
public static class Resource extends RegistryKeyArgument {
70+
public static class ResourceSelector extends RegistryKeyArgument {
7171

72-
public Resource(String identifier) {
72+
public ResourceSelector(String identifier) {
7373
super(identifier);
7474
}
7575

76-
public static class Serializer implements ArgumentPropertySerializer<Resource> {
76+
public static class Serializer implements ArgumentPropertySerializer<ResourceSelector> {
7777

78-
static final Resource.Serializer REGISTRY = new Resource.Serializer();
78+
static final ResourceSelector.Serializer REGISTRY = new ResourceSelector.Serializer();
7979

8080
@Override
81-
public Resource deserialize(ByteBuf buf, ProtocolVersion protocolVersion) {
82-
return new Resource(ProtocolUtils.readString(buf));
81+
public ResourceSelector deserialize(ByteBuf buf, ProtocolVersion protocolVersion) {
82+
return new ResourceSelector(ProtocolUtils.readString(buf));
8383
}
8484

8585
@Override
86-
public void serialize(Resource object, ByteBuf buf, ProtocolVersion protocolVersion) {
86+
public void serialize(ResourceSelector object, ByteBuf buf, ProtocolVersion protocolVersion) {
8787
ProtocolUtils.writeString(buf, object.getIdentifier());
8888
}
8989
}

proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/ChatQueue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public int accumulateAckCount(int ackCount) {
187187
}
188188

189189
public LastSeenMessages createLastSeen() {
190-
return new LastSeenMessages(0, lastSeenMessages);
190+
return new LastSeenMessages(0, lastSeenMessages, (byte) 0);
191191
}
192192
}
193193
}

0 commit comments

Comments
 (0)