Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TiCo Crafting Stations not working with compressed chests #435

Merged
merged 2 commits into from
Nov 3, 2023

Conversation

Nilau1998
Copy link

@Nilau1998 Nilau1998 commented Nov 1, 2023

The problem here is that the the stack of slot which gets picked up by the FastTransferManager for some reason loses it's stacksize in the process IF the chest is a compressed chest. If the chest is any other chest it works fine and the stacksize doesn't get set to 0. A stacksize of 0 causes the for-loop not to trigger, meaning this code does nothing for compressed chests.

This change creates a backup of the stacksize and uses that instead of the ItemStack stacksize provided in stack. There seems to be a problem somewhere further down the chain within the FastTransferManager, but I couldn't figure out at all what it might be. The FTM.clickSlot() method just seems to be a fancy wrapper for Mojang methods.

Closes GTNewHorizons/GT-New-Horizons-Modpack#13034

Copy link
Member

@miozune miozune left a comment

Choose a reason for hiding this comment

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

It's caused by InventoryAvaritiaddonsChest#decrStackSize modifying stacksize even if the whole itemstack is taken, contrary to TileEntityChest#decrStackSize just assigning null without modifying stacksize. However, I'd say it's just a coincidence that vanilla chest works with current way, so having the fix on NEI side makes sense to me.

@Nilau1998
Copy link
Author

Nilau1998 commented Nov 2, 2023

It's caused by InventoryAvaritiaddonsChest#decrStackSize modifying stacksize even if the whole itemstack is taken, contrary to TileEntityChest#decrStackSize just assigning null without modifying stacksize. However, I'd say it's just a coincidence that vanilla chest works with current way, so having the fix on NEI side makes sense to me.

How exactly did you figure this out? As in what was your debugging approach? I could imagine you might have used a WatchPoint at the stackSize field in ItemStack itself to see when it's being written to, once it's set to 0 just jump out and see from where the 0 came?

@miozune
Copy link
Member

miozune commented Nov 2, 2023

How exactly did you figure this out?

Field watchpoint would work too. My approach is putting break point at DefaultOverlayHandler#moveIngredients (since you changed there) and simply following code steps. It leads me to InventoryAvaritiaddonsChest modifying stacksize. Then I tried the same thing with vanilla chest, and found that equivalent method TileEntityChest#decrStackSize not modifying stacksize.
I didn't know about field watchpoint until recently (lol) so I did in the way I'm used to, but field watchpoint might work better.

@Nilau1998
Copy link
Author

Just FYI, I tried out the watchpoint at the field out of curiousity but didn't do much for me. My approach was to first set a breakpoint in DefaultOverlayHandler#moveIngredients and activating the field watchpoint once the first breakpoint hits. I didn't help much however, jumping out after the field watchpoint triggers lead to nowhere.

@miozune miozune merged commit b011024 into GTNewHorizons:master Nov 3, 2023
1 check passed
@Nilau1998 Nilau1998 deleted the FixCraftingStations branch November 4, 2023 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compressed Chest will not Autofill Recipes in Tinker's Crafting Table
2 participants