Skip to content

Comments

Feature - plant fibre recipes#53

Open
The-Code-Monkey wants to merge 3 commits into1.21from
feat/plant-fibre-recipes
Open

Feature - plant fibre recipes#53
The-Code-Monkey wants to merge 3 commits into1.21from
feat/plant-fibre-recipes

Conversation

@The-Code-Monkey
Copy link
Contributor

@The-Code-Monkey The-Code-Monkey commented Feb 23, 2026

Don't merge until all plant fibre recipes are in and are able to be datagenned.

Summary by CodeRabbit

  • New Features

    • Added copper armor crafting (cuirass, helmet, greaves) at the workbench.
    • Added workbench recipes and a new "armorers" recipe type for armor-specific crafting.
    • UI now remembers the last-selected recipe in the armorers workbench for crafting.
  • Bug Fixes / Improvements

    • Server now validates craft requests against the open workbench menu and delivers outputs reliably (adds to inventory or drops if full).
  • Chores

    • Removed several unused imports.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dd6ea76 and 07a58ad.

📒 Files selected for processing (3)
  • src/client/java/com/tcm/MineTale/block/workbenches/screen/ArmorersWorkbenchScreen.java
  • src/main/java/com/tcm/MineTale/MineTale.java
  • src/main/java/com/tcm/MineTale/registry/ModRecipeDisplay.java

📝 Walkthrough

Walkthrough

Refactors data-gen recipe registration into modular recipe builder classes, removes several unused imports, adds a new recipe display type for armorers, and implements memory-backed client recipe selection plus a server-side guarded craft request handler that differentiates workbench vs. armorers menus.

Changes

Cohort / File(s) Summary
Import cleanup
src/client/java/com/tcm/MineTale/datagen/ModBlockTagProvider.java, src/client/java/com/tcm/MineTale/datagen/ModLootTableProvider.java, src/main/java/com/tcm/MineTale/registry/ModItems.java
Removed unused imports from several datagen and registry sources.
Recipe provider refactor
src/client/java/com/tcm/MineTale/datagen/ModRecipeProvider.java
Replaced inline workbench recipe definitions with delegation to modular recipe builder classes and added corresponding imports.
New recipe modules (implemented)
src/client/java/com/tcm/MineTale/datagen/recipes/ArmorRecipes.java, src/client/java/com/tcm/MineTale/datagen/recipes/WorkbenchRecipes.java
Added ArmorRecipes (registers copper armor Workbench recipes) and WorkbenchRecipes (adds armorers and furnace workbench recipes) with concrete WorkbenchRecipeBuilder usage.
New recipe modules (stubs)
src/client/java/com/tcm/MineTale/datagen/recipes/BuilderRecipes.java, src/client/java/com/tcm/MineTale/datagen/recipes/FarmerRecipes.java, src/client/java/com/tcm/MineTale/datagen/recipes/FurnitureRecipes.java
Added placeholder/stub builders with commented recipe plans; no active recipe registrations.
Client recipe-book & screen state
src/client/java/com/tcm/MineTale/block/workbenches/screen/ArmorersWorkbenchScreen.java
Introduced persistent lastKnownSelectedId, updated craft request flow and UI enablement to use remembered selection.
Server craft handling & integration
src/main/java/com/tcm/MineTale/MineTale.java
Added guarded CraftRequestPayload handler that validates open menu type (Workbench vs Armorers), looks up recipes by type, creates outputs and attempts inventory insertion or drops items.
Recipe display extension
src/main/java/com/tcm/MineTale/registry/ModRecipeDisplay.java
Added public ARMORERS_TYPE RecipeDisplay.Type for WorkbenchRecipeDisplay (same codec/stream codec as WORKBENCH_TYPE).

Sequence Diagram(s)

mermaid
sequenceDiagram
rect rgba(200,200,255,0.5)
participant Client
participant ArmorersScreen
end
rect rgba(200,255,200,0.5)
participant Server
participant MenuRegistry
participant PlayerInventory
end

Client->>ArmorersScreen: select recipe (sets lastKnownSelectedId)
Client->>ArmorersScreen: press craft
ArmorersScreen->>Client: build CraftRequestPayload (uses lastKnownSelectedId)
Client->>Server: send CraftRequestPayload
Server->>MenuRegistry: verify open menu is Workbench or Armorers
Server->>MenuRegistry: determine recipe type (WORKBENCH/ARMORERS)
Server->>Server: lookup RecipeDisplay by id/type
alt recipe found
    Server->>PlayerInventory: attempt add produced item
    alt inventory full
        Server->>Server: drop item at player position
    end
    Server->>Client: sync inventory
else not found
    Server->>Client: ignore/reject packet
end

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • AnyaPizza

Poem

