mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-27 21:59:52 +00:00
ItemFactory: clean up some unnecessary code
this try/catch isn't needed because the list offset derivation function will deal with invalid IDs anyway.
This commit is contained in:
parent
e7494fff96
commit
a2a6286e1c
@ -346,7 +346,6 @@ class ItemFactory{
|
||||
/** @var Item $item */
|
||||
$item = null;
|
||||
if($meta !== -1){
|
||||
try{
|
||||
$sublist = self::$list[self::getListOffset($id)];
|
||||
|
||||
/** @var Item|null $listed */
|
||||
@ -359,13 +358,8 @@ class ItemFactory{
|
||||
$item->setDamage($meta);
|
||||
}
|
||||
}elseif($id < 256){ //intentionally includes negatives, for extended block IDs
|
||||
/* Blocks must have a damage value 0-15, but items can have damage value -1 to indicate that they are
|
||||
* crafting ingredients with any-damage. */
|
||||
$item = new ItemBlock($id, $meta);
|
||||
}
|
||||
}catch(\RuntimeException $e){
|
||||
throw new \InvalidArgumentException("Item ID $id is invalid or out of bounds");
|
||||
}
|
||||
}
|
||||
|
||||
if($item === null){
|
||||
|
Loading…
x
Reference in New Issue
Block a user