From e50b8063fab2b71e8d4544ffc632dc429f786ad8 Mon Sep 17 00:00:00 2001 From: Alemiz Date: Wed, 28 Aug 2024 17:41:27 +0200 Subject: [PATCH] Fix CRAFT_LOOM action in v712 --- .../bedrock/codec/v712/BedrockCodecHelper_v712.java | 7 +++++++ .../itemstack/request/action/CraftLoomAction.java | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v712/BedrockCodecHelper_v712.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v712/BedrockCodecHelper_v712.java index 1e1f79e43..7ee1054c4 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v712/BedrockCodecHelper_v712.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v712/BedrockCodecHelper_v712.java @@ -65,6 +65,9 @@ protected void writeRequestActionData(ByteBuf byteBuf, ItemStackRequestAction ac List ingredients = ((AutoCraftRecipeAction) action).getIngredients(); byteBuf.writeByte(ingredients.size()); writeArray(byteBuf, ingredients, this::writeIngredient); + } else if (action.getType().equals(ItemStackRequestActionType.CRAFT_LOOM)) { + this.writeString(byteBuf, ((CraftLoomAction) action).getPatternId()); + byteBuf.writeByte(((CraftLoomAction) action).getTimesCrafted()); } else { super.writeRequestActionData(byteBuf, action); } @@ -85,6 +88,10 @@ protected ItemStackRequestAction readRequestActionData(ByteBuf byteBuf, ItemStac List ingredients = new ObjectArrayList<>(); this.readArray(byteBuf, ingredients, ByteBuf::readUnsignedByte, this::readIngredient); return new AutoCraftRecipeAction(recipeNetworkId, timesCrafted, ingredients, numberOfRequestedCrafts); + } else if (type.equals(ItemStackRequestActionType.CRAFT_LOOM)) { + String patternId = this.readString(byteBuf); + int timesCrafted = byteBuf.readUnsignedByte(); + return new CraftLoomAction(patternId, timesCrafted); } else { return super.readRequestActionData(byteBuf, type); } diff --git a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/itemstack/request/action/CraftLoomAction.java b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/itemstack/request/action/CraftLoomAction.java index 12918eacf..7ff8299d7 100644 --- a/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/itemstack/request/action/CraftLoomAction.java +++ b/bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/itemstack/request/action/CraftLoomAction.java @@ -5,6 +5,10 @@ @Value public class CraftLoomAction implements ItemStackRequestAction { String patternId; + /** + * @since v712 + */ + int timesCrafted; @Override public ItemStackRequestActionType getType() {