This commit is contained in:
PEMapModder 2016-02-22 16:29:41 +08:00
parent 17c73e9764
commit 1574a823d4

View File

@ -25,23 +25,18 @@
namespace pocketmine\item;
use pocketmine\block\Block;
use pocketmine\block\Fence;
use pocketmine\block\Flower;
use pocketmine\entity\Entity;
use pocketmine\entity\Squid;
use pocketmine\entity\Villager;
use pocketmine\entity\Zombie;
use pocketmine\inventory\Fuel;
use pocketmine\item\enchantment\Enchantment;
use pocketmine\level\Level;
use pocketmine\nbt\NBT;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\ListTag;
use pocketmine\nbt\tag\ShortTag;
use pocketmine\nbt\tag\StringTag;
use pocketmine\Player;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\NBT;
use pocketmine\utils\Config;
use pocketmine\Server;
use pocketmine\utils\Config;
class Item{
@ -679,6 +674,7 @@ class Item{
/**
* @param $index
*
* @return Item
*/
public static function getCreativeItem(int $index){
@ -713,6 +709,7 @@ class Item{
/**
* @param string $str
* @param bool $multiple
*
* @return Item[]|Item
*/
public static function fromString(string $str, bool $multiple = false){
@ -851,6 +848,7 @@ class Item{
/**
* @param $id
*
* @return Enchantment|null
*/
public function getEnchantment(int $id){
@ -963,7 +961,7 @@ class Item{
$this->clearCustomName();
}
if(!$this->hasCompoundTag()){
if(!($hadCompoundTag = $this->hasCompoundTag())){
$tag = new CompoundTag("", []);
}else{
$tag = $this->getNamedTag();
@ -977,6 +975,10 @@ class Item{
]);
}
if(!$hadCompoundTag){
$this->setCompoundTag($tag);
}
return $this;
}