Skip to content

Commit d46e184

Browse files
committed
26.2-pre-6
1 parent 709ef70 commit d46e184

6 files changed

Lines changed: 22 additions & 3 deletions

File tree

protocol/src/main/java/org/geysermc/mcprotocollib/protocol/codec/MinecraftCodec.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@
236236

237237
public class MinecraftCodec {
238238
public static final PacketCodec CODEC = PacketCodec.builder()
239-
.protocolVersion((1 << 30) | 316)
240-
.minecraftVersion("26.2 Pre-Release 2")
239+
.protocolVersion((1 << 30) | 320)
240+
.minecraftVersion("26.2 Pre-Release 6")
241241
.state(ProtocolState.HANDSHAKE, MinecraftPacketRegistry.builder()
242242
.registerServerboundPacket(ClientIntentionPacket.class, ClientIntentionPacket::new)
243243
)

protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/DataComponentTypes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public class DataComponentTypes {
7676
public static final IntComponentType MAP_ID = register(id -> new IntComponentType(id, "map_id", MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntDataComponent::new));
7777
public static final DataComponentType<NbtMap> MAP_DECORATIONS = register(id -> new DataComponentType<>(id, "map_decorations", MinecraftTypes::readCompoundTag, MinecraftTypes::writeAnyTag, ObjectDataComponent::new));
7878
public static final IntComponentType MAP_POST_PROCESSING = register(id -> new IntComponentType(id, "map_post_processing", MinecraftTypes::readVarInt, MinecraftTypes::writeVarInt, IntDataComponent::new));
79-
public static final DataComponentType<List<ItemStack>> CHARGED_PROJECTILES = register(id -> new DataComponentType<>(id, "charged_projectiles", listReader(MinecraftTypes::readItemStackTemplate), listWriter(MinecraftTypes::writeItemStackTemplate), ObjectDataComponent::new));
79+
public static final DataComponentType<List<ItemStack>> CHARGED_PROJECTILES = register(id -> new DataComponentType<>(id, "charged_projectiles", listReader(MinecraftTypes::readItemStackTemplate, 1024), listWriter(MinecraftTypes::writeItemStackTemplate, 1024), ObjectDataComponent::new));
8080
public static final DataComponentType<List<ItemStack>> BUNDLE_CONTENTS = register(id -> new DataComponentType<>(id, "bundle_contents", listReader(MinecraftTypes::readItemStackTemplate), listWriter(MinecraftTypes::writeItemStackTemplate), ObjectDataComponent::new));
8181
public static final DataComponentType<PotionContents> POTION_CONTENTS = register(id -> new DataComponentType<>(id, "potion_contents", ItemTypes::readPotionContents, ItemTypes::writePotionContents, ObjectDataComponent::new));
8282
public static final DataComponentType<Float> POTION_DURATION_SCALE = register(id -> new DataComponentType<>(id, "potion_duration_scale", ByteBuf::readFloat, ByteBuf::writeFloat, ObjectDataComponent::new));

protocol/src/main/java/org/geysermc/mcprotocollib/protocol/packet/ingame/clientbound/entity/ClientboundUpdateAttributesPacket.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ public class ClientboundUpdateAttributesPacket implements MinecraftPacket {
2424
public ClientboundUpdateAttributesPacket(ByteBuf in) {
2525
this.entityId = MinecraftTypes.readVarInt(in);
2626
this.attributes = new ArrayList<>();
27+
2728
int length = MinecraftTypes.readVarInt(in);
29+
if (length > 128) {
30+
throw new IllegalArgumentException(length + " attributes exceeds max size of: " + 128);
31+
}
32+
2833
for (int index = 0; index < length; index++) {
2934
int attributeId = MinecraftTypes.readVarInt(in);
3035
double value = in.readDouble();
@@ -42,6 +47,11 @@ public ClientboundUpdateAttributesPacket(ByteBuf in) {
4247
@Override
4348
public void serialize(ByteBuf out) {
4449
MinecraftTypes.writeVarInt(out, this.entityId);
50+
51+
if (this.attributes.size() > 128) {
52+
throw new IllegalArgumentException(this.attributes.size() + " attributes exceeds max size of: " + 128);
53+
}
54+
4555
MinecraftTypes.writeVarInt(out, this.attributes.size());
4656
for (Attribute attribute : this.attributes) {
4757
MinecraftTypes.writeVarInt(out, attribute.getType().getId());

protocol/src/main/java/org/geysermc/mcprotocollib/protocol/packet/ingame/serverbound/ServerboundDebugSubscriptionRequestPacket.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,23 @@ public class ServerboundDebugSubscriptionRequestPacket implements MinecraftPacke
1919

2020
public ServerboundDebugSubscriptionRequestPacket(ByteBuf in) {
2121
this.subscriptions = new ArrayList<>();
22+
2223
int length = MinecraftTypes.readVarInt(in);
24+
if (length > 32) {
25+
throw new IllegalArgumentException(length + " subscriptions exceeds max size of: " + 32);
26+
}
27+
2328
for (int i = 0; i < length; i++) {
2429
this.subscriptions.add(DebugSubscriptions.from(MinecraftTypes.readVarInt(in)));
2530
}
2631
}
2732

2833
@Override
2934
public void serialize(ByteBuf out) {
35+
if (this.subscriptions.size() > 32) {
36+
throw new IllegalArgumentException(this.subscriptions.size() + " subscriptions exceeds max size of: " + 32);
37+
}
38+
3039
MinecraftTypes.writeVarInt(out, this.subscriptions.size());
3140
for (DebugSubscriptions subscription : this.subscriptions) {
3241
MinecraftTypes.writeVarInt(out, subscription.ordinal());
6 Bytes
Binary file not shown.
16 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)