Skip to content

Add Most Farmers Workbench Recipies#54

Merged
The-Code-Monkey merged 5 commits into1.21from
feat/add-farmers-workbench
Feb 26, 2026
Merged

Add Most Farmers Workbench Recipies#54
The-Code-Monkey merged 5 commits into1.21from
feat/add-farmers-workbench

Conversation

@The-Code-Monkey
Copy link
Contributor

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

Summary by CodeRabbit

  • New Features

    • Farmers Workbench with a dedicated crafting UI, recipe-book tab, persistent recipe selection, and craft buttons (1, x10, All).
    • 40+ new blocks: moss variants, terrain types, hanging moss, rugs, vines, bamboo planter, etc.
    • Full set of Farmers Workbench recipes and a new recipe-book category for farmers.
  • Chores

    • New registrations for workbench menus, entities and recipe types; legacy moss item removed.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 26, 2026

📝 Walkthrough

In the beginning — or on a curious afternoon when hobbits and hyperdrives conspired — this branch grows a small, verdant grove in MineTale: the Farmers Workbench and its kin have been planted, wired and given purpose.

Release Notes — read aloud beside a campfire on the edge of the galaxy

  • New Workbenches

    • Farmers Workbench: new block, block‑entity, menu, menu type, recipe type & serializer, and client screen (FarmersWorkbenchScreen). Server and client wiring support networked nearby‑item queries and server‑side crafting orchestration.
    • Builders Workbench: sibling additions mirror the Farmers workbench — BuildersWorkbench, BuildersWorkbenchEntity, BuildersWorkbenchMenu, BuildersWorkbenchScreen, recipe type/serializer, and menu type.
    • Existing workbenches (Workbench, Armorer) and their screens now remember the last selected recipe ID to drive craft actions and button states.
  • Recipe & Datagen

    • New FARMERS and BUILDERS recipe types/serializers and recipe‑book categories; ModRecipeDisplay gains FARMERS and BUILDERS categories.
    • FarmerRecipes datagen massively expanded: many new farmer workbench recipes (terrain, planters, moss variants, rugs, vines, grasses, ropes, etc.) were authored and emitted.
    • BuilderRecipes updated to emit builder outputs (rope/rope_diagonal) using the new builders recipe type.
  • Menus, Screens & API wiring

    • AbstractWorkbenchContainerMenu now carries a RecipeType field and its constructor accepts the recipe type — menus (farmers/builders/furnace/workbench/armorer/campfire) pass their ModRecipes.*Type accordingly.
    • ModMenuTypes exposes new FARMERS_WORKBENCH_MENU and BUILDERS_WORKBENCH_MENU.
    • Client registration: screens for Farmers and Builders (and screen factory registrations) added in client init.
    • MineTale server crafting logic generalised to use the menu’s recipe type (AbstractWorkbenchContainerMenu.getRecipeType()), enabling multiple bench flavours to share server machinery.
  • Blocks, BlockEntities & Registry

    • Many new blocks added (moss variants, moss blocks, rugs, hanging moss, vines, soils, grasses, bamboo_planter, ROPE and ROPE_DIAGONAL, plus FARMERS_WORKBENCH_BLOCK and BUILDERS_WORKBENCH_BLOCK).
    • ModBlockEntities registers FARMERS_WORKBENCH_BE and BUILDERS_WORKBENCH_BE.
  • Inventory & Crafting behaviour

    • Menus aggregate player inventory, internal container slots, and networked nearby items when filling crafting contents; screens’ canCraft logic accounts for nearby networked items and craft multipliers.
    • Craft controls added: craft 1, craft 10, craft All (sent as CraftRequestPayloads); screens resolve results from client recipe book remembered selection and toggle buttons based on feasibility.
  • Minor public surface changes

    • New public classes/fields added (Farmers/Builders workbenches, entities, menus, menu types, recipe types, serializers, recipe‑book categories).
    • Removed public ModItems.MOSS field (MOSS no longer exposed as a public item constant).
    • AbstractWorkbenchContainerMenu constructor signature changed to include RecipeType — a notable API consumer change to verify.

Notes for reviewers — scrawled in Elvish beside the towel

  • Initialization order and registry safety: ensure recipe types/serializers and recipe‑book categories are registered before menus/screens that reference them.
  • Datagen: FarmerRecipes is very large — verify tag usage, ingredient lookups, identifiers and unlock conditions to avoid registry or data collisions.
  • Client-server contract: screens now remember RecipeDisplayId and the client sends CraftRequestPayloads based on resolved result items — confirm server resolution (using the menu’s recipe type) matches the client’s expectations.
  • API impact: AbstractWorkbenchContainerMenu constructor change and many new public symbols require downstream updates; check third‑party addons/datapacks for compatibility.

Verdict — whispered by an ancient gardener with a radio towel

  • This is a broadly additive, high‑impact PR that seeds many new assets and systems. It harmonises multiple workbench flavours under a shared recipe/type framework; a careful pass on registry order, recipe identifiers and the new menu constructor usage will keep the cosmos — and the hobbits — content.

Walkthrough

Adds Farmers and Builders workbenches: new blocks, block entities, menus, screens, recipe types/serializers, datagen recipes, many new blocks, and updates to the AbstractWorkbenchContainerMenu, client screen logic (selection memory, craft buttons) and server crafting dispatch to use a recipe-type-aware menu.

Changes

Cohort / File(s) Summary
New workbench blocks & entities
src/main/java/com/tcm/MineTale/block/workbenches/FarmersWorkbench.java, src/main/java/com/tcm/MineTale/block/workbenches/BuildersWorkbench.java, src/main/java/com/tcm/MineTale/block/workbenches/entity/FarmersWorkbenchEntity.java, src/main/java/com/tcm/MineTale/block/workbenches/entity/BuildersWorkbenchEntity.java
Adds Farmers and Builders workbench block classes and block-entity classes with codec, ticking, persistence, menu creation, recipe-type binding and fuel checks.
Menus / menu base
src/main/java/com/tcm/MineTale/block/workbenches/menu/...
AbstractWorkbenchContainerMenu.java, FarmersWorkbenchMenu.java, BuildersWorkbenchMenu.java, WorkbenchWorkbenchMenu.java, ArmorersWorkbenchMenu.java, CampfireWorkbenchMenu.java, FurnaceWorkbenchMenu.java
Abstract menu now carries a RecipeType field and getter; many menus updated/added to pass and expose recipe type; fillCraftSlotsStackedContents implemented/rewritten to aggregate player inventory, internal slots and networked nearby items.
Client screens
src/client/java/com/tcm/MineTale/block/workbenches/screen/...
FarmersWorkbenchScreen.java, BuildersWorkbenchScreen.java, WorkbenchWorkbenchScreen.java, ArmorersWorkbenchScreen.java
Adds Farmers and Builders screens; updates existing screens to integrate MineTaleRecipeBookComponent, persist lastKnownSelectedId, add craft buttons wired to handleCraftRequest and client-side canCraft/inventory+network checks to toggle button state.
Registries & types
src/main/java/com/tcm/MineTale/registry/...
ModMenuTypes.java, ModBlockEntities.java, ModRecipeDisplay.java, ModRecipes.java, ModBlocks.java, ModItems.java
Registers new menu types, block-entity types and recipe types/serializers and recipe-book categories for Farmers/Builders; adds FARMERS/BUILDERS blocks and many decorative/terrain blocks; removes public MOSS item field.
Client init & networking
src/client/java/com/tcm/MineTale/MineTaleClient.java
Registers new screen factories for FARMERS_WORKBENCH_MENU and BUILDERS_WORKBENCH_MENU in client initialization.
Server crafting dispatch
src/main/java/com/tcm/MineTale/MineTale.java
Generalises server crafting guard/dispatch to use AbstractWorkbenchContainerMenu and obtain RecipeType from menu via getRecipeType() for recipe lookup and processing.
Datagen: Farmer & Builder recipes
src/client/java/com/tcm/MineTale/datagen/recipes/...
FarmerRecipes.java, BuilderRecipes.java, WorkbenchRecipes.java
Implements many Farmer recipes (moss variants, rugs, bamboo planter, vines, grasses, etc.), enables Farmers/Builders recipes, updates outputs to block references and recipe-type usage.
Client recipe-book wiring
src/client/java/com/tcm/MineTale/block/workbenches/screen/...
MineTaleRecipeBookComponent usage expanded with FARMERS/BUILDERS tabs and screens resolve recipe selection via remembered RecipeDisplayId.

Sequence Diagram(s)

sequenceDiagram
    participant Player
    participant Screen as Workbench Screen
    participant RecipeBook as ClientRecipeBook
    participant Menu as AbstractWorkbenchContainerMenu
    participant Network
    participant Server as Server Craft Handler
    participant BE as Workbench BlockEntity
    Player->>Screen: select recipe
    Screen->>RecipeBook: store lastKnownSelectedId
    Screen->>RecipeBook: resolve RecipeDisplayEntry
    Screen->>Screen: canCraft(player, entry, amount)
    Screen->>Menu: query networkedNearbyItems
    Player->>Screen: click craft button (amount)
    Screen->>Network: send CraftRequestPayload(resultItem, amount)
    Network->>Server: deliver payload
    Server->>Menu: cast menu -> getRecipeType()
    Server->>BE: locate recipe by type and validate/consume ingredients
    Server->>Player: apply result / sync state
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • AnyaPizza

Poem

🌿 Hark, a bench of builders, farmers, sage,

New blocks awaken from the datagen page,
The client remembers where the recipes hide,
The server learns the type and turns the tide,
May your crafts be true on every stage.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning No description was provided by the author; the pull request is completely undocumented despite containing substantial changes across multiple workbench systems. Add a comprehensive description explaining the changes: Farmers/Builders Workbenches, new screen implementations, recipe types, blocks, entities, and menu systems should all be documented.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the primary objective of adding Farmers Workbench recipes and related infrastructure, clearly summarising the main change.
Docstring Coverage ✅ Passed Docstring coverage is 95.65% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
  • 📝 Docstrings were successfully generated.
  • 📝 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/add-farmers-workbench

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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 26, 2026

Note

Docstrings generation - SUCCESS
Generated docstrings for this pull request at #57

Docstrings generation was requested by @The-Code-Monkey.

The following files were modified:

* `src/client/java/com/tcm/MineTale/MineTaleClient.java`
* `src/client/java/com/tcm/MineTale/block/workbenches/screen/ArmorersWorkbenchScreen.java`
* `src/client/java/com/tcm/MineTale/block/workbenches/screen/FarmersWorkbenchScreen.java`
* `src/client/java/com/tcm/MineTale/block/workbenches/screen/WorkbenchWorkbenchScreen.java`
* `src/client/java/com/tcm/MineTale/datagen/recipes/FarmerRecipes.java`
* `src/client/java/com/tcm/MineTale/datagen/recipes/WorkbenchRecipes.java`
* `src/main/java/com/tcm/MineTale/MineTale.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/FarmersWorkbench.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/entity/FarmersWorkbenchEntity.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/menu/AbstractWorkbenchContainerMenu.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/menu/ArmorersWorkbenchMenu.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/menu/CampfireWorkbenchMenu.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/menu/FarmersWorkbenchMenu.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/menu/FurnaceWorkbenchMenu.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/menu/WorkbenchWorkbenchMenu.java`
* `src/main/java/com/tcm/MineTale/registry/ModRecipes.java`
@The-Code-Monkey
Copy link
Contributor Author

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 26, 2026

✅ Actions performed

Full review triggered.

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: 3

Caution

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

⚠️ Outside diff range comments (1)
src/main/java/com/tcm/MineTale/registry/ModRecipes.java (1)

40-44: ⚠️ Potential issue | 🟡 Minor

Outdated Javadoc: missing ARMORERS_TYPE and FARMERS_TYPE.

The documentation mentions only furnace, campfire, and workbench recipe types but omits the newly added armorers and farmers types.

