mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Item: Improve performance of nbtSerialize() (#4831)
Replace hasNamedTag() with $nbt->count() > 0 This avoids a duplicate indirect call to Item::serializeCompoundTag() method call when serializing items with namedtags.
This commit is contained in:
parent
55c744cc00
commit
55dfacea8d
@ -659,8 +659,9 @@ class Item implements \JsonSerializable{
|
||||
->setByte("Count", Binary::signByte($this->count))
|
||||
->setShort("Damage", $this->getMeta());
|
||||
|
||||
if($this->hasNamedTag()){
|
||||
$result->setTag("tag", $this->getNamedTag());
|
||||
$tag = $this->getNamedTag();
|
||||
if($tag->count() > 0){
|
||||
$result->setTag("tag", $tag);
|
||||
}
|
||||
|
||||
if($slot !== -1){
|
||||
|
Loading…
x
Reference in New Issue
Block a user