ItemTypeIds::toBlockTypeId() now returns null for non-blockitem IDs

closes #5648
This commit is contained in:
Dylan K. Taylor 2023-04-05 21:04:00 +01:00
parent 7e1467f3f7
commit dbcd2b1e65
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -320,9 +320,9 @@ final class ItemTypeIds{
return -$blockTypeId;
}
public static function toBlockTypeId(int $itemTypeId) : int{
if($itemTypeId > 0){
throw new \InvalidArgumentException("Item type ID $itemTypeId does not represent a block");
public static function toBlockTypeId(int $itemTypeId) : ?int{
if($itemTypeId > 0){ //not a blockitem
return null;
}
return -$itemTypeId;
}