![Extended Drawers](https://media.forgecdn.net/avatars/thumbnails/538/621/256/256/637863952831371196.png)
[Bug 1.18.2] Crash when placing enchanted sword in drawer
itsdinkd opened this issue ยท 7 comments
Description of the issue
Occuring on Another Quality Modpack 2.
Looks like there is a coxinha utilities wooden hopper also involved that the player is using associated with a extended drawer.
Reproduction steps
Put an enchanted sword into a drawer
Crash
Mod version
1.2.1
Operating System
linux
Minecraft version
1.18.2
Other mods
see crash report
Server
Happens
Client
Not tested
Logs
https://gist.github.com/itsdinkd/c8d4c5829a95e5098f51eb7214987029
Extra Context
No response
Yes @AlexIIL is right here, variants should never be compared with ==.
As for crashing, it's probably better to silently void items, but crashing is rare enough atm that it's fine.
Seems like the LibBlockAttributes transfer api compat is broken. Will ask the if they know anything about this.
From a brief look, it might be caused by the identity check here:
As far as I'm aware, transfer API doesn't cache
ItemVariant
s that have NBT [1], so you'd need to use .equals()
here rather than an identity check.
For context, LBA (like forge) is simulation based, which means it needs to simulate the extraction before actually extracting it - there's two methods in LBA relevant here (ItemInvUtil.move(4 args), and TransferItemApiCompat.Transfer2Lba.attemptExtraction())
1: It passes the ItemVariant
that it found in the inventory back to the inventory (so it can extract successfully the first time)
2: It then creates a new ItemVariant
based on the exact ItemStack
found - for enchanted tools this will have NBT, and so won't be the same object - which will probably fail the identity check in ExtendedDrawers.
That does indeed seem to be the issue. I'd suggest maybe not crashing when that happens, but I will fix it on my end in a few days when I have time.
Could you check if this version fixes it?