mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 01:39:52 +00:00
Merge branch 'release/3.3'
This commit is contained in:
commit
a55ab54ddb
@ -74,6 +74,9 @@ class ItemEntity extends Entity{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->item = Item::nbtDeserialize($itemTag);
|
$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));
|
$this->server->getPluginManager()->callEvent(new ItemSpawnEvent($this));
|
||||||
|
@ -956,7 +956,12 @@ class Item implements ItemIds, \JsonSerializable{
|
|||||||
if($idTag instanceof ShortTag){
|
if($idTag instanceof ShortTag){
|
||||||
$item = ItemFactory::get($idTag->getValue(), $meta, $count);
|
$item = ItemFactory::get($idTag->getValue(), $meta, $count);
|
||||||
}elseif($idTag instanceof StringTag){ //PC item save format
|
}elseif($idTag instanceof StringTag){ //PC item save format
|
||||||
|
try{
|
||||||
$item = ItemFactory::fromString($idTag->getValue());
|
$item = ItemFactory::fromString($idTag->getValue());
|
||||||
|
}catch(\InvalidArgumentException $e){
|
||||||
|
//TODO: improve error handling
|
||||||
|
return ItemFactory::get(Item::AIR, 0, 0);
|
||||||
|
}
|
||||||
$item->setDamage($meta);
|
$item->setDamage($meta);
|
||||||
$item->setCount($count);
|
$item->setCount($count);
|
||||||
}else{
|
}else{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user