From 058468104a660932570e10e850367225b215bc23 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 10 Jan 2017 00:38:23 +0000 Subject: [PATCH] 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. --- src/pocketmine/item/Item.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/pocketmine/item/Item.php b/src/pocketmine/item/Item.php index 20e222b81..4d264fd6a 100644 --- a/src/pocketmine/item/Item.php +++ b/src/pocketmine/item/Item.php @@ -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); - } + $this->setCompoundTag($tag); return $this; }