Added API method Item::canStackWith()

This commit is contained in:
Dylan K. Taylor
2021-06-29 19:52:52 +01:00
parent 32d7b1e6af
commit 7ba573db77
6 changed files with 13 additions and 5 deletions

View File

@@ -566,6 +566,13 @@ class Item implements \JsonSerializable{
(!$checkCompound or $this->getNamedTag()->equals($item->getNamedTag()));
}
/**
* Returns whether this item could stack with the given item (ignoring stack size and count).
*/
final public function canStackWith(Item $other) : bool{
return $this->equals($other, true, true);
}
/**
* Returns whether the specified item stack has the same ID, damage, NBT and count as this item stack.
*/