📝 Proposed fix
     /**
      * Registers the mod's recipe types and their serializers into the game's built-in registries.
      *
-     * Specifically registers the furnace (FURNACE_T1_TYPE), campfire (CAMPFIRE_TYPE),
-     * and workbench (WORKBENCH_TYPE) recipe types with their corresponding serializers.
+     * Registers all workbench recipe types (furnace, campfire, workbench, armorers, farmers)
+     * with their corresponding serializers.
      */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/com/tcm/MineTale/registry/ModRecipes.java` around lines 40 -
44, The Javadoc in ModRecipes is out of date: it only lists FURNACE_T1_TYPE,
CAMPFIRE_TYPE and WORKBENCH_TYPE but omits the newly added ARMORERS_TYPE and
FARMERS_TYPE; update the class-level/method Javadoc to mention ARMORERS_TYPE and
FARMERS_TYPE alongside the existing FURNACE_T1_TYPE, CAMPFIRE_TYPE and
WORKBENCH_TYPE and note their corresponding serializers so the documentation
accurately reflects the registered recipe types in ModRecipes.
🧹 Nitpick comments (10)
src/client/java/com/tcm/MineTale/block/workbenches/screen/WorkbenchWorkbenchScreen.java (2)

132-148: Consider using a proper logger instead of System.out.println.

The debug statements at lines 141 and 147 use System.out.println. While this matches the existing pattern in the file (e.g., hasIngredientAmount), consider refactoring to use a proper logging framework (e.g., SLF4J via LoggerFactory) with appropriate log levels. This would allow easier filtering and disabling of debug output in production builds.

♻️ Optional: Use a logger

Add a logger field at the class level:

private static final org.slf4j.Logger LOGGER = org.slf4j.LoggerFactory.getLogger(WorkbenchWorkbenchScreen.class);

Then replace:

-                    System.out.println("Persistent Selection Success: " + results.get(0));
+                    LOGGER.debug("Persistent Selection Success: {}", results.get(0));
...
-        System.out.println("Request failed: No recipe was ever selected!");
+        LOGGER.warn("Request failed: No recipe was ever selected!");
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/client/java/com/tcm/MineTale/block/workbenches/screen/WorkbenchWorkbenchScreen.java`
around lines 132 - 148, Replace the System.out.println debug prints in
handleCraftRequest with a proper logger: add a private static final
org.slf4j.Logger LOGGER =
org.slf4j.LoggerFactory.getLogger(WorkbenchWorkbenchScreen.class) at the class
level, then change the two System.out.println calls inside handleCraftRequest
(the "Persistent Selection Success: " log and the "Request failed: No recipe was
ever selected!" log) to appropriate LOGGER calls (e.g., LOGGER.debug for the
success message including the ItemStack, and LOGGER.warn or LOGGER.debug for the
failure). Keep all existing logic that reads lastKnownSelectedId, accesses
ClientRecipeBook via ClientRecipeBookAccessor, and sends the CraftRequestPayload
via ClientPlayNetworking unchanged.

169-184: Comment numbering inconsistency.

The inline comments use "// 1.", "// 2.", "// 3." numbering, but line 184 repeats "// 2." when it should be "// 4." (Button Activation Logic). This is a minor readability nit.

📝 Fix comment numbering
-        // 2. Button Activation Logic
+        // 4. Button Activation Logic
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/client/java/com/tcm/MineTale/block/workbenches/screen/WorkbenchWorkbenchScreen.java`
around lines 169 - 184, Update the misnumbered inline comment: change the
duplicate "// 2. Button Activation Logic" to "// 4. Button Activation Logic" to
reflect the correct sequence after "// 3." in the block surrounding
this.mineTaleRecipeBook, lastKnownSelectedId and selectedEntry (references:
RecipeDisplayId, lastKnownSelectedId, ClientRecipeBook/ClientRecipeBookAccessor,
RecipeDisplayEntry).
src/main/java/com/tcm/MineTale/block/workbenches/FarmersWorkbench.java (1)

24-24: Remove stray comment.

The // ChestBlock comment appears to be a leftover note and should be removed.

♻️ Proposed fix
-// ChestBlock
-
 public class FarmersWorkbench extends AbstractWorkbench<FarmersWorkbenchEntity> {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/com/tcm/MineTale/block/workbenches/FarmersWorkbench.java` at
line 24, Remove the stray comment "// ChestBlock" from the FarmersWorkbench.java
file; locate the comment near the top of the FarmersWorkbench class (class name
FarmersWorkbench) and delete that orphaned line so the file no longer contains
the leftover note.
src/client/java/com/tcm/MineTale/datagen/recipes/FarmerRecipes.java (1)

74-468: Consider extracting a helper method to reduce boilerplate.

All moss/grass/dirt recipes follow an identical pattern with only the input block, output block, and recipe name varying. While this is acceptable for data generation code, a helper method could improve maintainability.

♻️ Example helper method
private static void buildSimpleFarmerRecipe(
    RecipeOutput exporter, 
    RecipeProvider provider, 
    Object input, 
    int inputCount,
    Block output, 
    String name
) {
    var builder = new WorkbenchRecipeBuilder(ModRecipes.FARMERS_TYPE, ModRecipes.FARMERS_SERIALIZER);
    if (input instanceof Block b) {
        builder.input(b, inputCount);
    } else if (input instanceof TagKey<?> tag) {
        // handle tag input
    }
    builder.input(ModItems.PLANT_FIBER, 2)
        .output(output)
        .time(2)
        .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK))
        .bookCategory(ModRecipeDisplay.FARMERS_SEARCH)
        .save(exporter, name);
}
🤖 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/FarmerRecipes.java` around
lines 74 - 468, The file contains many repeated WorkbenchRecipeBuilder calls in
FarmerRecipes; extract a helper (e.g., buildSimpleFarmerRecipe) in the
FarmerRecipes class that accepts parameters (exporter, provider, input (Block or
TagKey/ItemTag with lookup), inputCount, output Block, recipeName) and
internally constructs the WorkbenchRecipeBuilder, applies the common
.input(ModItems.PLANT_FIBER, 2), .time(2), .unlockedBy("has_farmers_workbench",
provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK)),
.bookCategory(ModRecipeDisplay.FARMERS_SEARCH) and .save(exporter, name), and
update each duplicated recipe call sites to invoke this helper instead of
repeating the builder code.
src/main/java/com/tcm/MineTale/block/workbenches/menu/ArmorersWorkbenchMenu.java (1)

91-93: Remove debug logging before release.

System.out.println debug statements should be removed or replaced with proper logging (e.g., using MineTale.LOGGER.debug(...)) for production code.

♻️ Proposed fix
-        if (!nearbyItems.isEmpty() && this.playerInventory.player.level().isClientSide()) {
-            System.out.println("DEBUG: Recipe Book is now accounting for " + nearbyItems.size() + " stacks from the packet!");
-        }
+        // Debug logging removed - use MineTale.LOGGER.debug() if needed for development
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/ArmorersWorkbenchMenu.java`
around lines 91 - 93, Remove the System.out.println debug line in
ArmorersWorkbenchMenu (the block checking nearbyItems and
playerInventory.player.level().isClientSide()) and either delete it or replace
it with a proper logger call (e.g., MineTale.LOGGER.debug(...)) so production
logging is used instead of stdout; keep the same conditional and message content
when converting to MineTale.LOGGER.debug to preserve debug information about
nearbyItems.size().
src/client/java/com/tcm/MineTale/block/workbenches/screen/FarmersWorkbenchScreen.java (2)

251-283: Remove debug logging before release.

Multiple debug System.out.println calls should be removed for production code.

♻️ Proposed fix
     private boolean hasIngredientAmount(Inventory inventory, Ingredient ingredient, int totalRequired) {
-        System.out.println("DEBUG: Searching inventory + nearby for " + totalRequired + "...");
         if (totalRequired <= 0) return true;
         
         int found = 0;
 
         // 1. Check Player Inventory
         for (int i = 0; i < inventory.getContainerSize(); i++) {
             ItemStack stack = inventory.getItem(i);
             if (!stack.isEmpty() && ingredient.test(stack)) {
                 found += stack.getCount();
             }
         }
 
         // 2. CHECK THE NETWORKED ITEMS FROM CHESTS
-        // This is the list we sent via the packet!
         if (this.menu instanceof AbstractWorkbenchContainerMenu workbenchMenu) {
             for (ItemStack stack : workbenchMenu.getNetworkedNearbyItems()) {
                 if (!stack.isEmpty() && ingredient.test(stack)) {
                     found += stack.getCount();
-                    System.out.println("DEBUG: Found " + stack.getCount() + " in nearby networked list. Total: " + found);
                 }
             }
         }
         
-        if (found >= totalRequired) {
-            System.out.println("DEBUG: Requirement MET with " + found + "/" + totalRequired);
-            return true;
-        }
-        
-        System.out.println("DEBUG: FAILED. Only found: " + found + "/" + totalRequired);
-        return false;
+        return found >= totalRequired;
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/client/java/com/tcm/MineTale/block/workbenches/screen/FarmersWorkbenchScreen.java`
around lines 251 - 283, Remove the temporary debug System.out.println calls in
the hasIngredientAmount method of FarmersWorkbenchScreen (the prints that start
with "DEBUG:"). Keep the logic intact (iterating inventory, aggregating counts,
iterating workbenchMenu.getNetworkedNearbyItems(), and returning based on found
vs totalRequired); simply delete the println lines (or replace them with calls
to the project's logger at an appropriate log level if you prefer structured
logging) so no stdout debugging remains in production.

132-148: Remove debug logging before release.

Multiple System.out.println statements should be removed or converted to proper logging for production code.

♻️ Proposed fix
                 if (!results.isEmpty()) {
-                    System.out.println("Persistent Selection Success: " + results.get(0));
                     ClientPlayNetworking.send(new CraftRequestPayload(results.get(0), amount));
                     return;
                 }
             }
         }
-        System.out.println("Request failed: No recipe was ever selected!");
+        // No recipe selected - buttons should be disabled, so this shouldn't normally be reached
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/client/java/com/tcm/MineTale/block/workbenches/screen/FarmersWorkbenchScreen.java`
around lines 132 - 148, In handleCraftRequest, remove the System.out.println
debug calls (both the "Persistent Selection Success" and "Request failed"
prints) and replace them with proper logging using the project's logger (e.g.,
use a static LOGGER at class scope and call LOGGER.debug(...) for the success
path and LOGGER.warn(...) or LOGGER.info(...) for failure), keeping the behavior
of ClientPlayNetworking.send(new CraftRequestPayload(results.get(0), amount))
and the null/empty checks around lastKnownSelectedId,
ClientRecipeBookAccessor.getKnown(), and resultItems unchanged; add any
necessary logger import/field (e.g., private static final Logger LOGGER) if not
present.
src/main/java/com/tcm/MineTale/block/workbenches/menu/FarmersWorkbenchMenu.java (1)

35-36: Potential mismatch: SimpleContainerData initialized with EMPTY_SIZE instead of DATA_SIZE.

The client-side constructor passes new SimpleContainerData(EMPTY_SIZE) where EMPTY_SIZE = 0. While both constants are currently 0, this appears semantically incorrect—SimpleContainerData represents synced data slots, not container inventory size. If DATA_SIZE changes in the future, this would cause a mismatch.

Suggested fix
    public FarmersWorkbenchMenu(int syncId, Inventory playerInventory) {
-        this(syncId, playerInventory, new SimpleContainerData(EMPTY_SIZE), null);
+        this(syncId, playerInventory, new SimpleContainerData(DATA_SIZE), null);
    }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/FarmersWorkbenchMenu.java`
around lines 35 - 36, The client-side FarmersWorkbenchMenu constructor is
creating the synced data with new SimpleContainerData(EMPTY_SIZE) which
semantically should use DATA_SIZE; update the call in the
FarmersWorkbenchMenu(int syncId, Inventory playerInventory) constructor to use
new SimpleContainerData(DATA_SIZE) instead of EMPTY_SIZE so the menu's synced
data size matches the DATA_SIZE constant (verify the other FarmersWorkbenchMenu
constructor that accepts a ContainerData param continues to accept and use that
data).
src/main/java/com/tcm/MineTale/registry/ModBlocks.java (2)

112-175: Consider using specialized block classes for decorative blocks with non-standard behaviors.

Many of these new blocks (hanging moss, vines, ivy, rugs, short plants) are registered using the basic Block::new constructor. In vanilla Minecraft, similar blocks use specialized classes:

  • Vines/IvyVineBlock or MultifaceBlock for wall-climbing behavior
  • Hanging plants → Could use properties like HangingMossBlock or similar for ceiling attachment
  • Rugs/carpets → Typically use CarpetBlock for thin collision boxes
  • Short plants → Often use BushBlock or TallGrassBlock for plant-like behavior (breaking when block below removed, etc.)

If these are placeholder registrations for future implementation, this is fine. Otherwise, they may not behave as expected in-game (e.g., vines won't climb walls, rugs will have full-block collision).

Would you like me to help identify which blocks should use which specialized classes, or is this intentional for now?

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

In `@src/main/java/com/tcm/MineTale/registry/ModBlocks.java` around lines 112 -
175, Several decorative blocks (e.g., VINE, LIANA, WALL_IVY, IVY,
RED_HANGING_MOSS, BLUE_HANGING_MOSS, GREEN_MOSS_RUG, BLUE_MOSS_RUG, SHORT_MOSS,
SHORT_RED_MOSS, etc.) are registered with Block::new but need specialized block
classes to exhibit correct vanilla behaviors; update the register calls in
ModBlocks to use appropriate subclasses (e.g., VineBlock or MultifaceBlock for
VINE/IVY/WALL_IVY, a hanging/ceiling-attached block class for
RED_HANGING_MOSS/BLUE_HANGING_MOSS, CarpetBlock for *_RUG entries, and
BushBlock/TallPlantBlock/BushBlock-derived types for SHORT_* plants) and adjust
their BlockBehaviour.Properties as required, keeping the same register(...)
invocation pattern so other registration plumbing remains unchanged.

79-84: Consider adding .noOcclusion() for this wide workbench block.

Looking at FarmersWorkbench.java, this block is configured as a wide block (IS_WIDE = true). The FURNACE_WORKBENCH_BLOCK_T1/T2 blocks include .noOcclusion() in their properties to ensure proper rendering. Without this, adjacent blocks may incorrectly cull faces.

Suggested fix
 public static final Block FARMERS_WORKBENCH_BLOCK = register(
     "farmers_workbench",
     FarmersWorkbench::new,
-    BlockBehaviour.Properties.of().sound(SoundType.WOOD),
+    BlockBehaviour.Properties.of().sound(SoundType.WOOD).noOcclusion(),
     true
 );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/com/tcm/MineTale/registry/ModBlocks.java` around lines 79 - 84,
