Skip to content

Commit e50b806

Browse files
committed
Fix CRAFT_LOOM action in v712
1 parent db4010f commit e50b806

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v712/BedrockCodecHelper_v712.java

+7
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ protected void writeRequestActionData(ByteBuf byteBuf, ItemStackRequestAction ac
6565
List<ItemDescriptorWithCount> ingredients = ((AutoCraftRecipeAction) action).getIngredients();
6666
byteBuf.writeByte(ingredients.size());
6767
writeArray(byteBuf, ingredients, this::writeIngredient);
68+
} else if (action.getType().equals(ItemStackRequestActionType.CRAFT_LOOM)) {
69+
this.writeString(byteBuf, ((CraftLoomAction) action).getPatternId());
70+
byteBuf.writeByte(((CraftLoomAction) action).getTimesCrafted());
6871
} else {
6972
super.writeRequestActionData(byteBuf, action);
7073
}
@@ -85,6 +88,10 @@ protected ItemStackRequestAction readRequestActionData(ByteBuf byteBuf, ItemStac
8588
List<ItemDescriptorWithCount> ingredients = new ObjectArrayList<>();
8689
this.readArray(byteBuf, ingredients, ByteBuf::readUnsignedByte, this::readIngredient);
8790
return new AutoCraftRecipeAction(recipeNetworkId, timesCrafted, ingredients, numberOfRequestedCrafts);
91+
} else if (type.equals(ItemStackRequestActionType.CRAFT_LOOM)) {
92+
String patternId = this.readString(byteBuf);
93+
int timesCrafted = byteBuf.readUnsignedByte();
94+
return new CraftLoomAction(patternId, timesCrafted);
8895
} else {
8996
return super.readRequestActionData(byteBuf, type);
9097
}

bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/inventory/itemstack/request/action/CraftLoomAction.java

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
@Value
66
public class CraftLoomAction implements ItemStackRequestAction {
77
String patternId;
8+
/**
9+
* @since v712
10+
*/
11+
int timesCrafted;
812

913
@Override
1014
public ItemStackRequestActionType getType() {

0 commit comments

Comments
 (0)