@@ -51,7 +51,7 @@ public AbstractWorkbenchContainerMenu(@Nullable MenuType<?> menuType, int syncId
5151 super (menuType , syncId );
5252
5353 this .outputEnd = outputEnd ;
54- this .inputEnd = Constants . INPUT_START + 1 ;
54+ this .inputEnd = inputEnd ;
5555
5656 checkContainerSize (container , outputEnd + 1 );
5757 checkContainerDataCount (data , containerDataSize );
@@ -180,57 +180,6 @@ public int getBurnProgress() {
180180 return this .data .get (0 ) * 13 / i ; // fuelTime
181181 }
182182
183- /**
184- * Performs a shift-click transfer between this container and the player's inventory.
185- *
186- * Moves the clicked stack into the player's inventory if it came from the container, or into the appropriate container
187- * slots if it came from the player's inventory. Fuel items are moved to the fuel slot; all other items are moved to the
188- * input slots. If the transfer cannot be completed, no changes are applied to the source slot.
189- *
190- * @param player the player performing the transfer
191- * @param index the index of the slot that was shift-clicked
192- * @return the original ItemStack from the clicked slot, or ItemStack.EMPTY if the transfer failed
193- */
194- // @Override
195- // public ItemStack quickMoveStack(Player player, int index) {
196- // ItemStack itemStack = ItemStack.EMPTY;
197- // Slot slot = this.slots.get(index);
198- // if (slot != null && slot.hasItem()) {
199- // ItemStack itemStack2 = slot.getItem();
200- // itemStack = itemStack2.copy();
201-
202- // // From Furnace to Player
203- // int containerSlots = this.outputEnd + 1;
204- // int playerStart = containerSlots;
205- // int playerEnd = playerStart + 36;
206-
207- // // From Furnace to Player
208- // if (index < containerSlots) {
209- // if (!this.moveItemStackTo(itemStack2, playerStart, playerEnd, true)) {
210- // return ItemStack.EMPTY;
211- // }
212- // }
213- // // From Player to Furnace
214- // else {
215- // // If it's fuel, try fuel slot
216- // if (isFuel(itemStack2)) {
217- // if (!this.moveItemStackTo(itemStack2, Constants.FUEL_SLOT, Constants.FUEL_SLOT + 1, false)) return ItemStack.EMPTY;
218- // }
219- // // Otherwise, try inputs
220- // else if (!this.moveItemStackTo(itemStack2, Constants.INPUT_START, this.inputEnd, false)) {
221- // return ItemStack.EMPTY;
222- // }
223- // }
224-
225- // if (itemStack2.isEmpty()) {
226- // slot.setByPlayer(ItemStack.EMPTY);
227- // } else {
228- // slot.setChanged();
229- // }
230- // }
231- // return itemStack;
232- // }
233-
234183 @ Override
235184 public ItemStack quickMoveStack (Player player , int index ) {
236185 ItemStack itemStack = ItemStack .EMPTY ;
@@ -240,11 +189,7 @@ public ItemStack quickMoveStack(Player player, int index) {
240189 ItemStack itemStack2 = slot .getItem ();
241190 itemStack = itemStack2 .copy ();
242191
243- // Indices:
244- // 0-6: Workbench (0: Fuel, 1-2: Input, 3-6: Output)
245- // 7-33: Player Inventory
246- // 34-42: Player Hotbar
247- int workbenchSlotsEnd = 7 ;
192+ int workbenchSlotsEnd = this .outputEnd + 1 ;
248193
249194 // CASE 1: Moving from Workbench to Player Inventory
250195 if (index < workbenchSlotsEnd ) {
@@ -258,16 +203,16 @@ public ItemStack quickMoveStack(Player player, int index) {
258203 else {
259204 if (this .isFuel (itemStack2 )) {
260205 // 1. Try the Fuel Slot (Index 0)
261- if (!this .moveItemStackTo (itemStack2 , 0 , 1 , false )) {
206+ if (!this .moveItemStackTo (itemStack2 , Constants . FUEL_SLOT , Constants . FUEL_SLOT + 1 , false )) {
262207 // 2. If fuel is full, try the Input slots (Indices 1 to 3) as backup
263- if (!this .moveItemStackTo (itemStack2 , 1 , 3 , false )) {
208+ if (!this .moveItemStackTo (itemStack2 , Constants . INPUT_START , this . inputEnd + 1 , false )) {
264209 return ItemStack .EMPTY ;
265210 }
266211 }
267212 } else {
268213 // 3. Not fuel? Go straight to Input slots (Indices 1 to 3)
269214 // This ensures Slot 1 is checked BEFORE Slot 2
270- if (!this .moveItemStackTo (itemStack2 , 1 , 3 , false )) {
215+ if (!this .moveItemStackTo (itemStack2 , Constants . INPUT_START , this . inputEnd + 1 , false )) {
271216 return ItemStack .EMPTY ;
272217 }
273218 }
@@ -320,10 +265,6 @@ public void clearCraftingContent() {
320265
321266 @ Override
322267 public boolean recipeMatches (RecipeHolder <WorkbenchRecipe > holder ) {
323- // Use the block entity's logic to see if current inputs match
324- AbstractWorkbenchContainerMenu .this .getBlockEntity (); // Just to ensure it exists
325- // Note: Ensure your sub-classes provide createRecipeInput() or similar logic
326- holder .value ().matches (null , serverLevel );
327268 return holder .value ().matches (
328269 AbstractWorkbenchContainerMenu .this .createRecipeInput (),
329270 serverLevel
@@ -352,7 +293,7 @@ public boolean recipeMatches(RecipeHolder<WorkbenchRecipe> holder) {
352293 public void fillStackedContents (StackedItemContents contents ) {
353294 // You MUST manually add the items from your SimpleContainer
354295 // to the contents for the recipe book to "simulate" correctly.
355- for (int i = 0 ; i < this .container . getContainerSize () ; i ++) {
296+ for (int i = Constants . INPUT_START ; i <= this .inputEnd ; i ++) {
356297 contents .accountStack (this .container .getItem (i ));
357298 }
358299 }
@@ -364,7 +305,7 @@ public void fillCraftSlotsStackedContents(StackedItemContents contents) {
364305
365306 // 2. Tell the server what is already in the workbench slots
366307 // This allows the server to 'add' to the existing count
367- for (int i = 0 ; i < this .container . getContainerSize () ; i ++) {
308+ for (int i = Constants . INPUT_START ; i <= this .inputEnd ; i ++) {
368309 contents .accountStack (this .container .getItem (i ));
369310 }
370311 }
0 commit comments