Skip to content

Commit 9285bd3

Browse files
📝 Add docstrings to feat/add-farmers-workbench
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`
1 parent 1d06564 commit 9285bd3

16 files changed

Lines changed: 1443 additions & 245 deletions

src/client/java/com/tcm/MineTale/block/workbenches/screen/ArmorersWorkbenchScreen.java

Lines changed: 14 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ private ArmorersWorkbenchScreen(ArmorersWorkbenchMenu menu, Inventory inventory,
7272
}
7373

7474
/**
75-
* Create a MineTaleRecipeBookComponent configured for the workbench screen.
75+
* Creates a MineTaleRecipeBookComponent preconfigured for the armourer's workbench.
7676
*
77-
* @param menu the workbench menu used to initialize the recipe book component
78-
* @return a MineTaleRecipeBookComponent containing the workbench tab and associated recipe category
77+
* @param menu the workbench menu used to bind the recipe book to the current container
78+
* @return the configured MineTaleRecipeBookComponent containing the workbench tab and associated recipe type
7979
*/
8080
private static MineTaleRecipeBookComponent createRecipeBookComponent(ArmorersWorkbenchMenu menu) {
8181
ItemStack tabIcon = new ItemStack(ModBlocks.ARMORERS_WORKBENCH_BLOCK.asItem());
@@ -88,12 +88,12 @@ private static MineTaleRecipeBookComponent createRecipeBookComponent(ArmorersWor
8888
}
8989

9090
/**
91-
* Configure the screen's GUI dimensions and initialize widgets.
92-
*
93-
* Sets the layout size (imageWidth = 176, imageHeight = 166), delegates remaining
94-
* layout initialization to the superclass, and creates the three craft buttons
95-
* ("1", "10", "All") wired to their respective handlers.
96-
*/
91+
* Initialises the screen layout and registers three crafting buttons.
92+
*
93+
* Sets the GUI image dimensions, delegates further initialisation to the superclass,
94+
* and creates three buttons that request crafting of 1, 10 or all results (the
95+
* "all" action is represented by -1).
96+
*/
9797
@Override
9898
protected void init() {
9999
// Important: Set your GUI size before super.init()
@@ -119,45 +119,14 @@ protected void init() {
119119
}
120120

121121
/**
122-
* Sends a crafting request for the currently selected recipe in the integrated recipe book.
122+
* Send a craft request for the recipe remembered by the screen's last known selection.
123123
*
124-
* Locates the last recipe collection and last selected recipe ID from the recipe book component,
125-
* resolves the recipe's result item, and sends a CraftRequestPayload to the server containing that
126-
* item and the requested amount.
124+
* Resolves the remembered recipe to its resulting item(s) and, if a result exists, sends a
125+
* network CraftRequestPayload containing the first result and the specified amount. If there
126+
* is no remembered selection or no results, no network payload is sent.
127127
*
128-
* @param amount the quantity to craft; use -1 to request crafting of the full available stack ("All")
128+
* @param amount the quantity to craft; use -1 to request crafting all available units
129129
*/
130-
131-
// private void handleCraftRequest(int amount) {
132-
// // 1. Cast the book component to the Accessor to get the selected data
133-
// RecipeBookComponentAccessor accessor = (RecipeBookComponentAccessor) this.mineTaleRecipeBook;
134-
135-
// RecipeCollection collection = accessor.getLastRecipeCollection();
136-
// RecipeDisplayId displayId = accessor.getLastRecipe();
137-
138-
// if (collection != null && displayId != null) {
139-
// // 2. Find the visual entry
140-
// for (RecipeDisplayEntry entry : collection.getSelectedRecipes(RecipeCollection.CraftableStatus.ANY)) {
141-
// if (entry.id().equals(displayId)) {
142-
// // 3. Resolve result for the packet
143-
// List<ItemStack> results = entry.resultItems(SlotDisplayContext.fromLevel(this.minecraft.level));
144-
145-
// if (!results.isEmpty()) {
146-
// ItemStack resultStack = results.get(0);
147-
148-
// // 4. LOG FOR DEBUGGING
149-
// System.out.println("Sending craft request for: " + resultStack + " amount: " + amount);
150-
151-
// ClientPlayNetworking.send(new CraftRequestPayload(resultStack, amount));
152-
// }
153-
// break;
154-
// }
155-
// }
156-
// } else {
157-
// System.out.println("Request failed: Collection or DisplayID is null!");
158-
// }
159-
// }
160-
161130
private void handleCraftRequest(int amount) {
162131
// Look at our "Memory" instead of the component
163132
if (this.lastKnownSelectedId != null) {

0 commit comments

Comments
 (0)