🐰
I hopped through code with nimble feet,
Recipes sorted, tidy, neat.
Armorers, workbenches now sing,
Modular recipes—what joy they bring! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Feature - plant fibre recipes' is vague and does not clearly convey the actual scope of changes, which includes recipe refactoring, creation of modular recipe builders, and armor crafting implementation. Consider a more descriptive title that better reflects the primary changes, such as 'Refactor recipes into modular builders and add armor crafting' or 'Create modular recipe system with armor and workbench recipes'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/plant-fibre-recipes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/client/java/com/tcm/MineTale/datagen/ModRecipeProvider.java (1)

36-62: ⚠️ Potential issue | 🟡 Minor

Stale Javadoc — references recipes that moved to WorkbenchRecipes.java.

The class-level Javadoc (lines 40–44) still lists "workbench_armorers_workbench" and "workbench_furnace_workbench_t1" as produced by this provider. The inner buildRecipes() Javadoc (lines 57–61) repeats the same. Both were moved to WorkbenchRecipes.buildRecipes. Consider updating both doc blocks to reflect only the recipes still registered inline here (campfire pork, wood chest, furnace T1 copper ingot) and note that further recipes are delegated to the modular builders.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/client/java/com/tcm/MineTale/datagen/ModRecipeProvider.java` around lines
36 - 62, Update the stale Javadoc in ModRecipeProvider: in the class-level
docblock and the inner buildRecipes() docblock (inside createRecipeProvider's
returned RecipeProvider), remove the references to
"workbench_armorers_workbench" and "workbench_furnace_workbench_t1" and any
wording that says those recipes are produced here; instead document that this
provider only registers campfire pork cooking, workbench wood chest, and
furnace_t1_copper_ingot, and add a short note that additional workbench recipes
are delegated to WorkbenchRecipes.buildRecipes. Ensure the updated comments
reference ModRecipeProvider and WorkbenchRecipes.buildRecipes so readers can
find the modular builder.
🧹 Nitpick comments (1)
src/client/java/com/tcm/MineTale/datagen/recipes/FurnitureRecipes.java (1)

10-54: Commented recipes are missing .time() calls.

Every other active recipe (and the TODO blocks in other files) chains a .time(n) call. All five commented-out furniture recipes omit it. When these are uncommented, the builder will use whatever default applies — worth adding .time(...) now to avoid a silent misconfiguration later.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/client/java/com/tcm/MineTale/datagen/recipes/FurnitureRecipes.java`
around lines 10 - 54, The commented WorkbenchRecipeBuilder recipes (e.g., the
builders creating WOODCUTTERS_BLOCK, LARGE_PILE_OF_BOOKS, SMALL_PILE_OF_BOOKS,
KWEEBEC_PLUSHIE, OLD_SCROLL) are missing a .time(...) chain call; when
uncommented they'll inherit a default time. Update each WorkbenchRecipeBuilder
chain (for ModRecipes.FURNITURE_TYPE / ModRecipes.FURNITURE_SERIALIZER) to
include an appropriate .time(n) before .output(...) or before .unlockedBy(...)
consistent with other recipes so they use the intended crafting duration.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/client/java/com/tcm/MineTale/datagen/recipes/ArmorRecipes.java`:
- Around line 51-79: The commented WoodenArmor block is a copy of the copper
recipes and will cause duplicate ResourceKey errors when enabled; update the
WorkbenchRecipeBuilder calls (the block using WorkbenchRecipeBuilder,
ModRecipes.ARMORERS_TYPE, ModRecipes.ARMORERS_SERIALIZER) to use the correct
wood-based input and output item symbols instead of
Items.COPPER_INGOT/Items.COPPER_HELMET/Items.COPPER_LEGGINGS/Items.COPPER_CHESTPLATE,
change the unlock criterion provider.has(...) to reference the appropriate
wooden item (e.g., a wooden plank/ingot symbol from ModItems or ItemTags), and
give each .save(exporter, "...") a unique wood-specific key (do not reuse
"copper_cuirass", "copper_helmet", "copper_greaves", etc.) so the recipe
ResourceKeys are distinct from the copper recipes.
- Around line 42-49: The commented Copper Gauntlets recipe block wrongly outputs
Items.COPPER_LEGGINGS and is missing the recipe book category; when uncommenting
the WorkbenchRecipeBuilder block for the Copper Gauntlets (the one saving as
"copper_gauntlets"), change .output(Items.COPPER_LEGGINGS) to the correct
gauntlet item (e.g., ModItems.COPPER_GAUNTLETS or the project’s copper gauntlet
identifier) and add .bookCategory(ModRecipeDisplay.ARMORERS_SEARCH) to match the
other armor recipes before calling .save(exporter, "copper_gauntlets").

---

Outside diff comments:
In `@src/client/java/com/tcm/MineTale/datagen/ModRecipeProvider.java`:
- Around line 36-62: Update the stale Javadoc in ModRecipeProvider: in the
class-level docblock and the inner buildRecipes() docblock (inside
createRecipeProvider's returned RecipeProvider), remove the references to
"workbench_armorers_workbench" and "workbench_furnace_workbench_t1" and any
wording that says those recipes are produced here; instead document that this
provider only registers campfire pork cooking, workbench wood chest, and
furnace_t1_copper_ingot, and add a short note that additional workbench recipes
are delegated to WorkbenchRecipes.buildRecipes. Ensure the updated comments
reference ModRecipeProvider and WorkbenchRecipes.buildRecipes so readers can
find the modular builder.

---

Nitpick comments:
In `@src/client/java/com/tcm/MineTale/datagen/recipes/FurnitureRecipes.java`:
- Around line 10-54: The commented WorkbenchRecipeBuilder recipes (e.g., the
builders creating WOODCUTTERS_BLOCK, LARGE_PILE_OF_BOOKS, SMALL_PILE_OF_BOOKS,
KWEEBEC_PLUSHIE, OLD_SCROLL) are missing a .time(...) chain call; when
uncommented they'll inherit a default time. Update each WorkbenchRecipeBuilder
chain (for ModRecipes.FURNITURE_TYPE / ModRecipes.FURNITURE_SERIALIZER) to
include an appropriate .time(n) before .output(...) or before .unlockedBy(...)
consistent with other recipes so they use the intended crafting duration.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c218eac and dd6ea76.

📒 Files selected for processing (9)
  • src/client/java/com/tcm/MineTale/datagen/ModBlockTagProvider.java
  • src/client/java/com/tcm/MineTale/datagen/ModLootTableProvider.java
  • src/client/java/com/tcm/MineTale/datagen/ModRecipeProvider.java
  • src/client/java/com/tcm/MineTale/datagen/recipes/ArmorRecipes.java
  • src/client/java/com/tcm/MineTale/datagen/recipes/BuilderRecipes.java
  • src/client/java/com/tcm/MineTale/datagen/recipes/FarmerRecipes.java
  • src/client/java/com/tcm/MineTale/datagen/recipes/FurnitureRecipes.java
  • src/client/java/com/tcm/MineTale/datagen/recipes/WorkbenchRecipes.java
  • src/main/java/com/tcm/MineTale/registry/ModItems.java
💤 Files with no reviewable changes (3)
  • src/main/java/com/tcm/MineTale/registry/ModItems.java
  • src/client/java/com/tcm/MineTale/datagen/ModLootTableProvider.java
  • src/client/java/com/tcm/MineTale/datagen/ModBlockTagProvider.java

Comment on lines +42 to +49
// CopperGauntlets - TODO: CopperGauntlets Not Implemented.
// new WorkbenchRecipeBuilder(ModRecipes.ARMORERS_TYPE, ModRecipes.ARMORERS_SERIALIZER)
// .input(Items.COPPER_INGOT, 5)
// .input(ModItems.PLANT_FIBER, 1)
// .output(Items.COPPER_LEGGINGS)
// .time(3)
// .unlockedBy("has_copper_ingot", provider.has(Items.COPPER_INGOT))
// .save(exporter, "copper_gauntlets");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Copper Gauntlets placeholder has the wrong output and is missing .bookCategory().

Line 46 has .output(Items.COPPER_LEGGINGS) — a direct copy-paste from the greaves recipe. When this block is uncommented it will silently produce leggings instead of gauntlets. It also lacks the .bookCategory(ModRecipeDisplay.ARMORERS_SEARCH) call present on all three active armor recipes.

🐛 Suggested corrections (for when this is uncommented)
-//     .output(Items.COPPER_LEGGINGS)
+//     .output(ModItems.COPPER_GAUNTLETS)  // replace with the actual gauntlets item when registered
     .time(3)
     .unlockedBy("has_copper_ingot", provider.has(Items.COPPER_INGOT))
+//     .bookCategory(ModRecipeDisplay.ARMORERS_SEARCH)
     .save(exporter, "copper_gauntlets");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// CopperGauntlets - TODO: CopperGauntlets Not Implemented.
// new WorkbenchRecipeBuilder(ModRecipes.ARMORERS_TYPE, ModRecipes.ARMORERS_SERIALIZER)
// .input(Items.COPPER_INGOT, 5)
// .input(ModItems.PLANT_FIBER, 1)
// .output(Items.COPPER_LEGGINGS)
// .time(3)
// .unlockedBy("has_copper_ingot", provider.has(Items.COPPER_INGOT))
// .save(exporter, "copper_gauntlets");
// CopperGauntlets - TODO: CopperGauntlets Not Implemented.
// new WorkbenchRecipeBuilder(ModRecipes.ARMORERS_TYPE, ModRecipes.ARMORERS_SERIALIZER)
// .input(Items.COPPER_INGOT, 5)
// .input(ModItems.PLANT_FIBER, 1)
// .output(ModItems.COPPER_GAUNTLETS) // replace with the actual gauntlets item when registered
// .time(3)
// .unlockedBy("has_copper_ingot", provider.has(Items.COPPER_INGOT))
// .bookCategory(ModRecipeDisplay.ARMORERS_SEARCH)
// .save(exporter, "copper_gauntlets");
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/client/java/com/tcm/MineTale/datagen/recipes/ArmorRecipes.java` around
lines 42 - 49, The commented Copper Gauntlets recipe block wrongly outputs
Items.COPPER_LEGGINGS and is missing the recipe book category; when uncommenting
the WorkbenchRecipeBuilder block for the Copper Gauntlets (the one saving as
"copper_gauntlets"), change .output(Items.COPPER_LEGGINGS) to the correct
gauntlet item (e.g., ModItems.COPPER_GAUNTLETS or the project’s copper gauntlet
identifier) and add .bookCategory(ModRecipeDisplay.ARMORERS_SEARCH) to match the
other armor recipes before calling .save(exporter, "copper_gauntlets").