The block FARMERS_WORKBENCH_BLOCK is a wide block (see FarmersWorkbench and its
IS_WIDE = true) but its BlockBehaviour.Properties lacks .noOcclusion(), which
can cause face-culling issues; update the register call for "farmers_workbench"
(the FARMERS_WORKBENCH_BLOCK constant) to include .noOcclusion() in the
BlockBehaviour.Properties chain (matching how FURNACE_WORKBENCH_BLOCK_T1/T2 are
configured) so the wide model renders correctly.
🤖 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/WorkbenchRecipes.java`:
- Line 36: Remove the stale TODO comment "// TODO: FarmersWorkbench Not
Implemented" in WorkbenchRecipes (around the FarmersWorkbench recipe block)
since the FarmersWorkbench recipe is already implemented and saved in the
subsequent lines (the FarmersWorkbench recipe creation and save calls); simply
delete the misleading comment so the code/comments reflect the current
implementation.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/FarmersWorkbenchMenu.java`:
- Around line 91-93: Remove the debug System.out.println in FarmersWorkbenchMenu
where it logs nearbyItems size (inside the if checking nearbyItems.isEmpty() and
playerInventory.player.level().isClientSide()); either delete the statement
entirely or replace it with the project's logger at an appropriate level (e.g.,
LOGGER.debug or LOGGER.trace) so production logs aren’t polluted—ensure you
reference the class FarmersWorkbenchMenu and the nearbyItems check when making
the change.

In `@src/main/java/com/tcm/MineTale/MineTale.java`:
- Line 22: Remove the unused import of FarmersWorkbenchMenu from MineTale.java:
since the file now uses AbstractWorkbenchContainerMenu for all instanceof checks
and casting, delete the import statement for
com.tcm.MineTale.block.workbenches.menu.FarmersWorkbenchMenu to clean up unused
imports and avoid warnings.

---

Outside diff comments:
In `@src/main/java/com/tcm/MineTale/registry/ModRecipes.java`:
- Around line 40-44: The Javadoc in ModRecipes is out of date: it only lists
FURNACE_T1_TYPE, CAMPFIRE_TYPE and WORKBENCH_TYPE but omits the newly added
ARMORERS_TYPE and FARMERS_TYPE; update the class-level/method Javadoc to mention
ARMORERS_TYPE and FARMERS_TYPE alongside the existing FURNACE_T1_TYPE,
CAMPFIRE_TYPE and WORKBENCH_TYPE and note their corresponding serializers so the
documentation accurately reflects the registered recipe types in ModRecipes.

---

Nitpick comments:
In
`@src/client/java/com/tcm/MineTale/block/workbenches/screen/FarmersWorkbenchScreen.java`:
- Around line 251-283: Remove the temporary debug System.out.println calls in
the hasIngredientAmount method of FarmersWorkbenchScreen (the prints that start
with "DEBUG:"). Keep the logic intact (iterating inventory, aggregating counts,
iterating workbenchMenu.getNetworkedNearbyItems(), and returning based on found
vs totalRequired); simply delete the println lines (or replace them with calls
to the project's logger at an appropriate log level if you prefer structured
logging) so no stdout debugging remains in production.
- Around line 132-148: In handleCraftRequest, remove the System.out.println
debug calls (both the "Persistent Selection Success" and "Request failed"
prints) and replace them with proper logging using the project's logger (e.g.,
use a static LOGGER at class scope and call LOGGER.debug(...) for the success
path and LOGGER.warn(...) or LOGGER.info(...) for failure), keeping the behavior
of ClientPlayNetworking.send(new CraftRequestPayload(results.get(0), amount))
and the null/empty checks around lastKnownSelectedId,
ClientRecipeBookAccessor.getKnown(), and resultItems unchanged; add any
necessary logger import/field (e.g., private static final Logger LOGGER) if not
present.

In
`@src/client/java/com/tcm/MineTale/block/workbenches/screen/WorkbenchWorkbenchScreen.java`:
- Around line 132-148: Replace the System.out.println debug prints in
handleCraftRequest with a proper logger: add a private static final
org.slf4j.Logger LOGGER =
org.slf4j.LoggerFactory.getLogger(WorkbenchWorkbenchScreen.class) at the class
level, then change the two System.out.println calls inside handleCraftRequest
(the "Persistent Selection Success: " log and the "Request failed: No recipe was
ever selected!" log) to appropriate LOGGER calls (e.g., LOGGER.debug for the
success message including the ItemStack, and LOGGER.warn or LOGGER.debug for the
failure). Keep all existing logic that reads lastKnownSelectedId, accesses
ClientRecipeBook via ClientRecipeBookAccessor, and sends the CraftRequestPayload
via ClientPlayNetworking unchanged.
- Around line 169-184: Update the misnumbered inline comment: change the
duplicate "// 2. Button Activation Logic" to "// 4. Button Activation Logic" to
reflect the correct sequence after "// 3." in the block surrounding
this.mineTaleRecipeBook, lastKnownSelectedId and selectedEntry (references:
RecipeDisplayId, lastKnownSelectedId, ClientRecipeBook/ClientRecipeBookAccessor,
RecipeDisplayEntry).

In `@src/client/java/com/tcm/MineTale/datagen/recipes/FarmerRecipes.java`:
- Around line 74-468: The file contains many repeated WorkbenchRecipeBuilder
calls in FarmerRecipes; extract a helper (e.g., buildSimpleFarmerRecipe) in the
FarmerRecipes class that accepts parameters (exporter, provider, input (Block or
TagKey/ItemTag with lookup), inputCount, output Block, recipeName) and
internally constructs the WorkbenchRecipeBuilder, applies the common
.input(ModItems.PLANT_FIBER, 2), .time(2), .unlockedBy("has_farmers_workbench",
provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK)),
.bookCategory(ModRecipeDisplay.FARMERS_SEARCH) and .save(exporter, name), and
update each duplicated recipe call sites to invoke this helper instead of
repeating the builder code.

In `@src/main/java/com/tcm/MineTale/block/workbenches/FarmersWorkbench.java`:
- Line 24: Remove the stray comment "// ChestBlock" from the
FarmersWorkbench.java file; locate the comment near the top of the
FarmersWorkbench class (class name FarmersWorkbench) and delete that orphaned
line so the file no longer contains the leftover note.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/ArmorersWorkbenchMenu.java`:
- Around line 91-93: Remove the System.out.println debug line in
ArmorersWorkbenchMenu (the block checking nearbyItems and
playerInventory.player.level().isClientSide()) and either delete it or replace
it with a proper logger call (e.g., MineTale.LOGGER.debug(...)) so production
logging is used instead of stdout; keep the same conditional and message content
when converting to MineTale.LOGGER.debug to preserve debug information about
nearbyItems.size().

In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/FarmersWorkbenchMenu.java`:
- Around line 35-36: The client-side FarmersWorkbenchMenu constructor is
creating the synced data with new SimpleContainerData(EMPTY_SIZE) which
semantically should use DATA_SIZE; update the call in the
FarmersWorkbenchMenu(int syncId, Inventory playerInventory) constructor to use
new SimpleContainerData(DATA_SIZE) instead of EMPTY_SIZE so the menu's synced
data size matches the DATA_SIZE constant (verify the other FarmersWorkbenchMenu
constructor that accepts a ContainerData param continues to accept and use that
data).

In `@src/main/java/com/tcm/MineTale/registry/ModBlocks.java`:
- Around line 112-175: Several decorative blocks (e.g., VINE, LIANA, WALL_IVY,
IVY, RED_HANGING_MOSS, BLUE_HANGING_MOSS, GREEN_MOSS_RUG, BLUE_MOSS_RUG,
SHORT_MOSS, SHORT_RED_MOSS, etc.) are registered with Block::new but need
specialized block classes to exhibit correct vanilla behaviors; update the
register calls in ModBlocks to use appropriate subclasses (e.g., VineBlock or
MultifaceBlock for VINE/IVY/WALL_IVY, a hanging/ceiling-attached block class for
RED_HANGING_MOSS/BLUE_HANGING_MOSS, CarpetBlock for *_RUG entries, and
BushBlock/TallPlantBlock/BushBlock-derived types for SHORT_* plants) and adjust
their BlockBehaviour.Properties as required, keeping the same register(...)
invocation pattern so other registration plumbing remains unchanged.
- Around line 79-84: The block FARMERS_WORKBENCH_BLOCK is a wide block (see
FarmersWorkbench and its IS_WIDE = true) but its BlockBehaviour.Properties lacks
.noOcclusion(), which can cause face-culling issues; update the register call
for "farmers_workbench" (the FARMERS_WORKBENCH_BLOCK constant) to include
.noOcclusion() in the BlockBehaviour.Properties chain (matching how
FURNACE_WORKBENCH_BLOCK_T1/T2 are configured) so the wide model renders
correctly.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1d06564 and f42074a.

📒 Files selected for processing (21)
  • src/client/java/com/tcm/MineTale/MineTaleClient.java
  • src/client/java/com/tcm/MineTale/block/workbenches/screen/ArmorersWorkbenchScreen.java
  • src/client/java/com/tcm/MineTale/block/workbenches/screen/FarmersWorkbenchScreen.java
  • src/client/java/com/tcm/MineTale/block/workbenches/screen/WorkbenchWorkbenchScreen.java
  • src/client/java/com/tcm/MineTale/datagen/recipes/FarmerRecipes.java
  • src/client/java/com/tcm/MineTale/datagen/recipes/WorkbenchRecipes.java
  • src/main/java/com/tcm/MineTale/MineTale.java
  • src/main/java/com/tcm/MineTale/block/workbenches/FarmersWorkbench.java
  • src/main/java/com/tcm/MineTale/block/workbenches/entity/FarmersWorkbenchEntity.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/AbstractWorkbenchContainerMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/ArmorersWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/CampfireWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/FarmersWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/FurnaceWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/WorkbenchWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/registry/ModBlockEntities.java
  • src/main/java/com/tcm/MineTale/registry/ModBlocks.java
  • src/main/java/com/tcm/MineTale/registry/ModItems.java
  • src/main/java/com/tcm/MineTale/registry/ModMenuTypes.java
  • src/main/java/com/tcm/MineTale/registry/ModRecipeDisplay.java
  • src/main/java/com/tcm/MineTale/registry/ModRecipes.java
💤 Files with no reviewable changes (2)
  • src/main/java/com/tcm/MineTale/registry/ModItems.java
  • src/client/java/com/tcm/MineTale/block/workbenches/screen/ArmorersWorkbenchScreen.java

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: 3

♻️ Duplicate comments (2)
src/client/java/com/tcm/MineTale/datagen/recipes/WorkbenchRecipes.java (1)

47-55: ⚠️ Potential issue | 🟡 Minor

Remove stale TODO above the implemented Farmers recipe.

Line 47 says FarmersWorkbench is not implemented, but Lines 48-55 already define and save that recipe. This is now misleading.

✏️ Suggested cleanup
-        // TODO: FarmersWorkbench Not Implemented
🤖 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/WorkbenchRecipes.java`
around lines 47 - 55, Remove the stale TODO comment "// TODO: FarmersWorkbench
Not Implemented" that sits immediately above the implemented Farmers recipe in
WorkbenchRecipes; keep the existing WorkbenchRecipeBuilder block (the calls
using ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER, .input(...),
.output(ModBlocks.FARMERS_WORKBENCH_BLOCK), .time(3), .unlockedBy(...),
.bookCategory(...), .save(...)) unchanged so the recipe remains intact and the
misleading TODO is eliminated.
src/main/java/com/tcm/MineTale/block/workbenches/menu/FarmersWorkbenchMenu.java (1)

98-100: ⚠️ Potential issue | 🟡 Minor

Remove the debug console print before merge.

Line 99 still writes directly to stdout during client-side recipe-book updates; this should be removed or replaced with the project logger at debug/trace level.

Suggested fix
-        if (!nearbyItems.isEmpty() && this.playerInventory.player.level().isClientSide()) {
-            System.out.println("DEBUG: Recipe Book is now accounting for " + nearbyItems.size() + " stacks from the packet!");
-        }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/FarmersWorkbenchMenu.java`
around lines 98 - 100, Remove the stray stdout debug print in
FarmersWorkbenchMenu (the System.out.println call that logs nearbyItems.size()
during client-side recipe-book updates); either delete the line or replace it
with the project's logger at debug/trace level (use the existing logger instance
or add one consistent with surrounding classes) so client-side code no longer
writes to System.out but uses structured logging instead.
🧹 Nitpick comments (5)
src/main/java/com/tcm/MineTale/MineTale.java (1)

21-21: Consider removing unused ArmorersWorkbenchMenu import.

With the refactor to use AbstractWorkbenchContainerMenu for all menu handling, the ArmorersWorkbenchMenu import on line 21 also appears unused.

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

