Rename some meta usages to variant

This commit is contained in:
Dylan K. Taylor 2018-10-26 18:20:37 +01:00
parent 7dd3b5b996
commit 93131b4d92
6 changed files with 13 additions and 13 deletions

View File

@ -37,8 +37,8 @@ class Banner extends Item{
public const TAG_PATTERN_COLOR = TileBanner::TAG_PATTERN_COLOR; public const TAG_PATTERN_COLOR = TileBanner::TAG_PATTERN_COLOR;
public const TAG_PATTERN_NAME = TileBanner::TAG_PATTERN_NAME; public const TAG_PATTERN_NAME = TileBanner::TAG_PATTERN_NAME;
public function __construct(int $meta){ public function __construct(int $variant){
parent::__construct(self::BANNER, $meta, "Banner"); parent::__construct(self::BANNER, $variant, "Banner");
} }
public function getBlock() : Block{ public function getBlock() : Block{

View File

@ -27,8 +27,8 @@ use pocketmine\block\Block;
use pocketmine\block\BlockFactory; use pocketmine\block\BlockFactory;
class Bed extends Item{ class Bed extends Item{
public function __construct(int $meta){ public function __construct(int $variant){
parent::__construct(self::BED, $meta, "Bed"); parent::__construct(self::BED, $variant, "Bed");
} }
public function getBlock() : Block{ public function getBlock() : Block{

View File

@ -27,8 +27,8 @@ use pocketmine\block\Block;
use pocketmine\block\BlockFactory; use pocketmine\block\BlockFactory;
class Dye extends Item{ class Dye extends Item{
public function __construct(int $meta){ public function __construct(int $variant){
parent::__construct(self::DYE, $meta, "Dye"); parent::__construct(self::DYE, $variant, "Dye");
} }
public function getBlock() : Block{ public function getBlock() : Block{

View File

@ -187,15 +187,15 @@ class Item implements ItemIds, \JsonSerializable{
* purpose. * purpose.
* *
* @param int $id * @param int $id
* @param int $meta * @param int $variant
* @param string $name * @param string $name
*/ */
public function __construct(int $id, int $meta = 0, string $name = "Unknown"){ public function __construct(int $id, int $variant = 0, string $name = "Unknown"){
if($id < -0x8000 or $id > 0x7fff){ //signed short range if($id < -0x8000 or $id > 0x7fff){ //signed short range
throw new \InvalidArgumentException("ID must be in range " . -0x8000 . " - " . 0x7fff); throw new \InvalidArgumentException("ID must be in range " . -0x8000 . " - " . 0x7fff);
} }
$this->id = $id; $this->id = $id;
$this->meta = $meta !== -1 ? $meta & 0x7FFF : -1; $this->meta = $variant !== -1 ? $variant & 0x7FFF : -1;
$this->name = $name; $this->name = $name;
} }

View File

@ -255,8 +255,8 @@ class Potion extends Item implements Consumable{
return []; return [];
} }
public function __construct(int $meta){ public function __construct(int $variant){
parent::__construct(self::POTION, $meta, "Potion"); parent::__construct(self::POTION, $variant, "Potion");
} }
public function getMaxStackSize() : int{ public function getMaxStackSize() : int{

View File

@ -27,8 +27,8 @@ use pocketmine\nbt\tag\CompoundTag;
class SplashPotion extends ProjectileItem{ class SplashPotion extends ProjectileItem{
public function __construct(int $meta){ public function __construct(int $variant){
parent::__construct(self::SPLASH_POTION, $meta, "Splash Potion"); parent::__construct(self::SPLASH_POTION, $variant, "Splash Potion");
} }
public function getMaxStackSize() : int{ public function getMaxStackSize() : int{