mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-16 08:25:29 +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:
parent
6ba3b39541
commit
79125b8426
@ -706,4 +706,13 @@ final class BlockTypeIds{
|
|||||||
public const FROGLIGHT = 10679;
|
public const FROGLIGHT = 10679;
|
||||||
|
|
||||||
public const FIRST_UNUSED_BLOCK_ID = 10680;
|
public const FIRST_UNUSED_BLOCK_ID = 10680;
|
||||||
|
|
||||||
|
private static int $nextDynamicId = self::FIRST_UNUSED_BLOCK_ID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new runtime block type ID, e.g. for use by a custom block.
|
||||||
|
*/
|
||||||
|
public static function newId() : int{
|
||||||
|
return self::$nextDynamicId++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -298,4 +298,13 @@ final class ItemTypeIds{
|
|||||||
public const LINGERING_POTION = 20259;
|
public const LINGERING_POTION = 20259;
|
||||||
|
|
||||||
public const FIRST_UNUSED_ITEM_ID = 20260;
|
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++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user