mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-16 11:58:00 +00:00
ItemSerializer: avoid slow NBT check
hasNamedTag() rebuilds the NBT from item properties to decide if there's any NBT. This is a waste of resources when we then fetch the tag to encode anyway.
This commit is contained in:
@@ -117,8 +117,8 @@ final class ItemSerializer{
|
||||
$data = $serializer($item);
|
||||
}
|
||||
|
||||
if($item->hasNamedTag()){
|
||||
$resultTag = $item->getNamedTag();
|
||||
$resultTag = $item->getNamedTag();
|
||||
if($resultTag->count() > 0){
|
||||
$extraTag = $data->getTag();
|
||||
if($extraTag !== null){
|
||||
$resultTag = $resultTag->merge($extraTag);
|
||||
|
Reference in New Issue
Block a user