mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
ItemFactory: do not explode on invalid damage values for durables
just treat them as unknown items instead this might break some use cases, but at least this way they won't crash the server when read from disk and they won't get lost either.
This commit is contained in:
parent
ac4c1c9086
commit
ec13aa659a
@ -409,7 +409,11 @@ class ItemFactory{
|
||||
}elseif(isset($this->list[$zero = self::getListOffset($id, 0)]) and $this->list[$zero] instanceof Durable){
|
||||
/** @var Durable $item */
|
||||
$item = clone $this->list[$zero];
|
||||
$item->setDamage($meta);
|
||||
try{
|
||||
$item->setDamage($meta);
|
||||
}catch(\InvalidArgumentException $e){
|
||||
$item = new Item($id, $meta);
|
||||
}
|
||||
}elseif($id < 256){ //intentionally includes negatives, for extended block IDs
|
||||
$item = new ItemBlock($id, $meta);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user