diff --git a/src/pocketmine/block/Block.php b/src/pocketmine/block/Block.php index 37bd54387..0dc4cd5a5 100644 --- a/src/pocketmine/block/Block.php +++ b/src/pocketmine/block/Block.php @@ -43,7 +43,9 @@ use pocketmine\plugin\Plugin; class Block extends Position implements BlockIds, Metadatable{ /** - * @deprecated This functionality has moved to {@link BlockFactory#get} + * Returns a new Block instance with the specified ID, meta and position. + * + * This function redirects to {@link BlockFactory#get}. * * @param int $id * @param int $meta diff --git a/src/pocketmine/block/BlockFactory.php b/src/pocketmine/block/BlockFactory.php index ecaeb12d4..f00d8e15f 100644 --- a/src/pocketmine/block/BlockFactory.php +++ b/src/pocketmine/block/BlockFactory.php @@ -360,6 +360,8 @@ class BlockFactory{ } /** + * Returns a new Block instance with the specified ID, meta and position. + * * @param int $id * @param int $meta * @param Position $pos diff --git a/src/pocketmine/item/Item.php b/src/pocketmine/item/Item.php index 08a467df4..8adc74152 100644 --- a/src/pocketmine/item/Item.php +++ b/src/pocketmine/item/Item.php @@ -77,6 +77,10 @@ class Item implements ItemIds, \JsonSerializable{ } /** + * Returns a new Item instance with the specified ID, damage, count and NBT. + * + * This function redirects to {@link ItemFactory#get}. + * * @param int $id * @param int $meta * @param int $count @@ -84,18 +88,20 @@ class Item implements ItemIds, \JsonSerializable{ * * @return Item */ - public static function get(int $id, int $meta = 0, int $count = 1, $tags = "") : Item{ return ItemFactory::get($id, $meta, $count, $tags); } /** + * Tries to parse the specified string into Item ID/meta identifiers, and returns Item instances it created. + * + * This function redirects to {@link ItemFactory#fromString}. + * * @param string $str * @param bool $multiple * * @return Item[]|Item */ - public static function fromString(string $str, bool $multiple = false){ return ItemFactory::fromString($str, $multiple); } diff --git a/src/pocketmine/item/ItemFactory.php b/src/pocketmine/item/ItemFactory.php index f05f7915d..382d27cab 100644 --- a/src/pocketmine/item/ItemFactory.php +++ b/src/pocketmine/item/ItemFactory.php @@ -249,6 +249,16 @@ class ItemFactory{ } /** + * Tries to parse the specified string into Item ID/meta identifiers, and returns Item instances it created. + * + * Example accepted formats: + * - `diamond_pickaxe:5` + * - `minecraft:string` + * - `351:4 (lapis lazuli ID:meta)` + * + * If multiple item instances are to be created, their identifiers must be comma-separated, for example: + * `diamond_pickaxe,wooden_shovel:18,iron_ingot` + * * @param string $str * @param bool $multiple *