mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-06 01:51:51 +00:00
ItemTypeIds::toBlockTypeId() now returns null for non-blockitem IDs
closes #5648
This commit is contained in:
parent
7e1467f3f7
commit
dbcd2b1e65
@ -320,9 +320,9 @@ final class ItemTypeIds{
|
|||||||
return -$blockTypeId;
|
return -$blockTypeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function toBlockTypeId(int $itemTypeId) : int{
|
public static function toBlockTypeId(int $itemTypeId) : ?int{
|
||||||
if($itemTypeId > 0){
|
if($itemTypeId > 0){ //not a blockitem
|
||||||
throw new \InvalidArgumentException("Item type ID $itemTypeId does not represent a block");
|
return null;
|
||||||
}
|
}
|
||||||
return -$itemTypeId;
|
return -$itemTypeId;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user