Sponge
Sponge copied to clipboard
ItemStackComparators.IGNORE_SIZE not working
Affected Product(s)
SpongeVanilla
Version
1.16.5-8.2.0-SNAPSHOT
Operating System
Windows
Java Version
17
Plugins/Mods
Just the affected plugin.
Describe the bug
I would expect that this method always returns the same as the sponge implementation, but it seems to always return -1.
public static Predicate<ItemStack> ignoreSizeFilter(ItemStack item) {
ItemStack item1 = item.copy();
item1.setQuantity(1);
return i -> {
ItemStack iCopy = i.copy();
iCopy.setQuantity(1);
boolean ourResult = iCopy.equalTo(item1);
boolean theirResult = ItemStackComparators.IGNORE_SIZE.get().compare(item, i) == 0;
System.out.println("Our result: " + ourResult + ", theirResult: " + theirResult);
System.out.println("Compare self: " + ItemStackComparators.IGNORE_SIZE.get().compare(i, i));
return ourResult;
};
}
Causes output like:
Our result: true, theirResult: false
Compare self: -1
The fact that comparing two identical objects do not give 0 suggests that it is definitely broken.
Link to logs
No response
Same bug appears in API11:
Minecraft: 1.20
SpongeAPI: 11.0.0-SNAPSHOT
Sponge: 1.20-11.0.0-SNAPSHOT
SpongeVanilla: 1.20-11.0.0-RC1348
JVM: 17.0.8.1/64-bit (Amazon.com Inc.)
OS: Windows 10/10.0 (amd64)