[1.12] Bad duplication bug when having two stacks of engines in your inventory and opening a Vehicle Crafting Bench
coldblade2000 opened this issue ยท 2 comments
Describe the bug
If you have two or more stacks of engines (any V* engine of the same type) in your inventory, whenever you open the Vehicle Crafting Bench, the first stack will start quickly increasing in quantity every single tick (frame?), quickly going past 1000 with no apparent limit. While doing anything like dropping an engine from that stack with "Q" will reset to the original quanity (leading me to believe this is a server/client issue), you can grab the bugged stack from your inventory and start filling your inventory with those engines. As the engine is such an expensive part, I figure this issue is kinda severe.
To Reproduce
Steps to reproduce the behavior:
- Craft two V4, V6 or V8 engines (just make sure they are the same kind)
- Put them in different stacks
- Open a vehicle crafting bench
- Very quickly, the first stack, and the stack in the VCB, will start quickly increasing in number way past the intended limit of 4.
(To reset the stack to normal)
5. Close the VCB and drop one item with "Q" from the bugged stack
(To duplicate engines)
6. Repeat steps 1-4
7. Close the VCB and open your inventory with "E"
8. Right click on the bugged stack, you will grab a stack of 64 engines
9. Place the new bugged stack anywhere in the inventory
10. Those new stacks will persist in the world are are now "normal" stacks that wont revert to a limit of 4
Expected behavior
When You open the VCB, the amount of engines available shouldn't go higher than the amount of engines you had before the VCB opened
Screenshots
If applicable, add screenshots to help explain your problem.
Normal crafting with a single engine stack
I get another engine stack. The total number of engines I have here is 2
A few seconds after opening the VCB
Opening my inventory and just right clicking or left clicking the stack and dragging
Versions (please complete the following information):\
- Forge: 14.23.5.2768
- Flan's Mod: v5.6-beta, v5.6-beta.1 and also currently present in my Pull Request Branch (based on v5.6-beta.1)
Additional context
Add any other context about the problem here.
I have it tracked down to GuiDriveableCrafting.java in com.flansmod.client.gui. The code makes a temporaryInventory copy of the player's inventory, I guess so precisely this thing doesn't happen. I believe, however, that this copy still gets tied somehow to the client-side copy of the player's inventory. I checked and there are no obvious lines that set the player's inventory to the temporaryInventory, the only line that affects the temporaryInventory (line 244) doesn't fix the issue by being commented out.
Add a link to a gist of any errors.
No console errors, apparently
I made a bandaid fix by replacing line 283 of GuiDriveableCrafting.java with this:
int count = engines.get(partType).getCount(); count += stackInSlot.getCount(); if(count > 4){ count = 4; } engines.get(partType).setCount(count);
It doesn't FIX the issue, but limits the amount of engines that can be obtained from a single duplication to 4. It's nothing more than a bandaid fix