mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 00:07:30 +00:00
Fixed Item->equals() not working for no-NBT items since 9bb3c93285d8589cde855b08318e32514eff78c4
This commit is contained in:
parent
3760307a88
commit
95be571481
@ -785,10 +785,11 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
final public function equals(Item $item, bool $checkDamage = true, bool $checkCompound = true) : bool{
|
||||
if($this->id === $item->getId() and (!$checkDamage or $this->getDamage() === $item->getDamage())){
|
||||
if($checkCompound){
|
||||
if($this->hasNamedTag() and $item->hasNamedTag()){
|
||||
//Serialized NBT didn't match, check the cached object tree.
|
||||
if($this->hasNamedTag() and $item->hasNamedTag()){ //both items have NBT
|
||||
return $this->getNamedTag()->equals($item->getNamedTag());
|
||||
}
|
||||
|
||||
return (!$this->hasNamedTag() and !$item->hasNamedTag()); //both items must have no NBT
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user