diff --git a/src/item/Item.php b/src/item/Item.php index b28bf9066..f37015ba9 100644 --- a/src/item/Item.php +++ b/src/item/Item.php @@ -37,6 +37,7 @@ use pocketmine\math\Vector3; use pocketmine\nbt\LittleEndianNbtSerializer; use pocketmine\nbt\NBT; use pocketmine\nbt\NbtDataException; +use pocketmine\nbt\NbtException; use pocketmine\nbt\tag\CompoundTag; use pocketmine\nbt\tag\ListTag; use pocketmine\nbt\tag\ShortTag; @@ -240,6 +241,7 @@ class Item implements \JsonSerializable{ * Sets the Item's NBT from the supplied CompoundTag object. * * @return $this + * @throws NbtException */ public function setNamedTag(CompoundTag $tag) : Item{ if($tag->getCount() === 0){ @@ -255,6 +257,7 @@ class Item implements \JsonSerializable{ /** * Removes the Item's NBT. * @return $this + * @throws NbtException */ public function clearNamedTag() : Item{ $this->nbt = new CompoundTag(); @@ -262,6 +265,9 @@ class Item implements \JsonSerializable{ return $this; } + /** + * @throws NbtException + */ protected function deserializeCompoundTag(CompoundTag $tag) : void{ $this->customName = ""; $this->lore = []; diff --git a/src/item/ItemFactory.php b/src/item/ItemFactory.php index 5fb7438a1..0e1a710ce 100644 --- a/src/item/ItemFactory.php +++ b/src/item/ItemFactory.php @@ -41,6 +41,7 @@ use pocketmine\entity\Villager; use pocketmine\entity\Zombie; use pocketmine\inventory\ArmorInventory; use pocketmine\math\Vector3; +use pocketmine\nbt\NbtException; use pocketmine\nbt\tag\CompoundTag; use pocketmine\utils\SingletonTrait; use pocketmine\world\World; @@ -444,6 +445,7 @@ class ItemFactory{ * Deserializes an item from the provided legacy ID, legacy meta, count and NBT. * * @throws \InvalidArgumentException + * @throws NbtException */ public function get(int $id, int $meta = 0, int $count = 1, ?CompoundTag $tags = null) : Item{ /** @var Item|null $item */