Skip to content

Commit

Permalink
Fix CRAFT_LOOM action in v712
Browse files Browse the repository at this point in the history
  • Loading branch information
Alemiz112 committed Aug 28, 2024
1 parent db4010f commit e50b806
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ protected void writeRequestActionData(ByteBuf byteBuf, ItemStackRequestAction ac
List<ItemDescriptorWithCount> 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);
}
Expand All @@ -85,6 +88,10 @@ protected ItemStackRequestAction readRequestActionData(ByteBuf byteBuf, ItemStac
List<ItemDescriptorWithCount> 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
@Value
public class CraftLoomAction implements ItemStackRequestAction {
String patternId;
/**
* @since v712
*/
int timesCrafted;

@Override
public ItemStackRequestActionType getType() {
Expand Down

0 comments on commit e50b806

Please sign in to comment.