ItemFactory: extract fromStringSingle() from fromString()

on PM4, the multiple functionality is removed, but on PM3 this is a problem for phpstan.
This commit is contained in:
Dylan K. Taylor
2020-03-13 17:54:25 +00:00
parent 3907a2b6ba
commit f8ce01e2fd
6 changed files with 29 additions and 25 deletions

View File

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