Add a way to compare NBT leniently (#209)

* Fix itemstack comparator not handling NBT leniently
* add util function to PositionedStack
This commit is contained in:
miozune authored and GitHub committed 2022-02-07 12:12:26 -08:00
1 parent 3291dab52d
commit 6609911d96
4 files changed
+101 -2

No files matched your search

@@ -49,14 +49,14 @@ public class CatalystInfoList extends ForwardingList<CatalystInfo> {
}
public boolean contains(ItemStack stack) {
return catalystInfoList.stream().anyMatch(c -> NEIServerUtils.areStacksSameType(c.getStack(), stack));
return catalystInfoList.stream().anyMatch(c -> NEIServerUtils.areStacksSameTypeCraftingWithNBT(c.getStack(), stack));
}
public boolean remove(ItemStack stack) {
Iterator<CatalystInfo> iter = catalystInfoList.iterator();
while (iter.hasNext()) {
ItemStack next = iter.next().getStack();
if (NEIServerUtils.areStacksSameType(next, stack)) {
if (NEIServerUtils.areStacksSameTypeCraftingWithNBT(next, stack)) {
iter.remove();
return true;
}