Cargo ignores lore of slimefun items, causing backpacks to stack.
Boomer-1 opened this issue · 16 comments
❗ Checklist
- I am using the official english version of Slimefun and did not modify the jar.
- I am using an up to date "DEV" (not "RC") version of Slimefun.
- I am aware that issues related to Slimefun addons need to be reported on their bug trackers and not here.
- I searched for similar open issues and could not find an existing bug report on this.
📍 Description
When sending newly crafted backpacks of the same size thru cargo from one chest to another the backpacks became stacked and all had the same id #.
📑 Reproduction Steps
Put a dozen or so newly crafted backpacks into a chest.
setup a cargo node to blacklist to send to another chest
put a same sized backpack into the cargo node on whitelist
as items transfer they will stack.
💡 Expected Behavior
I would expect backpacks to keep their lore and not stack.
📷 Screenshots / Videos
📜 Server Log
No response
📂 /error-reports/
folder
No response
💻 Server Software
Paper
🎮 Minecraft Version
1.17.x
⭐ Slimefun version
dev 987
🧭 Other plugins
No response
all kinds of memory card (in addon Network ) are also affected by this bug.
it can store a single type of item,this bug could copy the items in it
so I have to change the Material of these item into chestplate (items that can't merge)to use it normally : )
@kuzuanpa We already aware of the issue, you dont need to report every broken item.
This also happens on other items that are stack able for example in LiteXpansion you can allow the glasscutter with 0 joules to merge with 1 with 300 joules.
Also tested it with Crysta and Brilliance Scoop when the item misses an use and you put it in cargo with an item with full uses it also combines
Ah. I could probably have rechargeable extend Distinct and the scoop is limited use so I could make limited-use implement distinct also? I’ll modify when I get home
Just speculating, since backpacks are Slimefun items, the optimization on #3258 probably have caused this side effects.
I believe this is a much longer standing issue, ever since IDs were added in 1.14: to optimize comparisons between SlimefunItems we have a quick ID check here https://github.com/Slimefun/Slimefun4/blob/master/src/main/java/io/github/thebusybiscuit/slimefun4/utils/SlimefunUtils.java#L279, which would see two backpacks being the same even though they have different lore (#3258 does make this happen more often but it is not the root cause).
I am honestly unsure how to fix this: we could add a specific check for backpacks and fall back to lore checks in that case before returning true but this would probably be hard to expand - I can't think of any other item that would use meta information AND is stackable (most are armour/tools) but more may come, we could add them to a Set to check Set#contains() and fall back to lore checks in those cases but it seems... Unwise.
I summon le Cookie and le Blob for advice on how to work around it in a better way if possible @TheBusyBiscuit @WalshyDev
I have just tested this with my DankPacks from dt2 and they are effected in the same way. SlimeTinker tools/repair kits would likely be effected if they were itemstacks that could stack.
Cargo.Stacking.mp4
Hmm, I'm not sure how to handle this. I'd like to try and not revert but how do we know if it's an item to check lore of. Any ideas or opinions?
Uhm, I might be a big dummy but something in SlimefunItem like boolean enforceLoreCheck that defaults false and have cargo check this then only do the previous/extended check as/when told to do so? I assume we have the SlimefunItem at this point?
If dumb - sorry xD
Is SlimefunUtils.isItemSimilar
supposed to check for equal values or are the items allowed to differ in meta or nbt?
Is
SlimefunUtils.isItemSimilar
supposed to check for equal values or are the items allowed to differ in meta or nbt?
For vanilla items, it checks ItemMeta. For Slimefun items, the IDs are compared (In the context of cargo).
Any updates on this issue? Have run across several servers disabling the cargo manager and rendering the automation of Slimefun useless.
I believe that #3341 is also related to this.
This causes also a major duplication exploit with the Network's Addon (not caused by Network itself, but cargo).
- Place an item into a Network Quantum storage that you want to dupe
- Place that Quantum storage into the output chest
- Place the same type of Quantum (but empty) into a chest that cargo will pull it out of and put it into the same chest as the other.
Cargo will create a stack of 2x the first Quantum instead of understanding based on Lore that they are different Quantums and do not both store the same item.
You can then place the Quantums down and have double the items. It works on any item, custom, unique, rare, keys, anything that's an ItemStack and can be placed into a Quantum can be duped because of this bug in Cargo.