Comment on lines +51 to +79
// TODO: WoodenArmor Not Implemented
// new WorkbenchRecipeBuilder(ModRecipes.ARMORERS_TYPE, ModRecipes.ARMORERS_SERIALIZER)
// .input(ItemTags.LOGS, lookup, 15)
// .input(ModItems.PLANT_FIBER, 3)
// .output(Items.COPPER_CHESTPLATE)
// .time(3)
// .unlockedBy("has_copper_ingot", provider.has(Items.COPPER_INGOT))
// .save(exporter, "copper_cuirass");
// new WorkbenchRecipeBuilder(ModRecipes.ARMORERS_TYPE, ModRecipes.ARMORERS_SERIALIZER)
// .input(Items.COPPER_INGOT, 6)
// .input(ModItems.PLANT_FIBER, 2)
// .output(Items.COPPER_HELMET)
// .time(3)
// .unlockedBy("has_copper_ingot", provider.has(Items.COPPER_INGOT))
// .save(exporter, "copper_helmet");
// new WorkbenchRecipeBuilder(ModRecipes.ARMORERS_TYPE, ModRecipes.ARMORERS_SERIALIZER)
// .input(Items.COPPER_INGOT, 9)
// .input(ModItems.PLANT_FIBER, 3)
// .output(Items.COPPER_LEGGINGS)
// .time(3)
// .unlockedBy("has_copper_ingot", provider.has(Items.COPPER_INGOT))
// .save(exporter, "copper_greaves");
// new WorkbenchRecipeBuilder(ModRecipes.ARMORERS_TYPE, ModRecipes.ARMORERS_SERIALIZER)
// .input(Items.COPPER_INGOT, 5)
// .input(ModItems.PLANT_FIBER, 1)
// .output(Items.COPPER_LEGGINGS)
// .time(3)
// .unlockedBy("has_copper_ingot", provider.has(Items.COPPER_INGOT))
// .save(exporter, "copper_gauntlets");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

