Slimefun4 icon indicating copy to clipboard operation
Slimefun4 copied to clipboard

Cargo ignores lore of slimefun items, causing backpacks to stack.

Open Boomer-1 opened this issue 3 years ago โ€ข 13 comments
trafficstars

โ— Checklist

  • [X] I am using the official english version of Slimefun and did not modify the jar.
  • [X] I am using an up to date "DEV" (not "RC") version of Slimefun.
  • [X] I am aware that issues related to Slimefun addons need to be reported on their bug trackers and not here.
  • [X] 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

https://youtu.be/O00yWZRFdno

๐Ÿ“œ 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

Boomer-1 avatar Dec 20 '21 18:12 Boomer-1

Just speculating, since backpacks are Slimefun items, the optimization on https://github.com/Slimefun/Slimefun4/pull/3258 probably have caused this side effects.

variananora avatar Dec 21 '21 01:12 variananora

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

Alessio-Colombo avatar Dec 21 '21 09:12 Alessio-Colombo

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.

https://user-images.githubusercontent.com/20646323/146905258-1391a58d-8299-4f55-9d34-ae9ea2e220ba.mp4

Sefiraat avatar Dec 21 '21 09:12 Sefiraat

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?

WalshyDev avatar Dec 21 '21 19:12 WalshyDev

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

Sefiraat avatar Dec 21 '21 19:12 Sefiraat

Is SlimefunUtils.isItemSimilar supposed to check for equal values or are the items allowed to differ in meta or nbt?

char3210 avatar Dec 21 '21 22:12 char3210

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).

NCBPFluffyBear avatar Dec 21 '21 22:12 NCBPFluffyBear

the problem is that slimefun backpacks have the same id

char3210 avatar Dec 21 '21 22:12 char3210

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

J3fftw1 avatar Jan 02 '22 12:01 J3fftw1

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

Sefiraat avatar Jan 02 '22 14:01 Sefiraat

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 avatar Feb 19 '22 07:02 kuzuanpa

so broken&fixed spawner and staff_elemental_storm is affected too.

kuzuanpa avatar Feb 20 '22 15:02 kuzuanpa

@kuzuanpa We already aware of the issue, you dont need to report every broken item.

variananora avatar Feb 20 '22 15:02 variananora

Any updates on this issue? Have run across several servers disabling the cargo manager and rendering the automation of Slimefun useless.

LaLlorrana avatar Oct 29 '22 06:10 LaLlorrana

I believe that #3341 is also related to this.

Boomer-1 avatar Dec 18 '22 18:12 Boomer-1

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.

test137E29B avatar May 08 '23 20:05 test137E29B