Added APIs to get a new unique block/item type ID

this centralization is needed to avoid conflicts between different plugins fighting over the same hardcoded IDs.
This commit is contained in:
Dylan K. Taylor
2022-07-24 22:02:47 +01:00
parent 6ba3b39541
commit 79125b8426
2 changed files with 18 additions and 0 deletions

View File

@@ -298,4 +298,13 @@ final class ItemTypeIds{
public const LINGERING_POTION = 20259;
public const FIRST_UNUSED_ITEM_ID = 20260;
private static int $nextDynamicId = self::FIRST_UNUSED_ITEM_ID;
/**
* Returns a new runtime item type ID, e.g. for use by a custom item.
*/
public static function newId() : int{
return self::$nextDynamicId++;
}
}