In `@src/main/java/com/tcm/MineTale/MineTale.java` at line 21, Remove the unused
import of ArmorersWorkbenchMenu: locate the import statement referencing
ArmorersWorkbenchMenu and delete it since the codebase now uses
AbstractWorkbenchContainerMenu for menu handling; ensure no other references to
ArmorersWorkbenchMenu remain (search for the class name) before committing.
src/main/java/com/tcm/MineTale/block/workbenches/menu/AbstractWorkbenchContainerMenu.java (1)

63-70: Consider adding @Nullable to the return type for consistency.

The recipeType field is annotated @Nullable (line 41), but getRecipeType() doesn't reflect this in its return type. While current concrete implementations always pass non-null types, the annotation mismatch could mislead callers.

♻️ Suggested annotation
-    public RecipeType<WorkbenchRecipe> getRecipeType() {
+    public `@Nullable` RecipeType<WorkbenchRecipe> getRecipeType() {
         return this.recipeType;
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/AbstractWorkbenchContainerMenu.java`
around lines 63 - 70, The getter getRecipeType() should reflect that its backing
field recipeType is nullable by updating the method signature to return a
nullable RecipeType<WorkbenchRecipe> (annotate with `@Nullable`) so callers and
static analysis see the contract; locate the getRecipeType() method and add the
`@Nullable` annotation to its return type (matching the `@Nullable` on the
recipeType field) and ensure imports for the `@Nullable` annotation are present.
src/main/java/com/tcm/MineTale/block/workbenches/menu/ArmorersWorkbenchMenu.java (1)

99-101: Remove or replace debug logging with proper logger.

System.out.println debug statements in production code can cause log pollution. Consider using the mod's logger (MineTale.LOGGER.debug(...)) or removing the statement entirely.

♻️ Suggested fix
         if (!nearbyItems.isEmpty() && this.playerInventory.player.level().isClientSide()) {
-            System.out.println("DEBUG: Recipe Book is now accounting for " + nearbyItems.size() + " stacks from the packet!");
+            // MineTale.LOGGER.debug("Recipe Book accounting for {} stacks from packet", nearbyItems.size());
         }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/ArmorersWorkbenchMenu.java`
around lines 99 - 101, The code in ArmorersWorkbenchMenu uses System.out.println
for debug output when nearbyItems is non-empty on the client; replace this with
the mod logger call to avoid console pollution—use MineTale.LOGGER.debug(...)
(or remove the statement) and include the same contextual message (e.g.,
nearbyItems.size()) so the check around nearbyItems and
playerInventory.player.level().isClientSide() remains unchanged but the println
is swapped for MineTale.LOGGER.debug or removed entirely.
src/client/java/com/tcm/MineTale/datagen/recipes/FarmerRecipes.java (1)

85-272: Consider extracting a helper for repetitive moss recipes.

The moss-variant recipes (lines 85-272) share identical structure: 4 moss input + 2 plant fiber → output, time 2, same unlock and category. While functional, a helper method could reduce duplication.

♻️ Optional helper pattern
private static void mossRecipe(RecipeProvider provider, RecipeOutput exporter, Block inputMoss, Block output, String name) {
    new WorkbenchRecipeBuilder(ModRecipes.FARMERS_TYPE, ModRecipes.FARMERS_SERIALIZER)
        .input(inputMoss, 4)
        .input(ModItems.PLANT_FIBER, 2)
        .output(output)
        .time(2)
        .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK))
        .bookCategory(ModRecipeDisplay.FARMERS_SEARCH)
        .save(exporter, name);
}
🤖 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/FarmerRecipes.java` around
lines 85 - 272, Many moss recipes repeat the same WorkbenchRecipeBuilder
pattern; extract a helper (e.g., mossRecipe) that accepts the RecipeProvider
(provider), RecipeOutput/exporter, input Block, output Block and recipe name and
inside creates the WorkbenchRecipeBuilder with .input(inputMoss, 4),
.input(ModItems.PLANT_FIBER, 2), .output(output), .time(2),
.unlockedBy("has_farmers_workbench",
provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK)) and
.bookCategory(ModRecipeDisplay.FARMERS_SEARCH) then .save(exporter, name);
replace each repeated WorkbenchRecipeBuilder block with a call to
mossRecipe(provider, exporter, ModBlocks.*_MOSS, ModBlocks.*_OUTPUT, "name") to
remove duplication while keeping the same behavior.
src/client/java/com/tcm/MineTale/block/workbenches/screen/ArmorersWorkbenchScreen.java (1)

139-145: Replace debug logging with proper logger or remove.

Multiple System.out.println debug statements here and throughout the class (lines 250, 269, 275, 279) should use the mod's logger for consistency and to allow log-level filtering.

♻️ Suggested approach
-                    System.out.println("Persistent Selection Success: " + results.get(0));
+                    MineTale.LOGGER.debug("Persistent Selection Success: {}", results.get(0));
                     ClientPlayNetworking.send(new CraftRequestPayload(results.get(0), amount));
                     return;
                 }
             }
         }
-        System.out.println("Request failed: No recipe was ever selected!");
+        MineTale.LOGGER.debug("Request failed: No recipe was ever selected!");
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/client/java/com/tcm/MineTale/block/workbenches/screen/ArmorersWorkbenchScreen.java`
around lines 139 - 145, Replace the System.out.println debug prints in
ArmorersWorkbenchScreen (the ones around the persistent selection handling that
log "Persistent Selection Success" and "Request failed: No recipe was ever
selected!" as well as any other System.out.println occurrences in this class)
with the mod's logger calls (e.g., MineTale.LOGGER or your project's LOGGER)
using an appropriate level (info/debug/warn) and include contextual data such as
results.get(0) and amount in the message; ensure you update all prints in this
class (including the other occurrences near the ClientPlayNetworking.send /
CraftRequestPayload logic) for consistent log-level filtering or remove them if
they are unnecessary.
🤖 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/block/workbenches/screen/WorkbenchWorkbenchScreen.java`:
- Around line 132-135: The code dereferences this.minecraft and
this.minecraft.player (and similarly in the block around the RecipeDisplayEntry
usage) without null checks, which can NPE during world unload/disconnect; before
using this.minecraft, this.minecraft.player, or this.minecraft.level and before
accessing this.lastKnownSelectedId to read the
ClientRecipeBook/getKnown().get(...), add defensive null checks (e.g., if
(this.minecraft == null || this.minecraft.player == null || this.minecraft.level
== null || this.lastKnownSelectedId == null) return; or skip the lookup) so the
ClientRecipeBookAccessor/getKnown().get(this.lastKnownSelectedId) and any
subsequent use of RecipeDisplayEntry are only executed when the client and
player-level are valid.
- Around line 137-147: The code leaves lastKnownSelectedId stale when the
persistent selection lookup fails, causing subsequent craft attempts to always
fail; in the failure branch inside the crafting request method in
WorkbenchWorkbenchScreen (the block that checks if (entry != null) ... else
fallback), reset the remembered selection (e.g., set lastKnownSelectedId to null
or its sentinel value, or call any existing
clearSelection/clearLastKnownSelection helper) before logging "Request failed"
so a stale ID isn't reused on future clicks. Ensure you reference and update the
exact field name lastKnownSelectedId (or the corresponding selection field) in
that method.

In `@src/main/java/com/tcm/MineTale/block/workbenches/FarmersWorkbench.java`:
- Around line 87-97: Update the Javadoc for getShape to accurately describe that
SHAPE represents the collision shape of a single block (16×16×16) while the
workbench is configured as a multi-block when IS_WIDE = true; mention that the
overall 1×2 footprint is managed by AbstractWorkbench via the TYPE property
(LEFT/RIGHT) and neighbor validation, so the comment should not claim a "1×1
footprint" but instead clarify per-block shape vs. multi-block layout.

---

Duplicate comments:
In `@src/client/java/com/tcm/MineTale/datagen/recipes/WorkbenchRecipes.java`:
- Around line 47-55: Remove the stale TODO comment "// TODO: FarmersWorkbench
Not Implemented" that sits immediately above the implemented Farmers recipe in
WorkbenchRecipes; keep the existing WorkbenchRecipeBuilder block (the calls
using ModRecipes.WORKBENCH_TYPE, ModRecipes.WORKBENCH_SERIALIZER, .input(...),
.output(ModBlocks.FARMERS_WORKBENCH_BLOCK), .time(3), .unlockedBy(...),
.bookCategory(...), .save(...)) unchanged so the recipe remains intact and the
misleading TODO is eliminated.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/FarmersWorkbenchMenu.java`:
- Around line 98-100: Remove the stray stdout debug print in
FarmersWorkbenchMenu (the System.out.println call that logs nearbyItems.size()
during client-side recipe-book updates); either delete the line or replace it
with the project's logger at debug/trace level (use the existing logger instance
or add one consistent with surrounding classes) so client-side code no longer
writes to System.out but uses structured logging instead.

---

Nitpick comments:
In
`@src/client/java/com/tcm/MineTale/block/workbenches/screen/ArmorersWorkbenchScreen.java`:
- Around line 139-145: Replace the System.out.println debug prints in
ArmorersWorkbenchScreen (the ones around the persistent selection handling that
log "Persistent Selection Success" and "Request failed: No recipe was ever
selected!" as well as any other System.out.println occurrences in this class)
with the mod's logger calls (e.g., MineTale.LOGGER or your project's LOGGER)
using an appropriate level (info/debug/warn) and include contextual data such as
results.get(0) and amount in the message; ensure you update all prints in this
class (including the other occurrences near the ClientPlayNetworking.send /
CraftRequestPayload logic) for consistent log-level filtering or remove them if
they are unnecessary.

In `@src/client/java/com/tcm/MineTale/datagen/recipes/FarmerRecipes.java`:
- Around line 85-272: Many moss recipes repeat the same WorkbenchRecipeBuilder
pattern; extract a helper (e.g., mossRecipe) that accepts the RecipeProvider
(provider), RecipeOutput/exporter, input Block, output Block and recipe name and
inside creates the WorkbenchRecipeBuilder with .input(inputMoss, 4),
.input(ModItems.PLANT_FIBER, 2), .output(output), .time(2),
.unlockedBy("has_farmers_workbench",
provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK)) and
.bookCategory(ModRecipeDisplay.FARMERS_SEARCH) then .save(exporter, name);
replace each repeated WorkbenchRecipeBuilder block with a call to
mossRecipe(provider, exporter, ModBlocks.*_MOSS, ModBlocks.*_OUTPUT, "name") to
remove duplication while keeping the same behavior.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/AbstractWorkbenchContainerMenu.java`:
- Around line 63-70: The getter getRecipeType() should reflect that its backing
field recipeType is nullable by updating the method signature to return a
nullable RecipeType<WorkbenchRecipe> (annotate with `@Nullable`) so callers and
static analysis see the contract; locate the getRecipeType() method and add the
`@Nullable` annotation to its return type (matching the `@Nullable` on the
recipeType field) and ensure imports for the `@Nullable` annotation are present.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/ArmorersWorkbenchMenu.java`:
- Around line 99-101: The code in ArmorersWorkbenchMenu uses System.out.println
for debug output when nearbyItems is non-empty on the client; replace this with
the mod logger call to avoid console pollution—use MineTale.LOGGER.debug(...)
(or remove the statement) and include the same contextual message (e.g.,
nearbyItems.size()) so the check around nearbyItems and
playerInventory.player.level().isClientSide() remains unchanged but the println
is swapped for MineTale.LOGGER.debug or removed entirely.

In `@src/main/java/com/tcm/MineTale/MineTale.java`:
- Line 21: Remove the unused import of ArmorersWorkbenchMenu: locate the import
statement referencing ArmorersWorkbenchMenu and delete it since the codebase now
uses AbstractWorkbenchContainerMenu for menu handling; ensure no other
references to ArmorersWorkbenchMenu remain (search for the class name) before
committing.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f42074a and 98f12fa.

📒 Files selected for processing (16)
  • src/client/java/com/tcm/MineTale/MineTaleClient.java
  • src/client/java/com/tcm/MineTale/block/workbenches/screen/ArmorersWorkbenchScreen.java
  • src/client/java/com/tcm/MineTale/block/workbenches/screen/FarmersWorkbenchScreen.java
  • src/client/java/com/tcm/MineTale/block/workbenches/screen/WorkbenchWorkbenchScreen.java
  • src/client/java/com/tcm/MineTale/datagen/recipes/FarmerRecipes.java
  • src/client/java/com/tcm/MineTale/datagen/recipes/WorkbenchRecipes.java
  • src/main/java/com/tcm/MineTale/MineTale.java
  • src/main/java/com/tcm/MineTale/block/workbenches/FarmersWorkbench.java
  • src/main/java/com/tcm/MineTale/block/workbenches/entity/FarmersWorkbenchEntity.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/AbstractWorkbenchContainerMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/ArmorersWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/CampfireWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/FarmersWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/FurnaceWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/WorkbenchWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/registry/ModRecipes.java
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/CampfireWorkbenchMenu.java
  • src/client/java/com/tcm/MineTale/block/workbenches/screen/FarmersWorkbenchScreen.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/WorkbenchWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/registry/ModRecipes.java

@coderabbitai coderabbitai bot requested a review from AnyaPizza February 26, 2026 08:18
@coderabbitai coderabbitai bot added the enhancement New feature or request label Feb 26, 2026
@The-Code-Monkey The-Code-Monkey changed the title stuff Add Most Farmers Workbench Recipies Feb 26, 2026
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 (2)
src/main/java/com/tcm/MineTale/block/workbenches/menu/WorkbenchWorkbenchMenu.java (1)

