mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-18 04:00:29 +00:00
Added VanillaItems::AIR()
we don't usually add VanillaItems entries for blocks since they already exist in VanillaBlocks, but air has a special use case specifically as an itemstack, so we make an exception for this case.
This commit is contained in:
@@ -32,7 +32,7 @@ abstract class Food extends Item implements FoodSourceItem{
|
||||
}
|
||||
|
||||
public function getResidue() : Item{
|
||||
return ItemFactory::air();
|
||||
return VanillaItems::AIR();
|
||||
}
|
||||
|
||||
public function getAdditionalEffects() : array{
|
||||
|
@@ -691,7 +691,7 @@ class Item implements \JsonSerializable{
|
||||
$item = LegacyStringToItemParser::getInstance()->parse($idTag->getValue() . ":$meta");
|
||||
}catch(LegacyStringToItemParserException $e){
|
||||
//TODO: improve error handling
|
||||
return ItemFactory::air();
|
||||
return VanillaItems::AIR();
|
||||
}
|
||||
$item->setCount($count);
|
||||
}else{
|
||||
|
@@ -478,6 +478,10 @@ class ItemFactory{
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see VanillaItems::AIR()
|
||||
*/
|
||||
public static function air() : Item{
|
||||
return self::getInstance()->get(ItemIds::AIR, 0, 0);
|
||||
}
|
||||
|
@@ -32,6 +32,7 @@ use pocketmine\utils\CloningRegistryTrait;
|
||||
* @generate-registry-docblock
|
||||
*
|
||||
* @method static Boat ACACIA_BOAT()
|
||||
* @method static ItemBlock AIR()
|
||||
* @method static Apple APPLE()
|
||||
* @method static Arrow ARROW()
|
||||
* @method static Potion AWKWARD_POTION()
|
||||
@@ -392,6 +393,8 @@ final class VanillaItems{
|
||||
|
||||
protected static function setup() : void{
|
||||
$factory = ItemFactory::getInstance();
|
||||
self::register("air", $factory->get(ItemIds::AIR, 0, 0));
|
||||
|
||||
self::register("acacia_boat", $factory->get(333, 4));
|
||||
self::register("apple", $factory->get(260));
|
||||
self::register("arrow", $factory->get(262));
|
||||
|
Reference in New Issue
Block a user