Fix consumable writing

This commit is contained in:
Nassim Jahnke 2024-10-22 13:23:06 +02:00
parent f5aac9b1ab
commit 8391e9d924
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
2 changed files with 5 additions and 6 deletions

View File

@ -76,7 +76,7 @@ public record Consumable1_21_2(float consumeSeconds, int animationType, Holder<S
@Override
public void write(final ByteBuf buffer, final ConsumeEffect<?> value) {
Types.VAR_INT.writePrimitive(buffer, value.id);
value.write(buffer);
value.writeValue(buffer);
}
};
public static final Type<ConsumeEffect<?>[]> ARRAY_TYPE = new ArrayType<>(TYPE);
@ -86,9 +86,8 @@ public record Consumable1_21_2(float consumeSeconds, int animationType, Holder<S
return new ConsumeEffect<>(id, type, (T) value);
}
void write(final ByteBuf buf) {
Types.VAR_INT.writePrimitive(buf, id);
type.write(buf, value);
void writeValue(final ByteBuf buf) {
this.type.write(buf, this.value);
}
}

View File

@ -214,11 +214,11 @@ public final class Protocol1_21To1_21_2 extends AbstractProtocol<ClientboundPack
StructuredDataKey.POT_DECORATIONS, StructuredDataKey.BLOCK_STATE, StructuredDataKey.BEES, StructuredDataKey.LOCK,
StructuredDataKey.CONTAINER_LOOT, StructuredDataKey.TOOL, StructuredDataKey.ITEM_NAME, StructuredDataKey.OMINOUS_BOTTLE_AMPLIFIER,
StructuredDataKey.FOOD1_21_2, StructuredDataKey.JUKEBOX_PLAYABLE, StructuredDataKey.ATTRIBUTE_MODIFIERS1_21,
StructuredDataKey.REPAIRABLE, StructuredDataKey.ENCHANTABLE, StructuredDataKey.CONSUMABLE1_21_2, StructuredDataKey.USE_REMAINDER,
StructuredDataKey.REPAIRABLE, StructuredDataKey.ENCHANTABLE, StructuredDataKey.CONSUMABLE1_21_2,
StructuredDataKey.USE_COOLDOWN, StructuredDataKey.DAMAGE, StructuredDataKey.EQUIPPABLE, StructuredDataKey.ITEM_MODEL,
StructuredDataKey.GLIDER, StructuredDataKey.TOOLTIP_STYLE, StructuredDataKey.DEATH_PROTECTION,
// Volatile thanks to containing item
StructuredDataKey.CHARGED_PROJECTILES1_21_2, StructuredDataKey.BUNDLE_CONTENTS1_21_2, StructuredDataKey.CONTAINER1_21_2);
StructuredDataKey.CHARGED_PROJECTILES1_21_2, StructuredDataKey.BUNDLE_CONTENTS1_21_2, StructuredDataKey.CONTAINER1_21_2, StructuredDataKey.USE_REMAINDER);
super.onMappingDataLoaded();
}