101-103: ⚠️ Potential issue | 🟡 Minor

Remove console debug logging from recipe-content refresh path.

Line 102 logs during recipe book refreshes, which can create noisy logs during normal UI usage.

Suggested cleanup
-        if (!nearbyItems.isEmpty() && this.playerInventory.player.level().isClientSide()) {
-            System.out.println("DEBUG: Recipe Book is now accounting for " + nearbyItems.size() + " stacks from the packet!");
-        }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/WorkbenchWorkbenchMenu.java`
around lines 101 - 103, In WorkbenchWorkbenchMenu, remove the temporary
System.out.println(...) used in the recipe-content refresh path (the block
checking nearbyItems and this.playerInventory.player.level().isClientSide());
either delete the println entirely or replace it with a proper debug-level
logger call (e.g. LOGGER.debug(...)) if you need traceability, ensuring no
console System.out output remains during normal UI refreshes.
src/main/java/com/tcm/MineTale/block/workbenches/menu/ArmorersWorkbenchMenu.java (1)

99-101: ⚠️ Potential issue | 🟡 Minor

Drop client console debug print from recipe content accounting.

Line 100 writes to stdout during UI refresh cycles and should be removed (or moved behind structured debug logging).

Suggested cleanup
-        if (!nearbyItems.isEmpty() && this.playerInventory.player.level().isClientSide()) {
-            System.out.println("DEBUG: Recipe Book is now accounting for " + nearbyItems.size() + " stacks from the packet!");
-        }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/ArmorersWorkbenchMenu.java`
around lines 99 - 101, Remove the System.out.println debug print in
ArmorersWorkbenchMenu (the block that checks nearbyItems.isEmpty() and
playerInventory.player.level().isClientSide()); either delete the line entirely
or replace it with a structured logger call (e.g., LOGGER.debug(...)) guarded by
the logger's debug/isEnabled check and include contextual info
(nearbyItems.size()) so debug output is not printed to stdout during UI refresh
cycles.
♻️ Duplicate comments (4)
src/client/java/com/tcm/MineTale/block/workbenches/screen/WorkbenchWorkbenchScreen.java (2)

146-146: ⚠️ Potential issue | 🟡 Minor

Clear stale remembered selection when lookup/send fails.

When lookup fails once, lastKnownSelectedId remains stale and repeated clicks keep failing until reselection.

Suggested fix
-    System.out.println("Request failed: No recipe was ever selected!");
+    this.lastKnownSelectedId = null;
+    System.out.println("Request failed: No recipe was ever selected!");
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/client/java/com/tcm/MineTale/block/workbenches/screen/WorkbenchWorkbenchScreen.java`
at line 146, The failure path that currently just prints "Request failed: No
recipe was ever selected!" should also clear the stale selection so subsequent
clicks can retry: inside the failure handling in WorkbenchWorkbenchScreen (where
the println is called), set lastKnownSelectedId to null (or an appropriate
sentinel) and update any UI selection state (e.g.,
selectedRecipeIndex/selectedRecipe) as needed, then log the failure via the
existing logger instead of System.out; this ensures lookup/send failures reset
lastKnownSelectedId and allow fresh selections to succeed.

131-135: ⚠️ Potential issue | 🔴 Critical

Guard client/player/level before dereferencing recipe-book state.

Line 134 and Line 187 can still NPE during transient client state changes (disconnect/world unload). Add a single early guard before recipe-book access in both paths.

Suggested fix
 private void handleCraftRequest(int amount) {
-    // Look at our "Memory" instead of the component
-    if (this.lastKnownSelectedId != null) {
+    if (this.minecraft == null || this.minecraft.player == null || this.minecraft.level == null || this.lastKnownSelectedId == null) {
+        return;
+    }
+    // Look at our "Memory" instead of the component
+    if (this.lastKnownSelectedId != null) {
         ClientRecipeBook book = this.minecraft.player.getRecipeBook();
         RecipeDisplayEntry entry = ((ClientRecipeBookAccessor) book).getKnown().get(this.lastKnownSelectedId);
@@
-    if (this.lastKnownSelectedId != null && this.minecraft.level != null) {
+    if (this.lastKnownSelectedId != null
+        && this.minecraft != null
+        && this.minecraft.player != null
+        && this.minecraft.level != null) {
         ClientRecipeBook book = this.minecraft.player.getRecipeBook();
         selectedEntry = ((ClientRecipeBookAccessor) book).getKnown().get(this.lastKnownSelectedId);
     }

Also applies to: 186-188

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

In
`@src/client/java/com/tcm/MineTale/block/workbenches/screen/WorkbenchWorkbenchScreen.java`
around lines 131 - 135, Add a null-check guard for the client/player/level
before any recipe-book dereference: in handleCraftRequest, before using
this.lastKnownSelectedId and calling this.minecraft.player.getRecipeBook(),
verify this.minecraft != null && this.minecraft.player != null &&
this.minecraft.player.getRecipeBook() != null (and optionally
this.minecraft.level != null if other logic relies on world state); return early
if any are null. Apply the same single-early-guard pattern to the other code
path in this class that accesses this.minecraft.player.getRecipeBook() (the
branch around the other RecipeDisplayEntry access) so both places avoid NPEs
during disconnect/world-unload transitions.
src/client/java/com/tcm/MineTale/datagen/recipes/WorkbenchRecipes.java (1)

47-47: ⚠️ Potential issue | 🟡 Minor

Remove stale TODO above implemented Farmers recipe.

Line 47 says Farmers workbench is not implemented, but Lines 48-55 already build and save that recipe.

Suggested cleanup
-        // TODO: FarmersWorkbench Not Implemented
🤖 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/WorkbenchRecipes.java` at
line 47, Remove the stale TODO comment "// TODO: FarmersWorkbench Not
Implemented" from the WorkbenchRecipes class (the FarmersWorkbench recipe
builder block) because the Farmers workbench recipe is already constructed and
saved in the adjacent code; locate the FarmersWorkbench-related recipe creation
code in WorkbenchRecipes and delete the TODO line so comments reflect current
implementation.
src/main/java/com/tcm/MineTale/block/workbenches/menu/FarmersWorkbenchMenu.java (1)

98-100: ⚠️ Potential issue | 🟡 Minor

Remove debug print from recipe refresh path.

Line 99 still logs nearby packet stack counts via System.out.println, which is noisy during normal UI use.

Suggested cleanup
-        if (!nearbyItems.isEmpty() && this.playerInventory.player.level().isClientSide()) {
-            System.out.println("DEBUG: Recipe Book is now accounting for " + nearbyItems.size() + " stacks from the packet!");
-        }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/FarmersWorkbenchMenu.java`
around lines 98 - 100, Remove the noisy debug print in FarmersWorkbenchMenu:
delete the System.out.println call that logs nearbyItems.size() inside the
recipe refresh path (the block checking nearbyItems.isEmpty() and
this.playerInventory.player.level().isClientSide()). If you prefer retaining
diagnostics, replace it with a proper logger call (e.g., LOGGER.debug(...))
guarded by an appropriate debug-level check; otherwise simply remove the println
statement.
🧹 Nitpick comments (7)
src/client/java/com/tcm/MineTale/datagen/recipes/FarmerRecipes.java (1)

74-479: Extract a helper for repeated recipe boilerplate.

This section repeats the same builder tail (time/unlockedBy/bookCategory/save) many times. A helper will reduce drift and typo risk as this list grows.

Refactor sketch
+    private static WorkbenchRecipeBuilder farmersBase(RecipeProvider provider) {
+        return new WorkbenchRecipeBuilder(ModRecipes.FARMERS_TYPE, ModRecipes.FARMERS_SERIALIZER)
+            .time(2)
+            .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK))
+            .bookCategory(ModRecipeDisplay.FARMERS_SEARCH);
+    }
+
     public static void buildRecipes(RecipeProvider provider, RecipeOutput exporter, HolderLookup.Provider lookup) {
-        new WorkbenchRecipeBuilder(ModRecipes.FARMERS_TYPE, ModRecipes.FARMERS_SERIALIZER)
+        farmersBase(provider)
             .input(ModItems.PLANT_FIBER, 20)
             .input(ItemTags.DIRT, lookup, 2)
             .input(ModItems.ESSENCE_OF_LIFE, 10)
             .input(ModBlocks.BAMBOO_LOG)
             .output(ModBlocks.BAMBOO_PLANTER)
-            .time(2)
-            .unlockedBy("has_farmers_workbench", provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK))
-            .bookCategory(ModRecipeDisplay.FARMERS_SEARCH)
             .save(exporter, "bamboo_planter");
🤖 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/FarmerRecipes.java` around
lines 74 - 479, Many recipes repeat the same tail calls
(time(2).unlockedBy("has_farmers_workbench",
provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK)).bookCategory(ModRecipeDisplay.FARMERS_SEARCH).save(exporter,
name)); extract a small helper method (e.g., finalizeFarmersRecipe or
saveFarmersRecipe) that accepts a WorkbenchRecipeBuilder and the recipe name
(and exporter) and performs those four calls so each recipe creation becomes new
WorkbenchRecipeBuilder(...).input(...).output(...).time/... replaced with
builder passed to finalizeFarmersRecipe(builder, exporter, "id"); update all
usages to call that helper and keep unique symbols WorkbenchRecipeBuilder,
provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK), ModRecipeDisplay.FARMERS_SEARCH
and save(exporter, name) intact.
src/main/java/com/tcm/MineTale/block/workbenches/FarmersWorkbench.java (1)

24-24: Remove orphaned comment.

The comment // ChestBlock appears to be a leftover note that doesn't describe anything in the current context. Consider removing it.

