Merge branch 'release/3.3'

This commit is contained in:
Dylan K. Taylor 2018-09-20 19:02:48 +01:00
commit a55ab54ddb
2 changed files with 9 additions and 1 deletions

View File

@ -74,6 +74,9 @@ class ItemEntity extends Entity{
}
$this->item = Item::nbtDeserialize($itemTag);
if($this->item->isNull()){
throw new \UnexpectedValueException("Item for " . get_class($this) . " is invalid");
}
$this->server->getPluginManager()->callEvent(new ItemSpawnEvent($this));

View File

@ -956,7 +956,12 @@ class Item implements ItemIds, \JsonSerializable{
if($idTag instanceof ShortTag){
$item = ItemFactory::get($idTag->getValue(), $meta, $count);
}elseif($idTag instanceof StringTag){ //PC item save format
$item = ItemFactory::fromString($idTag->getValue());
try{
$item = ItemFactory::fromString($idTag->getValue());
}catch(\InvalidArgumentException $e){
//TODO: improve error handling
return ItemFactory::get(Item::AIR, 0, 0);
}
$item->setDamage($meta);
$item->setCount($count);
}else{