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:
Dylan K. Taylor 2018-10-17 17:12:53 +01:00
parent e7494fff96
commit a2a6286e1c

View File

@ -346,7 +346,6 @@ class ItemFactory{
/** @var Item $item */ /** @var Item $item */
$item = null; $item = null;
if($meta !== -1){ if($meta !== -1){
try{
$sublist = self::$list[self::getListOffset($id)]; $sublist = self::$list[self::getListOffset($id)];
/** @var Item|null $listed */ /** @var Item|null $listed */
@ -359,13 +358,8 @@ class ItemFactory{
$item->setDamage($meta); $item->setDamage($meta);
} }
}elseif($id < 256){ //intentionally includes negatives, for extended block IDs }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); $item = new ItemBlock($id, $meta);
} }
}catch(\RuntimeException $e){
throw new \InvalidArgumentException("Item ID $id is invalid or out of bounds");
}
} }
if($item === null){ if($item === null){