mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
Fix setting item custom name does not update inventory
If a NamedTag was already present, it was modifying the object directly WITHOUT serializing the tag back to raw NBT for sending. This commit fixes that by always serializing the tag on change.
This commit is contained in:
parent
b566c4e609
commit
058468104a
@ -559,7 +559,7 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
$this->clearCustomName();
|
||||
}
|
||||
|
||||
if(!($hadCompoundTag = $this->hasCompoundTag())){
|
||||
if($this->hasCompoundTag()){
|
||||
$tag = new CompoundTag("", []);
|
||||
}else{
|
||||
$tag = $this->getNamedTag();
|
||||
@ -573,9 +573,7 @@ class Item implements ItemIds, \JsonSerializable{
|
||||
]);
|
||||
}
|
||||
|
||||
if(!$hadCompoundTag){
|
||||
$this->setCompoundTag($tag);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user