🧹 Proposed fix
-// ChestBlock
-
 public class FarmersWorkbench extends AbstractWorkbench<FarmersWorkbenchEntity> {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/com/tcm/MineTale/block/workbenches/FarmersWorkbench.java` at
line 24, Remove the orphaned inline comment "// ChestBlock" from the
FarmersWorkbench.java file; locate it in the FarmersWorkbench class (search for
the exact comment text) and delete that leftover line so the class/comment no
longer contains an irrelevant note.
src/main/java/com/tcm/MineTale/block/workbenches/entity/FarmersWorkbenchEntity.java (2)

143-144: Fix double comment prefix.

Line 143 has // // which appears to be accidental.

🧹 Proposed fix
-        // // 2. Return the menu as usual
+        // 2. Return the menu as usual
         return new FarmersWorkbenchMenu(syncId, playerInventory, this.data, this);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/entity/FarmersWorkbenchEntity.java`
around lines 143 - 144, The return statement in FarmersWorkbenchEntity currently
has a double comment prefix ("// //") on the preceding line; remove the extra
slash so the comment is a single-line comment or delete the stray commented line
entirely around the return of new FarmersWorkbenchMenu(syncId, playerInventory,
this.data, this); in the FarmersWorkbenchEntity class to clean up the accidental
double-comment.

165-175: Remove commented-out code or add TODO explaining intent.

The commented-out LIT state check (lines 168-170) appears to be leftover from development. Either remove it or add a TODO comment explaining the planned future behavior.

🧹 Proposed cleanup
     `@Override`
     protected boolean hasFuel() {
         if (this.level == null) return false;
-        
-        // Check if block is lit
-        // BlockState state = this.level.getBlockState(this.worldPosition);
-        // boolean isLit = state.hasProperty(BlockStateProperties.LIT) && state.getValue(BlockStateProperties.LIT);
-        
+
         boolean hasFuelItem = !this.getItem(Constants.FUEL_SLOT).isEmpty();
-        
         return hasFuelItem;
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/entity/FarmersWorkbenchEntity.java`
around lines 165 - 175, The hasFuel() method contains commented-out code
checking a BlockState LIT property; remove those commented lines or replace them
with a concise TODO explaining intended future behavior (e.g., "TODO: consider
BlockState LIT check when integrating lighting-based fuel logic") so the purpose
is clear; update the method surrounding symbols hasFuel(), this.level,
this.worldPosition, and Constants.FUEL_SLOT/getItem(...) accordingly and keep
only active code that returns hasFuelItem.
src/client/java/com/tcm/MineTale/block/workbenches/screen/FarmersWorkbenchScreen.java (3)

141-148: Remove debug print statements before release.

System.out.println calls at lines 141, 147 (and similarly in hasIngredientAmount at lines 272, 291, 297, 301) should be removed or replaced with a proper logging framework with appropriate log levels (e.g., MineTale.LOGGER.debug(...)).

🧹 Example fix for handleCraftRequest
             if (!results.isEmpty()) {
-                    System.out.println("Persistent Selection Success: " + results.get(0));
                     ClientPlayNetworking.send(new CraftRequestPayload(results.get(0), amount));
                     return;
                 }
             }
         }
-        System.out.println("Request failed: No recipe was ever selected!");
+        MineTale.LOGGER.debug("Craft request failed: No recipe selected");
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/client/java/com/tcm/MineTale/block/workbenches/screen/FarmersWorkbenchScreen.java`
around lines 141 - 148, Remove or replace direct System.out.println calls in
FarmersWorkbenchScreen (e.g., inside handleCraftRequest and hasIngredientAmount)
with the project's logger at an appropriate log level; specifically, replace the
printlns (the "Persistent Selection Success..." and "Request failed..." messages
and the debug prints in hasIngredientAmount) with MineTale.LOGGER.debug(...) or
remove them if not needed, ensuring you import or reference MineTale.LOGGER
consistently and keep the original message text/context in the debug calls.

177-193: Fix inconsistent step numbering in comments.

The comments use "1.", "2.", "3.", then "2." again at line 192. This appears to be a copy-paste oversight.

🧹 Proposed fix
         // 2. If it's NOT null, remember it!
         if (currentId != null) {
             this.lastKnownSelectedId = currentId;
         }

         // 3. Use the remembered ID to find the entry for button activation
         RecipeDisplayEntry selectedEntry = null;
         if (this.lastKnownSelectedId != null && this.minecraft.level != null) {
             ClientRecipeBook book = this.minecraft.player.getRecipeBook();
             selectedEntry = ((ClientRecipeBookAccessor) book).getKnown().get(this.lastKnownSelectedId);
         }

-        // 2. Button Activation Logic
+        // 4. Button Activation Logic
         if (selectedEntry != null) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/client/java/com/tcm/MineTale/block/workbenches/screen/FarmersWorkbenchScreen.java`
around lines 177 - 193, The comment numbering is inconsistent (1., 2., 3., then
2.) around the selection logic; update the inline comments near
getSelectedRecipeId(), lastKnownSelectedId, and selectedEntry to use a
sequential sequence (e.g., 1., 2., 3., 4. or remove numeric prefixes) so the
steps read consistently — specifically change the last "2. Button Activation
Logic" comment to "4. Button Activation Logic" (or a non-numbered header) to
match the earlier "1.", "2.", "3." steps.

226-240: Use ResourceKey<Item> or item registry keys as HashMap keys instead of Holder<Item> instances.

Using List<Holder<Item>> as a HashMap key relies on Holder.Reference.equals(), which uses identity comparison, not structural equality. The comment is misleading—if the registry returns different Holder.Reference instances for the same item (or if Holder.Direct entries appear), map lookups will fail. Per Minecraft's own guidance, prefer extracting the registry key via holder.unwrapKey() or using item IDs/ResourceLocations for stable, content-based equality in map operations.

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

In
`@src/client/java/com/tcm/MineTale/block/workbenches/screen/FarmersWorkbenchScreen.java`
around lines 226 - 240, The Map keys must use stable registry identifiers rather
than Holder identity: change the key construction in the loop that currently
builds List<Holder<Item>> (used by aggregatedRequirements and
holderToIngredient) to a List<ResourceKey<Item>> (or List<ResourceLocation/ID)
by extracting each holder's registry key via holder.unwrapKey().orElseGet(...)
and falling back to a stable identifier for direct holders; then use that
List<ResourceKey<Item>> as the HashMap key everywhere (including lookups in
hasIngredientAmount) so equality/hashCode are content-based and do not depend on
Holder.Reference identity.
🤖 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/main/java/com/tcm/MineTale/block/workbenches/menu/AbstractWorkbenchContainerMenu.java`:
- Around line 41-43: Change the nullable recipeType field in
AbstractWorkbenchContainerMenu to be non-null by contract: remove the `@Nullable`
annotation on the private final RecipeType<WorkbenchRecipe> recipeType, require
a non-null RecipeType parameter in the constructor(s), and validate it on
construction (e.g., Objects.requireNonNull) so the field can never be null;
update any callers/overloads to pass a concrete RecipeType and adjust the code
paths that perform server recipe lookup (the usages around the current lines
68-70 and 90-94) to rely on the guaranteed non-null recipeType rather than
guarding for null.

In `@src/main/java/com/tcm/MineTale/MineTale.java`:
- Around line 89-97: The current guard uses a broad instanceof check against
AbstractWorkbenchContainerMenu (player.containerMenu) which lets unintended
workbench types through; change the boolean isWorkbench to explicitly check for
the two concrete direct-craft container classes that should be allowed (e.g.,
replace the AbstractWorkbenchContainerMenu instanceof test with an instanceof
check for the two specific container classes used for instant direct-craft in
your codebase), and only cast to AbstractWorkbenchContainerMenu
(instanceContainerMenu) after that narrower check passes; use the actual
concrete class names present in the project in place of the placeholder names.

---

Outside diff comments:
In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/ArmorersWorkbenchMenu.java`:
- Around line 99-101: Remove the System.out.println debug print in
ArmorersWorkbenchMenu (the block that checks nearbyItems.isEmpty() and
playerInventory.player.level().isClientSide()); either delete the line entirely
or replace it with a structured logger call (e.g., LOGGER.debug(...)) guarded by
the logger's debug/isEnabled check and include contextual info
(nearbyItems.size()) so debug output is not printed to stdout during UI refresh
cycles.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/WorkbenchWorkbenchMenu.java`:
- Around line 101-103: In WorkbenchWorkbenchMenu, remove the temporary
System.out.println(...) used in the recipe-content refresh path (the block
checking nearbyItems and this.playerInventory.player.level().isClientSide());
either delete the println entirely or replace it with a proper debug-level
logger call (e.g. LOGGER.debug(...)) if you need traceability, ensuring no
console System.out output remains during normal UI refreshes.

---

Duplicate comments:
In
`@src/client/java/com/tcm/MineTale/block/workbenches/screen/WorkbenchWorkbenchScreen.java`:
- Line 146: The failure path that currently just prints "Request failed: No
recipe was ever selected!" should also clear the stale selection so subsequent
clicks can retry: inside the failure handling in WorkbenchWorkbenchScreen (where
the println is called), set lastKnownSelectedId to null (or an appropriate
sentinel) and update any UI selection state (e.g.,
selectedRecipeIndex/selectedRecipe) as needed, then log the failure via the
existing logger instead of System.out; this ensures lookup/send failures reset
lastKnownSelectedId and allow fresh selections to succeed.
- Around line 131-135: Add a null-check guard for the client/player/level before
any recipe-book dereference: in handleCraftRequest, before using
this.lastKnownSelectedId and calling this.minecraft.player.getRecipeBook(),
verify this.minecraft != null && this.minecraft.player != null &&
this.minecraft.player.getRecipeBook() != null (and optionally
this.minecraft.level != null if other logic relies on world state); return early
if any are null. Apply the same single-early-guard pattern to the other code
path in this class that accesses this.minecraft.player.getRecipeBook() (the
branch around the other RecipeDisplayEntry access) so both places avoid NPEs
during disconnect/world-unload transitions.

In `@src/client/java/com/tcm/MineTale/datagen/recipes/WorkbenchRecipes.java`:
- Line 47: Remove the stale TODO comment "// TODO: FarmersWorkbench Not
Implemented" from the WorkbenchRecipes class (the FarmersWorkbench recipe
builder block) because the Farmers workbench recipe is already constructed and
saved in the adjacent code; locate the FarmersWorkbench-related recipe creation
code in WorkbenchRecipes and delete the TODO line so comments reflect current
implementation.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/FarmersWorkbenchMenu.java`:
- Around line 98-100: Remove the noisy debug print in FarmersWorkbenchMenu:
delete the System.out.println call that logs nearbyItems.size() inside the
recipe refresh path (the block checking nearbyItems.isEmpty() and
this.playerInventory.player.level().isClientSide()). If you prefer retaining
diagnostics, replace it with a proper logger call (e.g., LOGGER.debug(...))
guarded by an appropriate debug-level check; otherwise simply remove the println
statement.

---

Nitpick comments:
In
`@src/client/java/com/tcm/MineTale/block/workbenches/screen/FarmersWorkbenchScreen.java`:
- Around line 141-148: Remove or replace direct System.out.println calls in
FarmersWorkbenchScreen (e.g., inside handleCraftRequest and hasIngredientAmount)
with the project's logger at an appropriate log level; specifically, replace the
printlns (the "Persistent Selection Success..." and "Request failed..." messages
and the debug prints in hasIngredientAmount) with MineTale.LOGGER.debug(...) or
remove them if not needed, ensuring you import or reference MineTale.LOGGER
consistently and keep the original message text/context in the debug calls.
- Around line 177-193: The comment numbering is inconsistent (1., 2., 3., then
2.) around the selection logic; update the inline comments near
getSelectedRecipeId(), lastKnownSelectedId, and selectedEntry to use a
sequential sequence (e.g., 1., 2., 3., 4. or remove numeric prefixes) so the
steps read consistently — specifically change the last "2. Button Activation
Logic" comment to "4. Button Activation Logic" (or a non-numbered header) to
match the earlier "1.", "2.", "3." steps.
- Around line 226-240: The Map keys must use stable registry identifiers rather
than Holder identity: change the key construction in the loop that currently
builds List<Holder<Item>> (used by aggregatedRequirements and
holderToIngredient) to a List<ResourceKey<Item>> (or List<ResourceLocation/ID)
by extracting each holder's registry key via holder.unwrapKey().orElseGet(...)
and falling back to a stable identifier for direct holders; then use that
List<ResourceKey<Item>> as the HashMap key everywhere (including lookups in
hasIngredientAmount) so equality/hashCode are content-based and do not depend on
Holder.Reference identity.

In `@src/client/java/com/tcm/MineTale/datagen/recipes/FarmerRecipes.java`:
- Around line 74-479: Many recipes repeat the same tail calls
(time(2).unlockedBy("has_farmers_workbench",
provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK)).bookCategory(ModRecipeDisplay.FARMERS_SEARCH).save(exporter,
name)); extract a small helper method (e.g., finalizeFarmersRecipe or
saveFarmersRecipe) that accepts a WorkbenchRecipeBuilder and the recipe name
(and exporter) and performs those four calls so each recipe creation becomes new
WorkbenchRecipeBuilder(...).input(...).output(...).time/... replaced with
builder passed to finalizeFarmersRecipe(builder, exporter, "id"); update all
usages to call that helper and keep unique symbols WorkbenchRecipeBuilder,
provider.has(ModBlocks.FARMERS_WORKBENCH_BLOCK), ModRecipeDisplay.FARMERS_SEARCH
and save(exporter, name) intact.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/entity/FarmersWorkbenchEntity.java`:
- Around line 143-144: The return statement in FarmersWorkbenchEntity currently
has a double comment prefix ("// //") on the preceding line; remove the extra
slash so the comment is a single-line comment or delete the stray commented line
entirely around the return of new FarmersWorkbenchMenu(syncId, playerInventory,
this.data, this); in the FarmersWorkbenchEntity class to clean up the accidental
double-comment.
- Around line 165-175: The hasFuel() method contains commented-out code checking
a BlockState LIT property; remove those commented lines or replace them with a
concise TODO explaining intended future behavior (e.g., "TODO: consider
BlockState LIT check when integrating lighting-based fuel logic") so the purpose
is clear; update the method surrounding symbols hasFuel(), this.level,
this.worldPosition, and Constants.FUEL_SLOT/getItem(...) accordingly and keep
only active code that returns hasFuelItem.

In `@src/main/java/com/tcm/MineTale/block/workbenches/FarmersWorkbench.java`:
- Line 24: Remove the orphaned inline comment "// ChestBlock" from the
FarmersWorkbench.java file; locate it in the FarmersWorkbench class (search for
the exact comment text) and delete that leftover line so the class/comment no
longer contains an irrelevant note.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1d06564 and 98f12fa.

📒 Files selected for processing (21)
  • src/client/java/com/tcm/MineTale/MineTaleClient.java
  • src/client/java/com/tcm/MineTale/block/workbenches/screen/ArmorersWorkbenchScreen.java
  • src/client/java/com/tcm/MineTale/block/workbenches/screen/FarmersWorkbenchScreen.java
  • src/client/java/com/tcm/MineTale/block/workbenches/screen/WorkbenchWorkbenchScreen.java
  • src/client/java/com/tcm/MineTale/datagen/recipes/FarmerRecipes.java
  • src/client/java/com/tcm/MineTale/datagen/recipes/WorkbenchRecipes.java
  • src/main/java/com/tcm/MineTale/MineTale.java
  • src/main/java/com/tcm/MineTale/block/workbenches/FarmersWorkbench.java
  • src/main/java/com/tcm/MineTale/block/workbenches/entity/FarmersWorkbenchEntity.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/AbstractWorkbenchContainerMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/ArmorersWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/CampfireWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/FarmersWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/FurnaceWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/WorkbenchWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/registry/ModBlockEntities.java
  • src/main/java/com/tcm/MineTale/registry/ModBlocks.java
  • src/main/java/com/tcm/MineTale/registry/ModItems.java
  • src/main/java/com/tcm/MineTale/registry/ModMenuTypes.java
  • src/main/java/com/tcm/MineTale/registry/ModRecipeDisplay.java
  • src/main/java/com/tcm/MineTale/registry/ModRecipes.java
💤 Files with no reviewable changes (1)
  • src/main/java/com/tcm/MineTale/registry/ModItems.java

coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 26, 2026
The-Code-Monkey and others added 2 commits February 26, 2026 08:54
Docstrings generation was requested by @The-Code-Monkey.

The following files were modified:

* `src/client/java/com/tcm/MineTale/MineTaleClient.java`
* `src/client/java/com/tcm/MineTale/block/workbenches/screen/ArmorersWorkbenchScreen.java`
* `src/client/java/com/tcm/MineTale/block/workbenches/screen/FarmersWorkbenchScreen.java`
* `src/client/java/com/tcm/MineTale/block/workbenches/screen/WorkbenchWorkbenchScreen.java`
* `src/main/java/com/tcm/MineTale/MineTale.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/FarmersWorkbench.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/entity/FarmersWorkbenchEntity.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/menu/AbstractWorkbenchContainerMenu.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/menu/ArmorersWorkbenchMenu.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/menu/CampfireWorkbenchMenu.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/menu/FarmersWorkbenchMenu.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/menu/FurnaceWorkbenchMenu.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/menu/WorkbenchWorkbenchMenu.java`

These files were kept as they were:
* `src/client/java/com/tcm/MineTale/datagen/recipes/FarmerRecipes.java`
* `src/client/java/com/tcm/MineTale/datagen/recipes/WorkbenchRecipes.java`
* `src/main/java/com/tcm/MineTale/registry/ModRecipes.java`
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/main/java/com/tcm/MineTale/block/workbenches/menu/WorkbenchWorkbenchMenu.java (1)

98-102: ⚠️ Potential issue | 🟡 Minor

Remove this debug incantation before the code journeys to production, dear fellowship member.

This System.out.println is like leaving the Palantír lying about for anyone to trip over - it clutters the logs and serves no purpose in the final deployment. The Vogons would not approve of such untidiness in production code.

🧹 Proposed fix to banish the debug statement
        List<ItemStack> nearbyItems = this.getNetworkedNearbyItems();
-        
-        if (!nearbyItems.isEmpty() && this.playerInventory.player.level().isClientSide()) {
-            System.out.println("DEBUG: Recipe Book is now accounting for " + nearbyItems.size() + " stacks from the packet!");
-        }

        for (ItemStack stack : nearbyItems) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/WorkbenchWorkbenchMenu.java`
around lines 98 - 102, Remove the leftover debug print in
WorkbenchWorkbenchMenu: delete the System.out.println(...) line inside the block
that checks nearbyItems and playerInventory.player.level().isClientSide() so the
method getNetworkedNearbyItems()/the nearbyItems debug branch no longer prints
to stdout; keep the surrounding logic intact and, if logging is desired, replace
with an appropriate logger call or remove entirely.
♻️ Duplicate comments (2)
src/client/java/com/tcm/MineTale/block/workbenches/screen/WorkbenchWorkbenchScreen.java (2)

136-137: ⚠️ Potential issue | 🟠 Major

Guard client state before dereferencing, lest nulls from the void strike.

this.minecraft, this.minecraft.player, and this.minecraft.level are still used without full defensive checks in these paths, which can NPE during disconnect/unload transitions.

Suggested hardening patch
 private void handleCraftRequest(int amount) {
+    if (this.minecraft == null || this.minecraft.player == null || this.minecraft.level == null) {
+        return;
+    }
     // Look at our "Memory" instead of the component
     if (this.lastKnownSelectedId != null) {
         ClientRecipeBook book = this.minecraft.player.getRecipeBook();
         RecipeDisplayEntry entry = ((ClientRecipeBookAccessor) book).getKnown().get(this.lastKnownSelectedId);
@@
     RecipeDisplayEntry selectedEntry = null;
-    if (this.lastKnownSelectedId != null && this.minecraft.level != null) {
+    if (this.lastKnownSelectedId != null
+        && this.minecraft != null
+        && this.minecraft.player != null
+        && this.minecraft.level != null) {
         ClientRecipeBook book = this.minecraft.player.getRecipeBook();
         selectedEntry = ((ClientRecipeBookAccessor) book).getKnown().get(this.lastKnownSelectedId);
     }

Also applies to: 140-140, 187-189, 195-197

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

In
`@src/client/java/com/tcm/MineTale/block/workbenches/screen/WorkbenchWorkbenchScreen.java`
around lines 136 - 137, Guard against null Minecraft client state before
dereferencing in WorkbenchWorkbenchScreen: ensure this.minecraft,
this.minecraft.player, and this.minecraft.level are non-null before accessing
player.getRecipeBook(), player inventory/recipe operations, or level-dependent
logic (e.g., when reading lastKnownSelectedId and using
ClientRecipeBookAccessor.getKnown()). Add early-returns or conditional branches
in the methods that reference these symbols (including the code path using
ClientRecipeBook book = this.minecraft.player.getRecipeBook() and any blocks
around lastKnownSelectedId) so the code safely skips or defers work when the
client, player, or level is null.

148-148: ⚠️ Potential issue | 🟡 Minor

Clear stale remembered selection on failure.

When lookup fails, lastKnownSelectedId remains stale and future clicks keep failing until re-selection; clear it in the failure path.

Suggested tidy fix
-    System.out.println("Request failed: No recipe was ever selected!");
+    this.lastKnownSelectedId = null;
+    System.out.println("Request failed: No recipe was ever selected!");
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/client/java/com/tcm/MineTale/block/workbenches/screen/WorkbenchWorkbenchScreen.java`
at line 148, On lookup failure in WorkbenchWorkbenchScreen (the branch that
currently logs "Request failed: No recipe was ever selected!"), clear the stale
selection by resetting lastKnownSelectedId (and any related selection state) so
future clicks can re-select; update the failure path that contains the
System.out.println to set lastKnownSelectedId = null (or the class's default)
and ensure any UI selection flags are cleared as well.
🤖 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/block/workbenches/screen/FarmersWorkbenchScreen.java`:
- Around line 269-301: The method hasIngredientAmount is littered with
System.out.println debug prints (e.g., the initial "DEBUG: Searching
inventory..." and messages inside the workbenchMenu loop and the success/failure
logs); remove these printlns before merging to production and either delete them
entirely or replace with a proper logger call at a debug/trace level if you want
to keep them (use your project's logging facility rather than System.out).
Locate the printlns inside hasIngredientAmount and the block that checks menu
instanceof AbstractWorkbenchContainerMenu workbenchMenu and update accordingly,
ensuring no System.out calls remain in production code.
- Around line 133-149: In handleCraftRequest in FarmersWorkbenchScreen remove
the two System.out.println debug statements (the "Persistent Selection Success:
..." and "Request failed: No recipe was ever selected!") and either drop them
entirely or replace them with the project's logging utility at an appropriate
level (e.g., LOGGER.debug or similar) so production builds do not print to
stdout; keep the rest of the method (the ClientPlayNetworking.send(new
CraftRequestPayload(...)) and early return) unchanged.

---

Outside diff comments:
In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/WorkbenchWorkbenchMenu.java`:
- Around line 98-102: Remove the leftover debug print in WorkbenchWorkbenchMenu:
delete the System.out.println(...) line inside the block that checks nearbyItems
and playerInventory.player.level().isClientSide() so the method
getNetworkedNearbyItems()/the nearbyItems debug branch no longer prints to
stdout; keep the surrounding logic intact and, if logging is desired, replace
with an appropriate logger call or remove entirely.

---

Duplicate comments:
In
`@src/client/java/com/tcm/MineTale/block/workbenches/screen/WorkbenchWorkbenchScreen.java`:
- Around line 136-137: Guard against null Minecraft client state before
dereferencing in WorkbenchWorkbenchScreen: ensure this.minecraft,
this.minecraft.player, and this.minecraft.level are non-null before accessing
player.getRecipeBook(), player inventory/recipe operations, or level-dependent
logic (e.g., when reading lastKnownSelectedId and using
ClientRecipeBookAccessor.getKnown()). Add early-returns or conditional branches
in the methods that reference these symbols (including the code path using
ClientRecipeBook book = this.minecraft.player.getRecipeBook() and any blocks
around lastKnownSelectedId) so the code safely skips or defers work when the
client, player, or level is null.
- Line 148: On lookup failure in WorkbenchWorkbenchScreen (the branch that
currently logs "Request failed: No recipe was ever selected!"), clear the stale
selection by resetting lastKnownSelectedId (and any related selection state) so
future clicks can re-select; update the failure path that contains the
System.out.println to set lastKnownSelectedId = null (or the class's default)
and ensure any UI selection flags are cleared as well.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 98f12fa and 41f3a8a.

📒 Files selected for processing (13)
  • src/client/java/com/tcm/MineTale/MineTaleClient.java
  • src/client/java/com/tcm/MineTale/block/workbenches/screen/ArmorersWorkbenchScreen.java
  • src/client/java/com/tcm/MineTale/block/workbenches/screen/FarmersWorkbenchScreen.java
  • src/client/java/com/tcm/MineTale/block/workbenches/screen/WorkbenchWorkbenchScreen.java
  • src/main/java/com/tcm/MineTale/MineTale.java
  • src/main/java/com/tcm/MineTale/block/workbenches/FarmersWorkbench.java
  • src/main/java/com/tcm/MineTale/block/workbenches/entity/FarmersWorkbenchEntity.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/AbstractWorkbenchContainerMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/ArmorersWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/CampfireWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/FarmersWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/FurnaceWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/WorkbenchWorkbenchMenu.java
🚧 Files skipped from review as they are similar to previous changes (6)
  • src/client/java/com/tcm/MineTale/block/workbenches/screen/ArmorersWorkbenchScreen.java
  • src/client/java/com/tcm/MineTale/MineTaleClient.java
  • src/main/java/com/tcm/MineTale/MineTale.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/ArmorersWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/AbstractWorkbenchContainerMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/FarmersWorkbench.java

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: 3

Caution

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

⚠️ Outside diff range comments (1)
src/main/java/com/tcm/MineTale/block/workbenches/menu/WorkbenchWorkbenchMenu.java (1)

98-100: ⚠️ Potential issue | 🟡 Minor

Remove this debug proclamation before journeying to production, dear hoopy frood!

This System.out.println is helpful during your quest through Middle-earth's debugging swamps, but shall only cause noise in the production logs. Replace with a proper logger at DEBUG level or remove entirely.

🧹 Proposed fix
         if (!nearbyItems.isEmpty() && this.playerInventory.player.level().isClientSide()) {
-            System.out.println("DEBUG: Recipe Book is now accounting for " + nearbyItems.size() + " stacks from the packet!");
         }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/WorkbenchWorkbenchMenu.java`
around lines 98 - 100, In WorkbenchWorkbenchMenu remove the System.out.println
debug line that logs nearbyItems and either delete it or replace it with a
proper logger call at DEBUG level; locate the block that checks
nearbyItems.isEmpty() and playerInventory.player.level().isClientSide() and
change the println to use your project's logging framework (e.g.,
logger.debug(...)) or remove it entirely so production logs are not polluted.
🧹 Nitpick comments (5)
src/main/java/com/tcm/MineTale/block/workbenches/menu/BuildersWorkbenchMenu.java (1)

91-93: Debug logging left behind like breadcrumbs in Mirkwood!

Ah, I spy with my little eye a System.out.println debug statement! Most useful during the quest for bug-slaying, but perhaps not something you'd want cluttering the production logs like Smaug's treasure hoard cluttering Erebor.

Consider removing this debug output before the final release, or replacing it with a proper logging framework call that can be toggled. Though I must say, 42 debug statements might be the answer to everything.

🧹 Suggested tidying
-        if (!nearbyItems.isEmpty() && this.playerInventory.player.level().isClientSide()) {
-            System.out.println("DEBUG: Recipe Book is now accounting for " + nearbyItems.size() + " stacks from the packet!");
-        }
+        // Debug logging removed for production
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/BuildersWorkbenchMenu.java`
around lines 91 - 93, Remove the leftover System.out.println debug statement in
BuildersWorkbenchMenu (the block inspecting nearbyItems and
this.playerInventory.player.level().isClientSide()). Replace it either by
deleting the line or by using the project's logging facility (e.g., a
class-level LOGGER.debug/trace) so the message can be toggled off in production;
ensure any replacement uses the same conditional (isClientSide()) and references
nearbyItems.size() when logging so behavior is identical.
src/main/java/com/tcm/MineTale/block/workbenches/entity/BuildersWorkbenchEntity.java (2)

64-77: Javadoc states scanRadius is set to 0.0, but the constructor doesn't explicitly assign it.

The documentation at line 67 mentions "Sets the entity's scanRadius to 0.0" yet the constructor only sets tier and canPullFromNearby. If the superclass default is 0.0, the Javadoc is technically correct but potentially misleading. Consider either explicitly setting this.scanRadius = 0.0; or updating the Javadoc to clarify it relies on the inherited default.

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

In
`@src/main/java/com/tcm/MineTale/block/workbenches/entity/BuildersWorkbenchEntity.java`
around lines 64 - 77, The Javadoc claims scanRadius is set to 0.0 but the
BuildersWorkbenchEntity constructor doesn't assign it; either explicitly set the
field in the constructor (this.scanRadius = 0.0;) or update the Javadoc to state
it relies on the superclass default. Locate the BuildersWorkbenchEntity
constructor and either add an explicit assignment to the scanRadius field
alongside this.tier and this.canPullFromNearby, or change the comment text to
remove the assignment claim and note that scanRadius uses the inherited default.

28-62: The ContainerData declares 4 slots but uses none, like a Vogon filing cabinet – bureaucratically present yet functionally empty.

The getCount() method returns 4, yet get(index) only has a default case returning 0. If no synchronised data is needed, consider returning 0 from getCount() (matching the DATA_SIZE = 0 pattern in BuildersWorkbenchMenu). Alternatively, if future data slots are planned, document the intent.

🛠️ Proposed simplification
         `@Override`
         public int getCount() {
-            return 4;
+            return 0;
         }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/entity/BuildersWorkbenchEntity.java`
around lines 28 - 62, The ContainerData anonymous instance in
BuildersWorkbenchEntity currently returns getCount() == 4 while get(int) always
returns 0; update this to be consistent with BuildersWorkbenchMenu's DATA_SIZE
by changing getCount() to return 0 if no sync data is needed, or implement
explicit index cases in the get(int) (and set(int,int) if required) to expose
the intended 4 data slots; touch the ContainerData field named data in
BuildersWorkbenchEntity and ensure its getCount() matches
BuildersWorkbenchMenu.DATA_SIZE (or vice versa) and document the choice.
src/client/java/com/tcm/MineTale/block/workbenches/screen/BuildersWorkbenchScreen.java (1)

38-299: This screen is remarkably similar to FarmersWorkbenchScreen – consider a shared base class.

The BuildersWorkbenchScreen and FarmersWorkbenchScreen share approximately 90% identical code, differing only in their recipe type, block reference, and category constants. This is like having two copies of "The Lord of the Rings" with only the cover art changed. A shared abstract base class (e.g., AbstractMineTaleWorkbenchScreen) could reduce maintenance burden and ensure consistent behaviour across all workbench types.

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

In
`@src/client/java/com/tcm/MineTale/block/workbenches/screen/BuildersWorkbenchScreen.java`
around lines 38 - 299, BuildersWorkbenchScreen duplicates most logic from
FarmersWorkbenchScreen; extract a new AbstractMineTaleWorkbenchScreen base class
holding shared fields (mineTaleRecipeBook, lastKnownSelectedId,
craftOneBtn/craftTenBtn/craftAllBtn), common lifecycle and helpers (init,
handleCraftRequest, render, renderBg, canCraft, hasIngredientAmount,
getRecipeBookButtonPosition, createRecipeBookComponent helper) and move
duplicated implementations there; make BuildersWorkbenchScreen and
FarmersWorkbenchScreen extend this base and implement small protected abstract
getters used by the base (e.g., getTexture()/TEXTURE, getTabIcon()/block item
for createRecipeBookComponent, getRecipeType()/ModRecipes type, and any
menu-specific bindings) so only workbench-specific constants remain in the
subclasses and all shared methods reference those abstract accessors (use class
names BuildersWorkbenchScreen, FarmersWorkbenchScreen, and
AbstractMineTaleWorkbenchScreen to locate code to move/refactor).
src/client/java/com/tcm/MineTale/block/workbenches/screen/FarmersWorkbenchScreen.java (1)

218-256: Consider extracting shared crafting logic to reduce duplication across workbench screens.

The canCraft and hasIngredientAmount methods present in this file appear similar to those found in other workbench screen implementations (such as BuildersWorkbenchScreen). This duplication is like hauling unnecessary luggage through Middle-earth – a burden best left behind. Extracting these methods into a shared utility class or establishing a common base screen class would lighten the load and improve maintainability across all workbench implementations.

Manual inspection of BuildersWorkbenchScreen and other workbench screen classes is needed to confirm the exact extent of duplication and determine the optimal extraction strategy.

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

In
`@src/client/java/com/tcm/MineTale/block/workbenches/screen/FarmersWorkbenchScreen.java`
around lines 218 - 256, The canCraft method (and its companion
hasIngredientAmount) duplicates logic found in other workbench screens like
BuildersWorkbenchScreen; extract the shared crafting/inventory-check logic into
a single reusable place (either a new utility class e.g., WorkbenchCraftingUtils
with static methods or a common abstract base class e.g.,
AbstractWorkbenchScreen) and update FarmersWorkbenchScreen to call the shared
canCraft/hasIngredientAmount implementation; ensure you move any helper details
(aggregation of Ingredient holders, holderToIngredient mapping, and Inventory
checks) and preserve method signatures used by screens so callers (canCraft,
hasIngredientAmount) simply delegate to the new shared implementation.
🤖 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/block/workbenches/screen/BuildersWorkbenchScreen.java`:
- Around line 249-281: The method hasIngredientAmount contains several
System.out.println debug calls; remove them (or replace with a proper logger at
debug/trace level) so production logs aren’t polluted—specifically update the
System.out.println usages inside hasIngredientAmount (including the messages
around checking inventory, reporting finds from
workbenchMenu.getNetworkedNearbyItems(), and the final requirement/result
messages) to either be deleted or changed to LOGGER.debug(...) after adding or
using an existing logger in BuildersWorkbenchScreen; ensure no
System.out.println calls remain in hasIngredientAmount.
- Around line 130-146: The two System.out.println debug prints in
handleCraftRequest (the one logging "Persistent Selection Success: " and the
failure "Request failed: No recipe was ever selected!") should be removed or
replaced with a proper logger; locate handleCraftRequest and remove the
System.out.println calls (or swap them for a configured logger call e.g.,
LOGGER.debug/trace) while leaving the logic that builds results and calls
ClientPlayNetworking.send(new CraftRequestPayload(..., amount)) intact, and
ensure no other stray System.out.println usages remain in this method.

In `@src/main/java/com/tcm/MineTale/registry/ModRecipes.java`:
- Around line 43-48: Update the Javadoc in ModRecipes to include BUILDERS_TYPE
in the enumerated list of registered recipe types (alongside FURNACE_T1_TYPE,
CAMPFIRE_TYPE, WORKBENCH_TYPE, ARMORERS_TYPE, and FARMERS_TYPE) and, if
relevant, mention its corresponding serializer (BUILDERS_SERIALIZER) so the
documentation accurately reflects the registrations performed by the ModRecipes
class.

---

Outside diff comments:
In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/WorkbenchWorkbenchMenu.java`:
- Around line 98-100: In WorkbenchWorkbenchMenu remove the System.out.println
debug line that logs nearbyItems and either delete it or replace it with a
proper logger call at DEBUG level; locate the block that checks
nearbyItems.isEmpty() and playerInventory.player.level().isClientSide() and
change the println to use your project's logging framework (e.g.,
logger.debug(...)) or remove it entirely so production logs are not polluted.

---

Nitpick comments:
In
`@src/client/java/com/tcm/MineTale/block/workbenches/screen/BuildersWorkbenchScreen.java`:
- Around line 38-299: BuildersWorkbenchScreen duplicates most logic from
FarmersWorkbenchScreen; extract a new AbstractMineTaleWorkbenchScreen base class
holding shared fields (mineTaleRecipeBook, lastKnownSelectedId,
craftOneBtn/craftTenBtn/craftAllBtn), common lifecycle and helpers (init,
handleCraftRequest, render, renderBg, canCraft, hasIngredientAmount,
getRecipeBookButtonPosition, createRecipeBookComponent helper) and move
duplicated implementations there; make BuildersWorkbenchScreen and
FarmersWorkbenchScreen extend this base and implement small protected abstract
getters used by the base (e.g., getTexture()/TEXTURE, getTabIcon()/block item
for createRecipeBookComponent, getRecipeType()/ModRecipes type, and any
menu-specific bindings) so only workbench-specific constants remain in the
subclasses and all shared methods reference those abstract accessors (use class
names BuildersWorkbenchScreen, FarmersWorkbenchScreen, and
AbstractMineTaleWorkbenchScreen to locate code to move/refactor).

In
`@src/client/java/com/tcm/MineTale/block/workbenches/screen/FarmersWorkbenchScreen.java`:
- Around line 218-256: The canCraft method (and its companion
hasIngredientAmount) duplicates logic found in other workbench screens like
BuildersWorkbenchScreen; extract the shared crafting/inventory-check logic into
a single reusable place (either a new utility class e.g., WorkbenchCraftingUtils
with static methods or a common abstract base class e.g.,
AbstractWorkbenchScreen) and update FarmersWorkbenchScreen to call the shared
canCraft/hasIngredientAmount implementation; ensure you move any helper details
(aggregation of Ingredient holders, holderToIngredient mapping, and Inventory
checks) and preserve method signatures used by screens so callers (canCraft,
hasIngredientAmount) simply delegate to the new shared implementation.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/entity/BuildersWorkbenchEntity.java`:
- Around line 64-77: The Javadoc claims scanRadius is set to 0.0 but the
BuildersWorkbenchEntity constructor doesn't assign it; either explicitly set the
field in the constructor (this.scanRadius = 0.0;) or update the Javadoc to state
it relies on the superclass default. Locate the BuildersWorkbenchEntity
constructor and either add an explicit assignment to the scanRadius field
alongside this.tier and this.canPullFromNearby, or change the comment text to
remove the assignment claim and note that scanRadius uses the inherited default.
- Around line 28-62: The ContainerData anonymous instance in
BuildersWorkbenchEntity currently returns getCount() == 4 while get(int) always
returns 0; update this to be consistent with BuildersWorkbenchMenu's DATA_SIZE
by changing getCount() to return 0 if no sync data is needed, or implement
explicit index cases in the get(int) (and set(int,int) if required) to expose
the intended 4 data slots; touch the ContainerData field named data in
BuildersWorkbenchEntity and ensure its getCount() matches
BuildersWorkbenchMenu.DATA_SIZE (or vice versa) and document the choice.

In
`@src/main/java/com/tcm/MineTale/block/workbenches/menu/BuildersWorkbenchMenu.java`:
- Around line 91-93: Remove the leftover System.out.println debug statement in
BuildersWorkbenchMenu (the block inspecting nearbyItems and
this.playerInventory.player.level().isClientSide()). Replace it either by
deleting the line or by using the project's logging facility (e.g., a
class-level LOGGER.debug/trace) so the message can be toggled off in production;
ensure any replacement uses the same conditional (isClientSide()) and references
nearbyItems.size() when logging so behavior is identical.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 41f3a8a and e9a6514.

📒 Files selected for processing (16)
  • src/client/java/com/tcm/MineTale/MineTaleClient.java
  • src/client/java/com/tcm/MineTale/block/workbenches/screen/BuildersWorkbenchScreen.java
  • src/client/java/com/tcm/MineTale/block/workbenches/screen/FarmersWorkbenchScreen.java
  • src/client/java/com/tcm/MineTale/block/workbenches/screen/WorkbenchWorkbenchScreen.java
  • src/client/java/com/tcm/MineTale/datagen/recipes/BuilderRecipes.java
  • src/client/java/com/tcm/MineTale/datagen/recipes/WorkbenchRecipes.java
  • src/main/java/com/tcm/MineTale/MineTale.java
  • src/main/java/com/tcm/MineTale/block/workbenches/BuildersWorkbench.java
  • src/main/java/com/tcm/MineTale/block/workbenches/entity/BuildersWorkbenchEntity.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/BuildersWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/block/workbenches/menu/WorkbenchWorkbenchMenu.java
  • src/main/java/com/tcm/MineTale/registry/ModBlockEntities.java
  • src/main/java/com/tcm/MineTale/registry/ModBlocks.java
  • src/main/java/com/tcm/MineTale/registry/ModMenuTypes.java
  • src/main/java/com/tcm/MineTale/registry/ModRecipeDisplay.java
  • src/main/java/com/tcm/MineTale/registry/ModRecipes.java
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/main/java/com/tcm/MineTale/registry/ModRecipeDisplay.java
  • src/main/java/com/tcm/MineTale/MineTale.java
  • src/client/java/com/tcm/MineTale/MineTaleClient.java
  • src/main/java/com/tcm/MineTale/registry/ModBlocks.java

coderabbitai bot added a commit that referenced this pull request Feb 26, 2026
Docstrings generation was requested by @The-Code-Monkey.

* #54 (comment)

The following files were modified:

* `src/client/java/com/tcm/MineTale/block/workbenches/screen/ArmorersWorkbenchScreen.java`
* `src/client/java/com/tcm/MineTale/block/workbenches/screen/BuildersWorkbenchScreen.java`
* `src/client/java/com/tcm/MineTale/block/workbenches/screen/FarmersWorkbenchScreen.java`
* `src/client/java/com/tcm/MineTale/block/workbenches/screen/WorkbenchWorkbenchScreen.java`
* `src/client/java/com/tcm/MineTale/datagen/recipes/BuilderRecipes.java`
* `src/main/java/com/tcm/MineTale/MineTale.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/BuildersWorkbench.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/FarmersWorkbench.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/entity/BuildersWorkbenchEntity.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/menu/ArmorersWorkbenchMenu.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/menu/BuildersWorkbenchMenu.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/menu/CampfireWorkbenchMenu.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/menu/FarmersWorkbenchMenu.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/menu/FurnaceWorkbenchMenu.java`
* `src/main/java/com/tcm/MineTale/block/workbenches/menu/WorkbenchWorkbenchMenu.java`
* `src/main/java/com/tcm/MineTale/registry/ModRecipes.java`
@The-Code-Monkey The-Code-Monkey merged commit 5e302d5 into 1.21 Feb 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant