Add equals(ItemStack) to IAEItemStack contract.
This commit is contained in:
@@ -106,4 +106,13 @@ public interface IAEItemStack extends IAEStack<IAEItemStack> {
|
|||||||
* @return definition stack
|
* @return definition stack
|
||||||
*/
|
*/
|
||||||
ItemStack getDefinition();
|
ItemStack getDefinition();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare this AE item stack to another item stack, but ignores
|
||||||
|
* the amount. It checks the item type, NBT and damage values.
|
||||||
|
*
|
||||||
|
* @param is An item stack
|
||||||
|
*/
|
||||||
|
boolean equals(ItemStack is);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -216,11 +216,16 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
|||||||
if (ia instanceof AEItemStack) {
|
if (ia instanceof AEItemStack) {
|
||||||
return this.isSameType((AEItemStack) ia);
|
return this.isSameType((AEItemStack) ia);
|
||||||
} else if (ia instanceof ItemStack) {
|
} else if (ia instanceof ItemStack) {
|
||||||
return this.isSameType((ItemStack) ia);
|
// this actually breaks the equals contract (being equals to unrelated classes)
|
||||||
|
return equals((ItemStack) ia);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean equals(final ItemStack is) {
|
||||||
|
return this.isSameType(is);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return this.getStackSize() + "x" + this.getDefinition().getItem().getRegistryName();
|
return this.getStackSize() + "x" + this.getDefinition().getItem().getRegistryName();
|
||||||
|
|||||||
Reference in New Issue
Block a user