Added some documentation

This commit is contained in:
Dylan K. Taylor 2017-08-22 10:28:43 +01:00
parent c32b75fa18
commit 8a35b9da29
4 changed files with 23 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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);
}

View File

@ -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
*