Skip to content

Commit 654e3f4

Browse files
committed
Check NBT in WrappedItemStack#equals
1 parent 64bca50 commit 654e3f4

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/stack/WrappedItemStack.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,19 @@ public boolean equals(ItemStack itemStack) {
261261
@Override
262262
public boolean equals(Object other) {
263263
if (other instanceof IAEItemStack stack) {
264-
return this.delegate.isItemEqual(stack.createItemStack());
264+
ItemStack otherStack = stack.getCachedItemStack(stack.getStackSize());
265+
NBTTagCompound thisTag = delegate.getTagCompound();
266+
NBTTagCompound otherTag = otherStack.getTagCompound();
267+
268+
boolean nbtMatch;
269+
if (thisTag == null) {
270+
nbtMatch = otherTag == null;
271+
} else {
272+
// noinspection PointlessNullCheck
273+
nbtMatch = otherTag != null && thisTag.equals(otherTag);
274+
}
275+
276+
return this.delegate.isItemEqual(otherStack) && nbtMatch;
265277
} else if (other instanceof ItemStack itemStack) {
266278
return this.equals(itemStack);
267279
}

0 commit comments

Comments
 (0)