Potential Cross-Mod Item Duplication Glitch in 1.12
HipHopHuman opened this issue ยท 3 comments
Preface, I read the note about maintenance having stopped on 1.12, so if this issue is out of scope, then feel free to ignore it. I think it counts as "critical" though, and I think the problem may exist more generally in 1.15+ as well, but I haven't confirmed this.
Minecraft Version
1.12.2
Forge Version
forge-14.23.5.2854
FactoryTech-1.6.C
Mod Version
pneumaticcraft-repressurized-1.12.2-0.11.15-398
Describe your problem, including steps to reproduce it
A potential item duplication glitch exploit involving inventories that prevent the last item of a type from being removed.
In this specific case, I'm using Factory Tech, which adds an inventory called the Buffer Crate, but I imagine the glitch would happen with any mod that adds an inventory that works similarly. The Buffer Crate allows all items to be extracted, except for the last item in a slot, which it safeguards against any kind of automation. The use case here is to prevent automation/processing pipelines from clogging up with a single material when multiple materials are being processed.
The duplication comes from combining this mechanic with PNC's logistics network, specifically Requester and Active Provider frames. If an Active Provider Frame is placed onto a Buffer Crate, and that Buffer Crate is then used to source materials to a Requester Frame, it results in item duplication.
I don't know much about PNC internals, but I'm guessing that the following is happening:
- Requester Frame checks logistics network for Item X
- Requester Frame successfully finds Item X in Buffer Crate - there is only 1 of Item X in the Buffer Crate, however.
- Requester Frame deletes the item in the Buffer Crate, and creates a new copy of said item in it's managed inventory.
- Buffer Crate denies the deletion of the item, as it sees this deletion as a standard attempt to remove the last item of a stack.
- Result is 2 items where there should have been one.
Any other comments?
I'm guessing this is why most mods that have a "reserve this slot for this item type" mechanic do it with ghost items, it's not just for convenience. I don't know which mod has the responsibility for fixing this, but I figured I'd make an issue in both repositories and it definitely seems like the kind of bug that could happen on any inventory that works similarly to the Buffer Crate in Factory Tech. I suggest adding a seperate check to the Requester frame, that validates that the old item was actually deleted by comparing the total item count before and after deletion. If the item count is the same, try accessing the item from a different slot.
You can see the issue I made in the Factory Tech repo here: https://gitlab.com/dalapo/FactoryTech/-/issues/122
Yeah, sorry, unsupported is unsupported. I don't even have a working dev environment for 1.12 anymore, nor do I wish to set one up.
If you can show this happening on a 1.15 or 1.16 environment, feel to reopen, but I won't be doing anything else on 1.12 now. Simply don't have the time (or inclination).
Fair enough. I don't know of any mods that add similar inventories in later MC versions (aside from Essentials' Slotted Chest, but that uses ghost items so it'd be exempt from this problem). If you happen to know any mods on 1.15+ that have something like that feel free to ping me here and I'll go out and test it.