-
-
Notifications
You must be signed in to change notification settings - Fork 134
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
ComponentItemHandler not working correctly with AbstractContainerMenu#moveItemStackTo #1206
Comments
I don't see a very good solution to this problem. There's an immutable vs mutable contract problem going on here, where the Realistically, solving this requires addressing that mutability disaster. The best-case scenario would be to deprecate
The most appropriate solution would be for vanilla to change |
I tried to write up a quick PR for this but it doesn't quite work.
The first one will be a problem for the The second one seems like a redundant call because the |
Some inspiration maybe: https://github.com/AztechMC/Modern-Industrialization/blob/1.21.x/src/main/java/aztech/modern_industrialization/inventory/HackySlot.java. This can be used with immutable stack storage. |
I had thought of doing that kind of cursed slot-stack-caching but was worried about what terrible side effects that might incur under various conditions. |
I've been doing it for years :D |
Would just adding this logic to |
IMO this should be as self-contained as possible. I would maybe reuse the |
So create a new |
Minecraft Version: 1.21
NeoForge Version: 21.0.42-beta
Steps to Reproduce:
ComponentItemHandler
quickMoveStack
usingAbstractContainerMenu#moveItemStackTo
(EX: Chest implementation)Before:
After:
Description of issue:
I think it is because
ComponentItemHandler
creates a copy of the item stack when retrieving from a slot. ThenAbstractContainerMenu#moveItemStackTo
modifies the stack in place and expects it to be saved. I was able to get around this issue by overridingAbstractContainerMenu#moveItemStackTo
and changing the callsSlot#setChanged
toSlot#set
. Here is a simple example mod that shows this issue: https://github.com/will-y/QuickMoveTestThe text was updated successfully, but these errors were encountered: