mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-19 23:37:45 +00:00
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:
@@ -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++;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user