WoodenArmor TODO block is an unmodified copy of the copper armor recipes — will crash datagen when uncommented.

The block still uses:

  • Items.COPPER_INGOT / Items.COPPER_HELMET / Items.COPPER_LEGGINGS / Items.COPPER_CHESTPLATE as inputs/outputs instead of any wood-based items.
  • The same save keys ("copper_cuirass", "copper_helmet", "copper_greaves") as the active recipes above.

Duplicate recipe ResourceKeys cause Minecraft's datagen to throw an IllegalStateException, so uncommenting this block as-is will break the data generation run. The inputs, outputs, unlock criterion, and save keys all need to be adapted to wooden armor items before activation.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/client/java/com/tcm/MineTale/datagen/recipes/ArmorRecipes.java` around
lines 51 - 79, The commented WoodenArmor block is a copy of the copper recipes
and will cause duplicate ResourceKey errors when enabled; update the
WorkbenchRecipeBuilder calls (the block using WorkbenchRecipeBuilder,
ModRecipes.ARMORERS_TYPE, ModRecipes.ARMORERS_SERIALIZER) to use the correct
wood-based input and output item symbols instead of
Items.COPPER_INGOT/Items.COPPER_HELMET/Items.COPPER_LEGGINGS/Items.COPPER_CHESTPLATE,
change the unlock criterion provider.has(...) to reference the appropriate
wooden item (e.g., a wooden plank/ingot symbol from ModItems or ItemTags), and
give each .save(exporter, "...") a unique wood-specific key (do not reuse
"copper_cuirass", "copper_helmet", "copper_greaves", etc.) so the recipe
ResourceKeys are distinct from the copper recipes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant