Use Item->canStackWith() instead of Item->equals() wherever possible

This commit is contained in:
Dylan K. Taylor 2023-03-07 17:08:35 +00:00
parent 867b8945e4
commit fff8f0f815
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
2 changed files with 2 additions and 2 deletions

View File

@ -165,7 +165,7 @@ abstract class Furnace extends Spawnable implements Container, Nameable{
$furnaceType = $this->getFurnaceType();
$smelt = $this->position->getWorld()->getServer()->getCraftingManager()->getFurnaceRecipeManager($furnaceType)->match($raw);
$canSmelt = ($smelt instanceof FurnaceRecipe && $raw->getCount() > 0 && (($smelt->getResult()->equals($product) && $product->getCount() < $product->getMaxStackSize()) || $product->isNull()));
$canSmelt = ($smelt instanceof FurnaceRecipe && $raw->getCount() > 0 && (($smelt->getResult()->canStackWith($product) && $product->getCount() < $product->getMaxStackSize()) || $product->isNull()));
if($this->remainingFuelTime <= 0 && $canSmelt && $fuel->getFuelTime() > 0 && $fuel->getCount() > 0){
$this->checkFuel($fuel);

View File

@ -637,7 +637,7 @@ class Item implements \JsonSerializable{
* Returns whether the specified item stack has the same ID, damage, NBT and count as this item stack.
*/
final public function equalsExact(Item $other) : bool{
return $this->equals($other, true, true) && $this->count === $other->count;
return $this->canStackWith($other) && $this->count === $other->count;
}
final public function __toString() : string{