Soulbound rune breaks Infused Magnet
mrcoffee1026 opened this issue ยท 6 comments
Description (Required)
Apply Soulbound Rune to an Infused Magnet will make it "Soulbound"... but no longer an infused magnet. It no longer functions as an item after having done so.
Steps to reproduce the Issue (Required)
This can be "undone" by just placing the magnet and mining it again... as it has lost its special properties and just behaves as a "player_head" item it will place and mine... after you do this it is once again a working infused magnet, although no longer soul bound (you have wasted your rune).
Expected behavior (Required)
Would expect this item to behave in its usual way after applying the rune since other slimefun items function after doing so.
Server Log / Error Report
No errors appearing in logs in regards to this.
Environment (Required)
[14:57:20 INFO]: Paper v1_14_R1 (182)
[14:57:20 INFO]:
[14:57:20 INFO]: CS-CoreLib vDEV - 75 (git ed542c05)
[14:57:20 INFO]: Slimefun vDEV - 249 (git 4662144)
[14:57:20 INFO]:
[14:57:20 INFO]: Installed Addons (8)
[14:57:20 INFO]: Barrels vDEV - 7 (git 0d14dd9f)
[14:57:20 INFO]: ExtraGear vDEV - 3 (git de222ab7)
[14:57:20 INFO]: ChestTerminal vDEV - 14 (git ce632687)
[14:57:20 INFO]: HotbarPets vDEV - 19 (git 80168b1c)
[14:57:20 INFO]: ExoticGarden vDEV - 18 (git 0ad817dd)
[14:57:20 INFO]: SoulJars vDEV - 3 (git ebabf39f)
[14:57:20 INFO]: ElectricSpawners vDEV - 4 (git 2565651b)
[14:57:20 INFO]: ColoredEnderChests vDEV - 6 (git 6e80c4ba)
Not sure the best way around this, the ItemMeta wont equal since it does have Soulbound on it.
The error here for reference is the fact that in GearListener (ref) it does Inventory#containsAtLeast checking for an Infused Magnet. This wont ever match with the item due to the fact it has a different lore.
CraftMetaItem check - https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java#1134
A way to fix infused magnet isn't working would be changing containsAtLeast with a loop and SlimefunManager#isItemSimilar.
And about soulbound items losing their soulbound when placed should stay as it is and perhaps we should make them not placeable.
What can happen is assign Soulbound through the PersistentDataAPI (CS-CoreLib2 0.5) and then we can check on pickup really easily.
For the actual issue at hand though, yeah, maybe a custom solution would be needed. In an item comparison we just need to ignore a "Soulbound" lore line. It's simple but awkward.
I honestly think that the hackiest approach may be the best for performance reasons.
Just add an OR statement checking for a soulbound version as well :?
How many other items could this happen too that's what I'm thinking, I think there needs to be a more native solution.
@WalshyDev Your native solution exists here:
https://github.com/TheBusyBiscuit/Slimefun4/blob/master/src/me/mrCookieSlime/Slimefun/Setup/SlimefunManager.java#L133
SlimefunManager.isItemSimiliar() already skips this line. Only items that use .contains or so will need a special case.