mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-19 15:36:08 +00:00
Migrate all but two remaining legacy enums to native PHP 8.1 enums
This commit is contained in:
@@ -40,7 +40,7 @@ class Banner extends ItemBlockWallOrFloor{
|
||||
public const TAG_PATTERN_COLOR = TileBanner::TAG_PATTERN_COLOR;
|
||||
public const TAG_PATTERN_NAME = TileBanner::TAG_PATTERN_NAME;
|
||||
|
||||
private DyeColor $color;
|
||||
private DyeColor $color = DyeColor::BLACK;
|
||||
|
||||
/**
|
||||
* @var BannerPatternLayer[]
|
||||
@@ -48,11 +48,6 @@ class Banner extends ItemBlockWallOrFloor{
|
||||
*/
|
||||
private array $patterns = [];
|
||||
|
||||
public function __construct(ItemIdentifier $identifier, Block $floorVariant, Block $wallVariant){
|
||||
parent::__construct($identifier, $floorVariant, $wallVariant);
|
||||
$this->color = DyeColor::BLACK();
|
||||
}
|
||||
|
||||
public function getColor() : DyeColor{
|
||||
return $this->color;
|
||||
}
|
||||
@@ -102,7 +97,7 @@ class Banner extends ItemBlockWallOrFloor{
|
||||
if($patterns !== null && $patterns->getTagType() === NBT::TAG_Compound){
|
||||
/** @var CompoundTag $t */
|
||||
foreach($patterns as $t){
|
||||
$patternColor = $colorIdMap->fromInvertedId($t->getInt(self::TAG_PATTERN_COLOR)) ?? DyeColor::BLACK(); //TODO: missing pattern colour should be an error
|
||||
$patternColor = $colorIdMap->fromInvertedId($t->getInt(self::TAG_PATTERN_COLOR)) ?? DyeColor::BLACK; //TODO: missing pattern colour should be an error
|
||||
$patternType = $patternIdMap->fromId($t->getString(self::TAG_PATTERN_NAME));
|
||||
if($patternType === null){
|
||||
continue; //TODO: this should be an error
|
||||
|
@@ -27,12 +27,7 @@ use pocketmine\block\utils\DyeColor;
|
||||
use pocketmine\data\runtime\RuntimeDataDescriber;
|
||||
|
||||
class Dye extends Item{
|
||||
private DyeColor $color;
|
||||
|
||||
public function __construct(ItemIdentifier $identifier, string $name){
|
||||
$this->color = DyeColor::BLACK();
|
||||
parent::__construct($identifier, $name);
|
||||
}
|
||||
private DyeColor $color = DyeColor::BLACK;
|
||||
|
||||
protected function describeState(RuntimeDataDescriber $w) : void{
|
||||
$w->dyeColor($this->color);
|
||||
|
@@ -33,7 +33,7 @@ class GlassBottle extends Item{
|
||||
public function onInteractBlock(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, array &$returnedItems) : ItemUseResult{
|
||||
if($blockClicked->getTypeId() === BlockTypeIds::WATER){
|
||||
$this->pop();
|
||||
$returnedItems[] = VanillaItems::POTION()->setType(PotionType::WATER());
|
||||
$returnedItems[] = VanillaItems::POTION()->setType(PotionType::WATER);
|
||||
|
||||
return ItemUseResult::SUCCESS;
|
||||
}
|
||||
|
@@ -29,12 +29,7 @@ use pocketmine\player\Player;
|
||||
|
||||
class Medicine extends Item implements ConsumableItem{
|
||||
|
||||
private MedicineType $medicineType;
|
||||
|
||||
public function __construct(ItemIdentifier $identifier, string $name){
|
||||
$this->medicineType = MedicineType::EYE_DROPS();
|
||||
parent::__construct($identifier, $name);
|
||||
}
|
||||
private MedicineType $medicineType = MedicineType::EYE_DROPS;
|
||||
|
||||
protected function describeState(RuntimeDataDescriber $w) : void{
|
||||
$w->medicineType($this->medicineType);
|
||||
|
@@ -25,42 +25,39 @@ namespace pocketmine\item;
|
||||
|
||||
use pocketmine\entity\effect\Effect;
|
||||
use pocketmine\entity\effect\VanillaEffects;
|
||||
use pocketmine\utils\EnumTrait;
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
|
||||
/**
|
||||
* This doc-block is generated automatically, do not modify it manually.
|
||||
* This must be regenerated whenever registry members are added, removed or changed.
|
||||
* @see build/generate-registry-annotations.php
|
||||
* @generate-registry-docblock
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static MedicineType ANTIDOTE()
|
||||
* @method static MedicineType ELIXIR()
|
||||
* @method static MedicineType EYE_DROPS()
|
||||
* @method static MedicineType TONIC()
|
||||
*/
|
||||
final class MedicineType{
|
||||
use EnumTrait {
|
||||
__construct as Enum___construct;
|
||||
enum MedicineType{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case ANTIDOTE;
|
||||
case ELIXIR;
|
||||
case EYE_DROPS;
|
||||
case TONIC;
|
||||
|
||||
/**
|
||||
* @phpstan-return array{0: string, 1: Effect}
|
||||
*/
|
||||
private function getMetadata() : array{
|
||||
//cache not required here - VanillaEffects always returns the same object
|
||||
return match($this){
|
||||
self::ANTIDOTE => ['Antidote', VanillaEffects::POISON()],
|
||||
self::ELIXIR => ['Elixir', VanillaEffects::WEAKNESS()],
|
||||
self::EYE_DROPS => ['Eye Drops', VanillaEffects::BLINDNESS()],
|
||||
self::TONIC => ['Tonic', VanillaEffects::NAUSEA()]
|
||||
};
|
||||
}
|
||||
|
||||
protected static function setup() : void{
|
||||
self::registerAll(
|
||||
new self('antidote', 'Antidote', VanillaEffects::POISON()),
|
||||
new self('elixir', 'Elixir', VanillaEffects::WEAKNESS()),
|
||||
new self('eye_drops', 'Eye Drops', VanillaEffects::BLINDNESS()),
|
||||
new self('tonic', 'Tonic', VanillaEffects::NAUSEA())
|
||||
);
|
||||
}
|
||||
public function getDisplayName() : string{ return $this->getMetadata()[0]; }
|
||||
|
||||
private function __construct(
|
||||
string $enumName,
|
||||
private string $displayName,
|
||||
private Effect $curedEffect
|
||||
){
|
||||
$this->Enum___construct($enumName);
|
||||
}
|
||||
|
||||
public function getDisplayName() : string{ return $this->displayName; }
|
||||
|
||||
public function getCuredEffect() : Effect{ return $this->curedEffect; }
|
||||
public function getCuredEffect() : Effect{ return $this->getMetadata()[1]; }
|
||||
}
|
||||
|
@@ -29,12 +29,7 @@ use pocketmine\player\Player;
|
||||
|
||||
class Potion extends Item implements ConsumableItem{
|
||||
|
||||
private PotionType $potionType;
|
||||
|
||||
public function __construct(ItemIdentifier $identifier, string $name){
|
||||
$this->potionType = PotionType::WATER();
|
||||
parent::__construct($identifier, $name);
|
||||
}
|
||||
private PotionType $potionType = PotionType::WATER;
|
||||
|
||||
protected function describeState(RuntimeDataDescriber $w) : void{
|
||||
$w->potionType($this->potionType);
|
||||
|
@@ -25,13 +25,12 @@ namespace pocketmine\item;
|
||||
|
||||
use pocketmine\entity\effect\EffectInstance;
|
||||
use pocketmine\entity\effect\VanillaEffects;
|
||||
use pocketmine\utils\EnumTrait;
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
use function spl_object_id;
|
||||
|
||||
/**
|
||||
* This doc-block is generated automatically, do not modify it manually.
|
||||
* This must be regenerated whenever registry members are added, removed or changed.
|
||||
* @see build/generate-registry-annotations.php
|
||||
* @generate-registry-docblock
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static PotionType AWKWARD()
|
||||
* @method static PotionType FIRE_RESISTANCE()
|
||||
@@ -76,157 +75,196 @@ use pocketmine\utils\EnumTrait;
|
||||
* @method static PotionType WATER_BREATHING()
|
||||
* @method static PotionType WEAKNESS()
|
||||
* @method static PotionType WITHER()
|
||||
*
|
||||
* @phpstan-type TMetadata array{0: string, 1: \Closure() : list<EffectInstance>}
|
||||
*/
|
||||
final class PotionType{
|
||||
use EnumTrait {
|
||||
__construct as Enum___construct;
|
||||
}
|
||||
enum PotionType{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
protected static function setup() : void{
|
||||
self::registerAll(
|
||||
new self("water", "Water", fn() => []),
|
||||
new self("mundane", "Mundane", fn() => []),
|
||||
new self("long_mundane", "Long Mundane", fn() => []),
|
||||
new self("thick", "Thick", fn() => []),
|
||||
new self("awkward", "Awkward", fn() => []),
|
||||
new self("night_vision", "Night Vision", fn() => [
|
||||
new EffectInstance(VanillaEffects::NIGHT_VISION(), 3600)
|
||||
]),
|
||||
new self("long_night_vision", "Long Night Vision", fn() => [
|
||||
new EffectInstance(VanillaEffects::NIGHT_VISION(), 9600)
|
||||
]),
|
||||
new self("invisibility", "Invisibility", fn() => [
|
||||
new EffectInstance(VanillaEffects::INVISIBILITY(), 3600)
|
||||
]),
|
||||
new self("long_invisibility", "Long Invisibility", fn() => [
|
||||
new EffectInstance(VanillaEffects::INVISIBILITY(), 9600)
|
||||
]),
|
||||
new self("leaping", "Leaping", fn() => [
|
||||
new EffectInstance(VanillaEffects::JUMP_BOOST(), 3600)
|
||||
]),
|
||||
new self("long_leaping", "Long Leaping", fn() => [
|
||||
new EffectInstance(VanillaEffects::JUMP_BOOST(), 9600)
|
||||
]),
|
||||
new self("strong_leaping", "Strong Leaping", fn() => [
|
||||
new EffectInstance(VanillaEffects::JUMP_BOOST(), 1800, 1)
|
||||
]),
|
||||
new self("fire_resistance", "Fire Resistance", fn() => [
|
||||
new EffectInstance(VanillaEffects::FIRE_RESISTANCE(), 3600)
|
||||
]),
|
||||
new self("long_fire_resistance", "Long Fire Resistance", fn() => [
|
||||
new EffectInstance(VanillaEffects::FIRE_RESISTANCE(), 9600)
|
||||
]),
|
||||
new self("swiftness", "Swiftness", fn() => [
|
||||
new EffectInstance(VanillaEffects::SPEED(), 3600)
|
||||
]),
|
||||
new self("long_swiftness", "Long Swiftness", fn() => [
|
||||
new EffectInstance(VanillaEffects::SPEED(), 9600)
|
||||
]),
|
||||
new self("strong_swiftness", "Strong Swiftness", fn() => [
|
||||
new EffectInstance(VanillaEffects::SPEED(), 1800, 1)
|
||||
]),
|
||||
new self("slowness", "Slowness", fn() => [
|
||||
new EffectInstance(VanillaEffects::SLOWNESS(), 1800)
|
||||
]),
|
||||
new self("long_slowness", "Long Slowness", fn() => [
|
||||
new EffectInstance(VanillaEffects::SLOWNESS(), 4800)
|
||||
]),
|
||||
new self("water_breathing", "Water Breathing", fn() => [
|
||||
new EffectInstance(VanillaEffects::WATER_BREATHING(), 3600)
|
||||
]),
|
||||
new self("long_water_breathing", "Long Water Breathing", fn() => [
|
||||
new EffectInstance(VanillaEffects::WATER_BREATHING(), 9600)
|
||||
]),
|
||||
new self("healing", "Healing", fn() => [
|
||||
new EffectInstance(VanillaEffects::INSTANT_HEALTH())
|
||||
]),
|
||||
new self("strong_healing", "Strong Healing", fn() => [
|
||||
new EffectInstance(VanillaEffects::INSTANT_HEALTH(), null, 1)
|
||||
]),
|
||||
new self("harming", "Harming", fn() => [
|
||||
new EffectInstance(VanillaEffects::INSTANT_DAMAGE())
|
||||
]),
|
||||
new self("strong_harming", "Strong Harming", fn() => [
|
||||
new EffectInstance(VanillaEffects::INSTANT_DAMAGE(), null, 1)
|
||||
]),
|
||||
new self("poison", "Poison", fn() => [
|
||||
new EffectInstance(VanillaEffects::POISON(), 900)
|
||||
]),
|
||||
new self("long_poison", "Long Poison", fn() => [
|
||||
new EffectInstance(VanillaEffects::POISON(), 2400)
|
||||
]),
|
||||
new self("strong_poison", "Strong Poison", fn() => [
|
||||
new EffectInstance(VanillaEffects::POISON(), 440, 1)
|
||||
]),
|
||||
new self("regeneration", "Regeneration", fn() => [
|
||||
new EffectInstance(VanillaEffects::REGENERATION(), 900)
|
||||
]),
|
||||
new self("long_regeneration", "Long Regeneration", fn() => [
|
||||
new EffectInstance(VanillaEffects::REGENERATION(), 2400)
|
||||
]),
|
||||
new self("strong_regeneration", "Strong Regeneration", fn() => [
|
||||
new EffectInstance(VanillaEffects::REGENERATION(), 440, 1)
|
||||
]),
|
||||
new self("strength", "Strength", fn() => [
|
||||
new EffectInstance(VanillaEffects::STRENGTH(), 3600)
|
||||
]),
|
||||
new self("long_strength", "Long Strength", fn() => [
|
||||
new EffectInstance(VanillaEffects::STRENGTH(), 9600)
|
||||
]),
|
||||
new self("strong_strength", "Strong Strength", fn() => [
|
||||
new EffectInstance(VanillaEffects::STRENGTH(), 1800, 1)
|
||||
]),
|
||||
new self("weakness", "Weakness", fn() => [
|
||||
new EffectInstance(VanillaEffects::WEAKNESS(), 1800)
|
||||
]),
|
||||
new self("long_weakness", "Long Weakness", fn() => [
|
||||
new EffectInstance(VanillaEffects::WEAKNESS(), 4800)
|
||||
]),
|
||||
new self("wither", "Wither", fn() => [
|
||||
new EffectInstance(VanillaEffects::WITHER(), 800, 1)
|
||||
]),
|
||||
new self("turtle_master", "Turtle Master", fn() => [
|
||||
new EffectInstance(VanillaEffects::SLOWNESS(), 20 * 20, 3),
|
||||
new EffectInstance(VanillaEffects::RESISTANCE(), 20 * 20, 2),
|
||||
]),
|
||||
new self("long_turtle_master", "Long Turtle Master", fn() => [
|
||||
new EffectInstance(VanillaEffects::SLOWNESS(), 40 * 20, 3),
|
||||
new EffectInstance(VanillaEffects::RESISTANCE(), 40 * 20, 2),
|
||||
]),
|
||||
new self("strong_turtle_master", "Strong Turtle Master", fn() => [
|
||||
new EffectInstance(VanillaEffects::SLOWNESS(), 20 * 20, 5),
|
||||
new EffectInstance(VanillaEffects::RESISTANCE(), 20 * 20, 3),
|
||||
]),
|
||||
new self("slow_falling", "Slow Falling", fn() => [
|
||||
//TODO
|
||||
]),
|
||||
new self("long_slow_falling", "Long Slow Falling", fn() => [
|
||||
//TODO
|
||||
]),
|
||||
new self("strong_slowness", "Strong Slowness", fn() => [
|
||||
new EffectInstance(VanillaEffects::SLOWNESS(), 20 * 20, 3)
|
||||
])
|
||||
);
|
||||
}
|
||||
case WATER;
|
||||
case MUNDANE;
|
||||
case LONG_MUNDANE;
|
||||
case THICK;
|
||||
case AWKWARD;
|
||||
case NIGHT_VISION;
|
||||
case LONG_NIGHT_VISION;
|
||||
case INVISIBILITY;
|
||||
case LONG_INVISIBILITY;
|
||||
case LEAPING;
|
||||
case LONG_LEAPING;
|
||||
case STRONG_LEAPING;
|
||||
case FIRE_RESISTANCE;
|
||||
case LONG_FIRE_RESISTANCE;
|
||||
case SWIFTNESS;
|
||||
case LONG_SWIFTNESS;
|
||||
case STRONG_SWIFTNESS;
|
||||
case SLOWNESS;
|
||||
case LONG_SLOWNESS;
|
||||
case WATER_BREATHING;
|
||||
case LONG_WATER_BREATHING;
|
||||
case HEALING;
|
||||
case STRONG_HEALING;
|
||||
case HARMING;
|
||||
case STRONG_HARMING;
|
||||
case POISON;
|
||||
case LONG_POISON;
|
||||
case STRONG_POISON;
|
||||
case REGENERATION;
|
||||
case LONG_REGENERATION;
|
||||
case STRONG_REGENERATION;
|
||||
case STRENGTH;
|
||||
case LONG_STRENGTH;
|
||||
case STRONG_STRENGTH;
|
||||
case WEAKNESS;
|
||||
case LONG_WEAKNESS;
|
||||
case WITHER;
|
||||
case TURTLE_MASTER;
|
||||
case LONG_TURTLE_MASTER;
|
||||
case STRONG_TURTLE_MASTER;
|
||||
case SLOW_FALLING;
|
||||
case LONG_SLOW_FALLING;
|
||||
case STRONG_SLOWNESS;
|
||||
|
||||
/**
|
||||
* @phpstan-param \Closure() : list<EffectInstance> $effectsGetter
|
||||
* @phpstan-return TMetadata
|
||||
*/
|
||||
private function __construct(
|
||||
string $enumName,
|
||||
private string $displayName,
|
||||
private \Closure $effectsGetter
|
||||
){
|
||||
$this->Enum___construct($enumName);
|
||||
private function getMetadata() : array{
|
||||
/** @phpstan-var array<int, TMetadata> $cache */
|
||||
static $cache = [];
|
||||
|
||||
return $cache[spl_object_id($this)] ??= match($this){
|
||||
self::WATER => ["Water", fn() => []],
|
||||
self::MUNDANE => ["Mundane", fn() => []],
|
||||
self::LONG_MUNDANE => ["Long Mundane", fn() => []],
|
||||
self::THICK => ["Thick", fn() => []],
|
||||
self::AWKWARD => ["Awkward", fn() => []],
|
||||
self::NIGHT_VISION => ["Night Vision", fn() => [
|
||||
new EffectInstance(VanillaEffects::NIGHT_VISION(), 3600)
|
||||
]],
|
||||
self::LONG_NIGHT_VISION => ["Long Night Vision", fn() => [
|
||||
new EffectInstance(VanillaEffects::NIGHT_VISION(), 9600)
|
||||
]],
|
||||
self::INVISIBILITY => ["Invisibility", fn() => [
|
||||
new EffectInstance(VanillaEffects::INVISIBILITY(), 3600)
|
||||
]],
|
||||
self::LONG_INVISIBILITY => ["Long Invisibility", fn() => [
|
||||
new EffectInstance(VanillaEffects::INVISIBILITY(), 9600)
|
||||
]],
|
||||
self::LEAPING => ["Leaping", fn() => [
|
||||
new EffectInstance(VanillaEffects::JUMP_BOOST(), 3600)
|
||||
]],
|
||||
self::LONG_LEAPING => ["Long Leaping", fn() => [
|
||||
new EffectInstance(VanillaEffects::JUMP_BOOST(), 9600)
|
||||
]],
|
||||
self::STRONG_LEAPING => ["Strong Leaping", fn() => [
|
||||
new EffectInstance(VanillaEffects::JUMP_BOOST(), 1800, 1)
|
||||
]],
|
||||
self::FIRE_RESISTANCE => ["Fire Resistance", fn() => [
|
||||
new EffectInstance(VanillaEffects::FIRE_RESISTANCE(), 3600)
|
||||
]],
|
||||
self::LONG_FIRE_RESISTANCE => ["Long Fire Resistance", fn() => [
|
||||
new EffectInstance(VanillaEffects::FIRE_RESISTANCE(), 9600)
|
||||
]],
|
||||
self::SWIFTNESS => ["Swiftness", fn() => [
|
||||
new EffectInstance(VanillaEffects::SPEED(), 3600)
|
||||
]],
|
||||
self::LONG_SWIFTNESS => ["Long Swiftness", fn() => [
|
||||
new EffectInstance(VanillaEffects::SPEED(), 9600)
|
||||
]],
|
||||
self::STRONG_SWIFTNESS => ["Strong Swiftness", fn() => [
|
||||
new EffectInstance(VanillaEffects::SPEED(), 1800, 1)
|
||||
]],
|
||||
self::SLOWNESS => ["Slowness", fn() => [
|
||||
new EffectInstance(VanillaEffects::SLOWNESS(), 1800)
|
||||
]],
|
||||
self::LONG_SLOWNESS => ["Long Slowness", fn() => [
|
||||
new EffectInstance(VanillaEffects::SLOWNESS(), 4800)
|
||||
]],
|
||||
self::WATER_BREATHING => ["Water Breathing", fn() => [
|
||||
new EffectInstance(VanillaEffects::WATER_BREATHING(), 3600)
|
||||
]],
|
||||
self::LONG_WATER_BREATHING => ["Long Water Breathing", fn() => [
|
||||
new EffectInstance(VanillaEffects::WATER_BREATHING(), 9600)
|
||||
]],
|
||||
self::HEALING => ["Healing", fn() => [
|
||||
new EffectInstance(VanillaEffects::INSTANT_HEALTH())
|
||||
]],
|
||||
self::STRONG_HEALING => ["Strong Healing", fn() => [
|
||||
new EffectInstance(VanillaEffects::INSTANT_HEALTH(), null, 1)
|
||||
]],
|
||||
self::HARMING => ["Harming", fn() => [
|
||||
new EffectInstance(VanillaEffects::INSTANT_DAMAGE())
|
||||
]],
|
||||
self::STRONG_HARMING => ["Strong Harming", fn() => [
|
||||
new EffectInstance(VanillaEffects::INSTANT_DAMAGE(), null, 1)
|
||||
]],
|
||||
self::POISON => ["Poison", fn() => [
|
||||
new EffectInstance(VanillaEffects::POISON(), 900)
|
||||
]],
|
||||
self::LONG_POISON => ["Long Poison", fn() => [
|
||||
new EffectInstance(VanillaEffects::POISON(), 2400)
|
||||
]],
|
||||
self::STRONG_POISON => ["Strong Poison", fn() => [
|
||||
new EffectInstance(VanillaEffects::POISON(), 440, 1)
|
||||
]],
|
||||
self::REGENERATION => ["Regeneration", fn() => [
|
||||
new EffectInstance(VanillaEffects::REGENERATION(), 900)
|
||||
]],
|
||||
self::LONG_REGENERATION => ["Long Regeneration", fn() => [
|
||||
new EffectInstance(VanillaEffects::REGENERATION(), 2400)
|
||||
]],
|
||||
self::STRONG_REGENERATION => ["Strong Regeneration", fn() => [
|
||||
new EffectInstance(VanillaEffects::REGENERATION(), 440, 1)
|
||||
]],
|
||||
self::STRENGTH => ["Strength", fn() => [
|
||||
new EffectInstance(VanillaEffects::STRENGTH(), 3600)
|
||||
]],
|
||||
self::LONG_STRENGTH => ["Long Strength", fn() => [
|
||||
new EffectInstance(VanillaEffects::STRENGTH(), 9600)
|
||||
]],
|
||||
self::STRONG_STRENGTH => ["Strong Strength", fn() => [
|
||||
new EffectInstance(VanillaEffects::STRENGTH(), 1800, 1)
|
||||
]],
|
||||
self::WEAKNESS => ["Weakness", fn() => [
|
||||
new EffectInstance(VanillaEffects::WEAKNESS(), 1800)
|
||||
]],
|
||||
self::LONG_WEAKNESS => ["Long Weakness", fn() => [
|
||||
new EffectInstance(VanillaEffects::WEAKNESS(), 4800)
|
||||
]],
|
||||
self::WITHER => ["Wither", fn() => [
|
||||
new EffectInstance(VanillaEffects::WITHER(), 800, 1)
|
||||
]],
|
||||
self::TURTLE_MASTER => ["Turtle Master", fn() => [
|
||||
new EffectInstance(VanillaEffects::SLOWNESS(), 20 * 20, 3),
|
||||
new EffectInstance(VanillaEffects::RESISTANCE(), 20 * 20, 2),
|
||||
]],
|
||||
self::LONG_TURTLE_MASTER => ["Long Turtle Master", fn() => [
|
||||
new EffectInstance(VanillaEffects::SLOWNESS(), 40 * 20, 3),
|
||||
new EffectInstance(VanillaEffects::RESISTANCE(), 40 * 20, 2),
|
||||
]],
|
||||
self::STRONG_TURTLE_MASTER => ["Strong Turtle Master", fn() => [
|
||||
new EffectInstance(VanillaEffects::SLOWNESS(), 20 * 20, 5),
|
||||
new EffectInstance(VanillaEffects::RESISTANCE(), 20 * 20, 3),
|
||||
]],
|
||||
self::SLOW_FALLING => ["Slow Falling", fn() => [
|
||||
//TODO
|
||||
]],
|
||||
self::LONG_SLOW_FALLING => ["Long Slow Falling", fn() => [
|
||||
//TODO
|
||||
]],
|
||||
self::STRONG_SLOWNESS => ["Strong Slowness", fn() => [
|
||||
new EffectInstance(VanillaEffects::SLOWNESS(), 20 * 20, 3)
|
||||
]]
|
||||
};
|
||||
}
|
||||
|
||||
public function getDisplayName() : string{ return $this->displayName; }
|
||||
public function getDisplayName() : string{ return $this->getMetadata()[0]; }
|
||||
|
||||
/**
|
||||
* @return EffectInstance[]
|
||||
* @phpstan-return list<EffectInstance>
|
||||
*/
|
||||
public function getEffects() : array{
|
||||
return ($this->effectsGetter)();
|
||||
return ($this->getMetadata()[1])();
|
||||
}
|
||||
}
|
||||
|
@@ -31,12 +31,7 @@ use pocketmine\player\Player;
|
||||
|
||||
class SplashPotion extends ProjectileItem{
|
||||
|
||||
private PotionType $potionType;
|
||||
|
||||
public function __construct(ItemIdentifier $identifier, string $name){
|
||||
$this->potionType = PotionType::WATER();
|
||||
parent::__construct($identifier, $name);
|
||||
}
|
||||
private PotionType $potionType = PotionType::WATER;
|
||||
|
||||
protected function describeState(RuntimeDataDescriber $w) : void{
|
||||
$w->potionType($this->potionType);
|
||||
|
@@ -59,8 +59,8 @@ final class StringToItemParser extends StringToTParser{
|
||||
}
|
||||
|
||||
private static function registerDynamicBlocks(self $result) : void{
|
||||
foreach(DyeColor::getAll() as $color){
|
||||
$register = fn(string $name, \Closure $callback) => $result->registerBlock($color->name() . "_" . $name, $callback);
|
||||
foreach(DyeColor::cases() as $color){
|
||||
$register = fn(string $name, \Closure $callback) => $result->registerBlock(strtolower($color->name) . "_" . $name, $callback);
|
||||
//wall and floor banner are the same item
|
||||
$register("banner", fn() => Blocks::BANNER()->setColor($color));
|
||||
$register("bed", fn() => Blocks::BED()->setColor($color));
|
||||
@@ -1144,13 +1144,13 @@ final class StringToItemParser extends StringToTParser{
|
||||
}
|
||||
|
||||
private static function registerDynamicItems(self $result) : void{
|
||||
foreach(DyeColor::getAll() as $color){
|
||||
$prefix = fn(string $name) => $color->name() . "_" . $name;
|
||||
foreach(DyeColor::cases() as $color){
|
||||
$prefix = fn(string $name) => strtolower($color->name) . "_" . $name;
|
||||
|
||||
$result->register($prefix("dye"), fn() => Items::DYE()->setColor($color));
|
||||
}
|
||||
foreach(SuspiciousStewType::getAll() as $suspiciousStewType){
|
||||
$prefix = fn(string $name) => $suspiciousStewType->name() . "_" . $name;
|
||||
foreach(SuspiciousStewType::cases() as $suspiciousStewType){
|
||||
$prefix = fn(string $name) => strtolower($suspiciousStewType->name) . "_" . $name;
|
||||
|
||||
$result->register($prefix("suspicious_stew"), fn() => Items::SUSPICIOUS_STEW()->setType($suspiciousStewType));
|
||||
}
|
||||
@@ -1160,13 +1160,13 @@ final class StringToItemParser extends StringToTParser{
|
||||
|
||||
$result->register("acacia_boat", fn() => Items::ACACIA_BOAT());
|
||||
$result->register("amethyst_shard", fn() => Items::AMETHYST_SHARD());
|
||||
$result->register("antidote", fn() => Items::MEDICINE()->setType(MedicineType::ANTIDOTE()));
|
||||
$result->register("antidote", fn() => Items::MEDICINE()->setType(MedicineType::ANTIDOTE));
|
||||
$result->register("apple", fn() => Items::APPLE());
|
||||
$result->register("apple_enchanted", fn() => Items::ENCHANTED_GOLDEN_APPLE());
|
||||
$result->register("appleenchanted", fn() => Items::ENCHANTED_GOLDEN_APPLE());
|
||||
$result->register("arrow", fn() => Items::ARROW());
|
||||
$result->register("awkward_potion", fn() => Items::POTION()->setType(PotionType::AWKWARD()));
|
||||
$result->register("awkward_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::AWKWARD()));
|
||||
$result->register("awkward_potion", fn() => Items::POTION()->setType(PotionType::AWKWARD));
|
||||
$result->register("awkward_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::AWKWARD));
|
||||
$result->register("baked_potato", fn() => Items::BAKED_POTATO());
|
||||
$result->register("baked_potatoes", fn() => Items::BAKED_POTATO());
|
||||
$result->register("beef", fn() => Items::RAW_BEEF());
|
||||
@@ -1276,19 +1276,19 @@ final class StringToItemParser extends StringToTParser{
|
||||
$result->register("dye", fn() => Items::INK_SAC());
|
||||
$result->register("echo_shard", fn() => Items::ECHO_SHARD());
|
||||
$result->register("egg", fn() => Items::EGG());
|
||||
$result->register("elixir", fn() => Items::MEDICINE()->setType(MedicineType::ELIXIR()));
|
||||
$result->register("elixir", fn() => Items::MEDICINE()->setType(MedicineType::ELIXIR));
|
||||
$result->register("emerald", fn() => Items::EMERALD());
|
||||
$result->register("enchanted_book", fn() => Items::ENCHANTED_BOOK());
|
||||
$result->register("enchanted_golden_apple", fn() => Items::ENCHANTED_GOLDEN_APPLE());
|
||||
$result->register("enchanting_bottle", fn() => Items::EXPERIENCE_BOTTLE());
|
||||
$result->register("ender_pearl", fn() => Items::ENDER_PEARL());
|
||||
$result->register("experience_bottle", fn() => Items::EXPERIENCE_BOTTLE());
|
||||
$result->register("eye_drops", fn() => Items::MEDICINE()->setType(MedicineType::EYE_DROPS()));
|
||||
$result->register("eye_drops", fn() => Items::MEDICINE()->setType(MedicineType::EYE_DROPS));
|
||||
$result->register("feather", fn() => Items::FEATHER());
|
||||
$result->register("fermented_spider_eye", fn() => Items::FERMENTED_SPIDER_EYE());
|
||||
$result->register("fire_charge", fn() => Items::FIRE_CHARGE());
|
||||
$result->register("fire_resistance_potion", fn() => Items::POTION()->setType(PotionType::FIRE_RESISTANCE()));
|
||||
$result->register("fire_resistance_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::FIRE_RESISTANCE()));
|
||||
$result->register("fire_resistance_potion", fn() => Items::POTION()->setType(PotionType::FIRE_RESISTANCE));
|
||||
$result->register("fire_resistance_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::FIRE_RESISTANCE));
|
||||
$result->register("fish", fn() => Items::RAW_FISH());
|
||||
$result->register("fishing_rod", fn() => Items::FISHING_ROD());
|
||||
$result->register("flint", fn() => Items::FLINT());
|
||||
@@ -1324,16 +1324,16 @@ final class StringToItemParser extends StringToTParser{
|
||||
$result->register("golden_shovel", fn() => Items::GOLDEN_SHOVEL());
|
||||
$result->register("golden_sword", fn() => Items::GOLDEN_SWORD());
|
||||
$result->register("gunpowder", fn() => Items::GUNPOWDER());
|
||||
$result->register("harming_potion", fn() => Items::POTION()->setType(PotionType::HARMING()));
|
||||
$result->register("harming_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::HARMING()));
|
||||
$result->register("healing_potion", fn() => Items::POTION()->setType(PotionType::HEALING()));
|
||||
$result->register("healing_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::HEALING()));
|
||||
$result->register("harming_potion", fn() => Items::POTION()->setType(PotionType::HARMING));
|
||||
$result->register("harming_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::HARMING));
|
||||
$result->register("healing_potion", fn() => Items::POTION()->setType(PotionType::HEALING));
|
||||
$result->register("healing_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::HEALING));
|
||||
$result->register("heart_of_the_sea", fn() => Items::HEART_OF_THE_SEA());
|
||||
$result->register("honey_bottle", fn() => Items::HONEY_BOTTLE());
|
||||
$result->register("honeycomb", fn() => Items::HONEYCOMB());
|
||||
$result->register("ink_sac", fn() => Items::INK_SAC());
|
||||
$result->register("invisibility_potion", fn() => Items::POTION()->setType(PotionType::INVISIBILITY()));
|
||||
$result->register("invisibility_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::INVISIBILITY()));
|
||||
$result->register("invisibility_potion", fn() => Items::POTION()->setType(PotionType::INVISIBILITY));
|
||||
$result->register("invisibility_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::INVISIBILITY));
|
||||
$result->register("iron_axe", fn() => Items::IRON_AXE());
|
||||
$result->register("iron_boots", fn() => Items::IRON_BOOTS());
|
||||
$result->register("iron_chestplate", fn() => Items::IRON_CHESTPLATE());
|
||||
@@ -1348,8 +1348,8 @@ final class StringToItemParser extends StringToTParser{
|
||||
$result->register("jungle_boat", fn() => Items::JUNGLE_BOAT());
|
||||
$result->register("lapis_lazuli", fn() => Items::LAPIS_LAZULI());
|
||||
$result->register("lava_bucket", fn() => Items::LAVA_BUCKET());
|
||||
$result->register("leaping_potion", fn() => Items::POTION()->setType(PotionType::LEAPING()));
|
||||
$result->register("leaping_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LEAPING()));
|
||||
$result->register("leaping_potion", fn() => Items::POTION()->setType(PotionType::LEAPING));
|
||||
$result->register("leaping_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LEAPING));
|
||||
$result->register("leather", fn() => Items::LEATHER());
|
||||
$result->register("leather_boots", fn() => Items::LEATHER_BOOTS());
|
||||
$result->register("leather_cap", fn() => Items::LEATHER_CAP());
|
||||
@@ -1358,42 +1358,42 @@ final class StringToItemParser extends StringToTParser{
|
||||
$result->register("leather_leggings", fn() => Items::LEATHER_PANTS());
|
||||
$result->register("leather_pants", fn() => Items::LEATHER_PANTS());
|
||||
$result->register("leather_tunic", fn() => Items::LEATHER_TUNIC());
|
||||
$result->register("long_fire_resistance_potion", fn() => Items::POTION()->setType(PotionType::LONG_FIRE_RESISTANCE()));
|
||||
$result->register("long_fire_resistance_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_FIRE_RESISTANCE()));
|
||||
$result->register("long_invisibility_potion", fn() => Items::POTION()->setType(PotionType::LONG_INVISIBILITY()));
|
||||
$result->register("long_invisibility_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_INVISIBILITY()));
|
||||
$result->register("long_leaping_potion", fn() => Items::POTION()->setType(PotionType::LONG_LEAPING()));
|
||||
$result->register("long_leaping_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_LEAPING()));
|
||||
$result->register("long_mundane_potion", fn() => Items::POTION()->setType(PotionType::LONG_MUNDANE()));
|
||||
$result->register("long_mundane_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_MUNDANE()));
|
||||
$result->register("long_night_vision_potion", fn() => Items::POTION()->setType(PotionType::LONG_NIGHT_VISION()));
|
||||
$result->register("long_night_vision_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_NIGHT_VISION()));
|
||||
$result->register("long_poison_potion", fn() => Items::POTION()->setType(PotionType::LONG_POISON()));
|
||||
$result->register("long_poison_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_POISON()));
|
||||
$result->register("long_regeneration_potion", fn() => Items::POTION()->setType(PotionType::LONG_REGENERATION()));
|
||||
$result->register("long_regeneration_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_REGENERATION()));
|
||||
$result->register("long_slow_falling_potion", fn() => Items::POTION()->setType(PotionType::LONG_SLOW_FALLING()));
|
||||
$result->register("long_slow_falling_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_SLOW_FALLING()));
|
||||
$result->register("long_slowness_potion", fn() => Items::POTION()->setType(PotionType::LONG_SLOWNESS()));
|
||||
$result->register("long_slowness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_SLOWNESS()));
|
||||
$result->register("long_strength_potion", fn() => Items::POTION()->setType(PotionType::LONG_STRENGTH()));
|
||||
$result->register("long_strength_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_STRENGTH()));
|
||||
$result->register("long_swiftness_potion", fn() => Items::POTION()->setType(PotionType::LONG_SWIFTNESS()));
|
||||
$result->register("long_swiftness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_SWIFTNESS()));
|
||||
$result->register("long_turtle_master_potion", fn() => Items::POTION()->setType(PotionType::LONG_TURTLE_MASTER()));
|
||||
$result->register("long_turtle_master_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_TURTLE_MASTER()));
|
||||
$result->register("long_water_breathing_potion", fn() => Items::POTION()->setType(PotionType::LONG_WATER_BREATHING()));
|
||||
$result->register("long_water_breathing_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_WATER_BREATHING()));
|
||||
$result->register("long_weakness_potion", fn() => Items::POTION()->setType(PotionType::LONG_WEAKNESS()));
|
||||
$result->register("long_weakness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_WEAKNESS()));
|
||||
$result->register("long_fire_resistance_potion", fn() => Items::POTION()->setType(PotionType::LONG_FIRE_RESISTANCE));
|
||||
$result->register("long_fire_resistance_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_FIRE_RESISTANCE));
|
||||
$result->register("long_invisibility_potion", fn() => Items::POTION()->setType(PotionType::LONG_INVISIBILITY));
|
||||
$result->register("long_invisibility_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_INVISIBILITY));
|
||||
$result->register("long_leaping_potion", fn() => Items::POTION()->setType(PotionType::LONG_LEAPING));
|
||||
$result->register("long_leaping_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_LEAPING));
|
||||
$result->register("long_mundane_potion", fn() => Items::POTION()->setType(PotionType::LONG_MUNDANE));
|
||||
$result->register("long_mundane_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_MUNDANE));
|
||||
$result->register("long_night_vision_potion", fn() => Items::POTION()->setType(PotionType::LONG_NIGHT_VISION));
|
||||
$result->register("long_night_vision_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_NIGHT_VISION));
|
||||
$result->register("long_poison_potion", fn() => Items::POTION()->setType(PotionType::LONG_POISON));
|
||||
$result->register("long_poison_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_POISON));
|
||||
$result->register("long_regeneration_potion", fn() => Items::POTION()->setType(PotionType::LONG_REGENERATION));
|
||||
$result->register("long_regeneration_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_REGENERATION));
|
||||
$result->register("long_slow_falling_potion", fn() => Items::POTION()->setType(PotionType::LONG_SLOW_FALLING));
|
||||
$result->register("long_slow_falling_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_SLOW_FALLING));
|
||||
$result->register("long_slowness_potion", fn() => Items::POTION()->setType(PotionType::LONG_SLOWNESS));
|
||||
$result->register("long_slowness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_SLOWNESS));
|
||||
$result->register("long_strength_potion", fn() => Items::POTION()->setType(PotionType::LONG_STRENGTH));
|
||||
$result->register("long_strength_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_STRENGTH));
|
||||
$result->register("long_swiftness_potion", fn() => Items::POTION()->setType(PotionType::LONG_SWIFTNESS));
|
||||
$result->register("long_swiftness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_SWIFTNESS));
|
||||
$result->register("long_turtle_master_potion", fn() => Items::POTION()->setType(PotionType::LONG_TURTLE_MASTER));
|
||||
$result->register("long_turtle_master_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_TURTLE_MASTER));
|
||||
$result->register("long_water_breathing_potion", fn() => Items::POTION()->setType(PotionType::LONG_WATER_BREATHING));
|
||||
$result->register("long_water_breathing_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_WATER_BREATHING));
|
||||
$result->register("long_weakness_potion", fn() => Items::POTION()->setType(PotionType::LONG_WEAKNESS));
|
||||
$result->register("long_weakness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::LONG_WEAKNESS));
|
||||
$result->register("magma_cream", fn() => Items::MAGMA_CREAM());
|
||||
$result->register("melon", fn() => Items::MELON());
|
||||
$result->register("melon_seeds", fn() => Items::MELON_SEEDS());
|
||||
$result->register("melon_slice", fn() => Items::MELON());
|
||||
$result->register("milk_bucket", fn() => Items::MILK_BUCKET());
|
||||
$result->register("minecart", fn() => Items::MINECART());
|
||||
$result->register("mundane_potion", fn() => Items::POTION()->setType(PotionType::MUNDANE()));
|
||||
$result->register("mundane_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::MUNDANE()));
|
||||
$result->register("mundane_potion", fn() => Items::POTION()->setType(PotionType::MUNDANE));
|
||||
$result->register("mundane_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::MUNDANE));
|
||||
$result->register("mushroom_stew", fn() => Items::MUSHROOM_STEW());
|
||||
$result->register("mutton", fn() => Items::RAW_MUTTON());
|
||||
$result->register("mutton_cooked", fn() => Items::COOKED_MUTTON());
|
||||
@@ -1417,14 +1417,14 @@ final class StringToItemParser extends StringToTParser{
|
||||
$result->register("netherite_shovel", fn() => Items::NETHERITE_SHOVEL());
|
||||
$result->register("netherite_sword", fn() => Items::NETHERITE_SWORD());
|
||||
$result->register("netherstar", fn() => Items::NETHER_STAR());
|
||||
$result->register("night_vision_potion", fn() => Items::POTION()->setType(PotionType::NIGHT_VISION()));
|
||||
$result->register("night_vision_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::NIGHT_VISION()));
|
||||
$result->register("night_vision_potion", fn() => Items::POTION()->setType(PotionType::NIGHT_VISION));
|
||||
$result->register("night_vision_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::NIGHT_VISION));
|
||||
$result->register("oak_boat", fn() => Items::OAK_BOAT());
|
||||
$result->register("painting", fn() => Items::PAINTING());
|
||||
$result->register("paper", fn() => Items::PAPER());
|
||||
$result->register("phantom_membrane", fn() => Items::PHANTOM_MEMBRANE());
|
||||
$result->register("poison_potion", fn() => Items::POTION()->setType(PotionType::POISON()));
|
||||
$result->register("poison_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::POISON()));
|
||||
$result->register("poison_potion", fn() => Items::POTION()->setType(PotionType::POISON));
|
||||
$result->register("poison_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::POISON));
|
||||
$result->register("poisonous_potato", fn() => Items::POISONOUS_POTATO());
|
||||
$result->register("popped_chorus_fruit", fn() => Items::POPPED_CHORUS_FRUIT());
|
||||
$result->register("porkchop", fn() => Items::RAW_PORKCHOP());
|
||||
@@ -1469,8 +1469,8 @@ final class StringToItemParser extends StringToTParser{
|
||||
$result->register("record_ward", fn() => Items::RECORD_WARD());
|
||||
$result->register("redstone", fn() => Items::REDSTONE_DUST());
|
||||
$result->register("redstone_dust", fn() => Items::REDSTONE_DUST());
|
||||
$result->register("regeneration_potion", fn() => Items::POTION()->setType(PotionType::REGENERATION()));
|
||||
$result->register("regeneration_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::REGENERATION()));
|
||||
$result->register("regeneration_potion", fn() => Items::POTION()->setType(PotionType::REGENERATION));
|
||||
$result->register("regeneration_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::REGENERATION));
|
||||
$result->register("rotten_flesh", fn() => Items::ROTTEN_FLESH());
|
||||
$result->register("salmon", fn() => Items::RAW_SALMON());
|
||||
$result->register("scute", fn() => Items::SCUTE());
|
||||
@@ -1479,10 +1479,10 @@ final class StringToItemParser extends StringToTParser{
|
||||
$result->register("shulker_shell", fn() => Items::SHULKER_SHELL());
|
||||
$result->register("slime_ball", fn() => Items::SLIMEBALL());
|
||||
$result->register("slimeball", fn() => Items::SLIMEBALL());
|
||||
$result->register("slow_falling_potion", fn() => Items::POTION()->setType(PotionType::SLOW_FALLING()));
|
||||
$result->register("slow_falling_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::SLOW_FALLING()));
|
||||
$result->register("slowness_potion", fn() => Items::POTION()->setType(PotionType::SLOWNESS()));
|
||||
$result->register("slowness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::SLOWNESS()));
|
||||
$result->register("slow_falling_potion", fn() => Items::POTION()->setType(PotionType::SLOW_FALLING));
|
||||
$result->register("slow_falling_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::SLOW_FALLING));
|
||||
$result->register("slowness_potion", fn() => Items::POTION()->setType(PotionType::SLOWNESS));
|
||||
$result->register("slowness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::SLOWNESS));
|
||||
$result->register("snowball", fn() => Items::SNOWBALL());
|
||||
$result->register("speckled_melon", fn() => Items::GLISTERING_MELON());
|
||||
$result->register("spider_eye", fn() => Items::SPIDER_EYE());
|
||||
@@ -1498,52 +1498,52 @@ final class StringToItemParser extends StringToTParser{
|
||||
$result->register("stone_pickaxe", fn() => Items::STONE_PICKAXE());
|
||||
$result->register("stone_shovel", fn() => Items::STONE_SHOVEL());
|
||||
$result->register("stone_sword", fn() => Items::STONE_SWORD());
|
||||
$result->register("strength_potion", fn() => Items::POTION()->setType(PotionType::STRENGTH()));
|
||||
$result->register("strength_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRENGTH()));
|
||||
$result->register("strength_potion", fn() => Items::POTION()->setType(PotionType::STRENGTH));
|
||||
$result->register("strength_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRENGTH));
|
||||
$result->register("string", fn() => Items::STRING());
|
||||
$result->register("strong_harming_potion", fn() => Items::POTION()->setType(PotionType::STRONG_HARMING()));
|
||||
$result->register("strong_harming_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_HARMING()));
|
||||
$result->register("strong_healing_potion", fn() => Items::POTION()->setType(PotionType::STRONG_HEALING()));
|
||||
$result->register("strong_healing_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_HEALING()));
|
||||
$result->register("strong_leaping_potion", fn() => Items::POTION()->setType(PotionType::STRONG_LEAPING()));
|
||||
$result->register("strong_leaping_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_LEAPING()));
|
||||
$result->register("strong_poison_potion", fn() => Items::POTION()->setType(PotionType::STRONG_POISON()));
|
||||
$result->register("strong_poison_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_POISON()));
|
||||
$result->register("strong_regeneration_potion", fn() => Items::POTION()->setType(PotionType::STRONG_REGENERATION()));
|
||||
$result->register("strong_regeneration_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_REGENERATION()));
|
||||
$result->register("strong_slowness_potion", fn() => Items::POTION()->setType(PotionType::STRONG_SLOWNESS()));
|
||||
$result->register("strong_slowness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_SLOWNESS()));
|
||||
$result->register("strong_strength_potion", fn() => Items::POTION()->setType(PotionType::STRONG_STRENGTH()));
|
||||
$result->register("strong_strength_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_STRENGTH()));
|
||||
$result->register("strong_swiftness_potion", fn() => Items::POTION()->setType(PotionType::STRONG_SWIFTNESS()));
|
||||
$result->register("strong_swiftness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_SWIFTNESS()));
|
||||
$result->register("strong_turtle_master_potion", fn() => Items::POTION()->setType(PotionType::STRONG_TURTLE_MASTER()));
|
||||
$result->register("strong_turtle_master_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_TURTLE_MASTER()));
|
||||
$result->register("strong_harming_potion", fn() => Items::POTION()->setType(PotionType::STRONG_HARMING));
|
||||
$result->register("strong_harming_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_HARMING));
|
||||
$result->register("strong_healing_potion", fn() => Items::POTION()->setType(PotionType::STRONG_HEALING));
|
||||
$result->register("strong_healing_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_HEALING));
|
||||
$result->register("strong_leaping_potion", fn() => Items::POTION()->setType(PotionType::STRONG_LEAPING));
|
||||
$result->register("strong_leaping_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_LEAPING));
|
||||
$result->register("strong_poison_potion", fn() => Items::POTION()->setType(PotionType::STRONG_POISON));
|
||||
$result->register("strong_poison_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_POISON));
|
||||
$result->register("strong_regeneration_potion", fn() => Items::POTION()->setType(PotionType::STRONG_REGENERATION));
|
||||
$result->register("strong_regeneration_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_REGENERATION));
|
||||
$result->register("strong_slowness_potion", fn() => Items::POTION()->setType(PotionType::STRONG_SLOWNESS));
|
||||
$result->register("strong_slowness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_SLOWNESS));
|
||||
$result->register("strong_strength_potion", fn() => Items::POTION()->setType(PotionType::STRONG_STRENGTH));
|
||||
$result->register("strong_strength_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_STRENGTH));
|
||||
$result->register("strong_swiftness_potion", fn() => Items::POTION()->setType(PotionType::STRONG_SWIFTNESS));
|
||||
$result->register("strong_swiftness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_SWIFTNESS));
|
||||
$result->register("strong_turtle_master_potion", fn() => Items::POTION()->setType(PotionType::STRONG_TURTLE_MASTER));
|
||||
$result->register("strong_turtle_master_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::STRONG_TURTLE_MASTER));
|
||||
$result->register("sugar", fn() => Items::SUGAR());
|
||||
$result->register("suspicious_stew", fn() => Items::SUSPICIOUS_STEW());
|
||||
$result->register("sweet_berries", fn() => Items::SWEET_BERRIES());
|
||||
$result->register("swiftness_potion", fn() => Items::POTION()->setType(PotionType::SWIFTNESS()));
|
||||
$result->register("swiftness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::SWIFTNESS()));
|
||||
$result->register("thick_potion", fn() => Items::POTION()->setType(PotionType::THICK()));
|
||||
$result->register("thick_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::THICK()));
|
||||
$result->register("tonic", fn() => Items::MEDICINE()->setType(MedicineType::TONIC()));
|
||||
$result->register("swiftness_potion", fn() => Items::POTION()->setType(PotionType::SWIFTNESS));
|
||||
$result->register("swiftness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::SWIFTNESS));
|
||||
$result->register("thick_potion", fn() => Items::POTION()->setType(PotionType::THICK));
|
||||
$result->register("thick_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::THICK));
|
||||
$result->register("tonic", fn() => Items::MEDICINE()->setType(MedicineType::TONIC));
|
||||
$result->register("totem", fn() => Items::TOTEM());
|
||||
$result->register("turtle_helmet", fn() => Items::TURTLE_HELMET());
|
||||
$result->register("turtle_master_potion", fn() => Items::POTION()->setType(PotionType::TURTLE_MASTER()));
|
||||
$result->register("turtle_master_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::TURTLE_MASTER()));
|
||||
$result->register("turtle_master_potion", fn() => Items::POTION()->setType(PotionType::TURTLE_MASTER));
|
||||
$result->register("turtle_master_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::TURTLE_MASTER));
|
||||
$result->register("turtle_shell_piece", fn() => Items::SCUTE());
|
||||
$result->register("villager_spawn_egg", fn() => Items::VILLAGER_SPAWN_EGG());
|
||||
$result->register("water_breathing_potion", fn() => Items::POTION()->setType(PotionType::WATER_BREATHING()));
|
||||
$result->register("water_breathing_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::WATER_BREATHING()));
|
||||
$result->register("water_breathing_potion", fn() => Items::POTION()->setType(PotionType::WATER_BREATHING));
|
||||
$result->register("water_breathing_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::WATER_BREATHING));
|
||||
$result->register("water_bucket", fn() => Items::WATER_BUCKET());
|
||||
$result->register("water_potion", fn() => Items::POTION()->setType(PotionType::WATER()));
|
||||
$result->register("water_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::WATER()));
|
||||
$result->register("weakness_potion", fn() => Items::POTION()->setType(PotionType::WEAKNESS()));
|
||||
$result->register("weakness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::WEAKNESS()));
|
||||
$result->register("water_potion", fn() => Items::POTION()->setType(PotionType::WATER));
|
||||
$result->register("water_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::WATER));
|
||||
$result->register("weakness_potion", fn() => Items::POTION()->setType(PotionType::WEAKNESS));
|
||||
$result->register("weakness_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::WEAKNESS));
|
||||
$result->register("wheat", fn() => Items::WHEAT());
|
||||
$result->register("wheat_seeds", fn() => Items::WHEAT_SEEDS());
|
||||
$result->register("wither_potion", fn() => Items::POTION()->setType(PotionType::WITHER()));
|
||||
$result->register("wither_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::WITHER()));
|
||||
$result->register("wither_potion", fn() => Items::POTION()->setType(PotionType::WITHER));
|
||||
$result->register("wither_splash_potion", fn() => Items::SPLASH_POTION()->setType(PotionType::WITHER));
|
||||
$result->register("wooden_axe", fn() => Items::WOODEN_AXE());
|
||||
$result->register("wooden_hoe", fn() => Items::WOODEN_HOE());
|
||||
$result->register("wooden_pickaxe", fn() => Items::WOODEN_PICKAXE());
|
||||
|
@@ -27,12 +27,7 @@ use pocketmine\data\runtime\RuntimeDataDescriber;
|
||||
|
||||
class SuspiciousStew extends Food{
|
||||
|
||||
private SuspiciousStewType $suspiciousStewType;
|
||||
|
||||
public function __construct(ItemIdentifier $identifier, string $name){
|
||||
$this->suspiciousStewType = SuspiciousStewType::POPPY();
|
||||
parent::__construct($identifier, $name);
|
||||
}
|
||||
private SuspiciousStewType $suspiciousStewType = SuspiciousStewType::POPPY;
|
||||
|
||||
protected function describeState(RuntimeDataDescriber $w) : void{
|
||||
$w->suspiciousStewType($this->suspiciousStewType);
|
||||
|
@@ -25,13 +25,11 @@ namespace pocketmine\item;
|
||||
|
||||
use pocketmine\entity\effect\EffectInstance;
|
||||
use pocketmine\entity\effect\VanillaEffects;
|
||||
use pocketmine\utils\EnumTrait;
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
|
||||
/**
|
||||
* This doc-block is generated automatically, do not modify it manually.
|
||||
* This must be regenerated whenever registry members are added, removed or changed.
|
||||
* @see build/generate-registry-annotations.php
|
||||
* @generate-registry-docblock
|
||||
* TODO: These tags need to be removed once we get rid of LegacyEnumShimTrait (PM6)
|
||||
* These are retained for backwards compatibility only.
|
||||
*
|
||||
* @method static SuspiciousStewType ALLIUM()
|
||||
* @method static SuspiciousStewType AZURE_BLUET()
|
||||
@@ -44,61 +42,36 @@ use pocketmine\utils\EnumTrait;
|
||||
* @method static SuspiciousStewType TULIP()
|
||||
* @method static SuspiciousStewType WITHER_ROSE()
|
||||
*/
|
||||
final class SuspiciousStewType{
|
||||
use EnumTrait {
|
||||
__construct as Enum___construct;
|
||||
}
|
||||
enum SuspiciousStewType{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
protected static function setup() : void{
|
||||
self::registerAll(
|
||||
new self("poppy", fn() => [
|
||||
new EffectInstance(VanillaEffects::NIGHT_VISION(), 80)
|
||||
]),
|
||||
new self("cornflower", fn() => [
|
||||
new EffectInstance(VanillaEffects::JUMP_BOOST(), 80)
|
||||
]),
|
||||
new self("tulip", fn() => [
|
||||
new EffectInstance(VanillaEffects::WEAKNESS(), 140)
|
||||
]),
|
||||
new self("azure_bluet", fn() => [
|
||||
new EffectInstance(VanillaEffects::BLINDNESS(), 120)
|
||||
]),
|
||||
new self("lily_of_the_valley", fn() => [
|
||||
new EffectInstance(VanillaEffects::POISON(), 200)
|
||||
]),
|
||||
new self("dandelion", fn() => [
|
||||
new EffectInstance(VanillaEffects::SATURATION(), 6)
|
||||
]),
|
||||
new self("blue_orchid", fn() => [
|
||||
new EffectInstance(VanillaEffects::SATURATION(), 6)
|
||||
]),
|
||||
new self("allium", fn() => [
|
||||
new EffectInstance(VanillaEffects::FIRE_RESISTANCE(), 40)
|
||||
]),
|
||||
new self("oxeye_daisy", fn() => [
|
||||
new EffectInstance(VanillaEffects::REGENERATION(), 120)
|
||||
]),
|
||||
new self("wither_rose", fn() => [
|
||||
new EffectInstance(VanillaEffects::WITHER(), 120)
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @phpstan-param \Closure() : list<EffectInstance> $effectsGetter
|
||||
*/
|
||||
private function __construct(
|
||||
string $enumName,
|
||||
private \Closure $effectsGetter
|
||||
){
|
||||
$this->Enum___construct($enumName);
|
||||
}
|
||||
case POPPY;
|
||||
case CORNFLOWER;
|
||||
case TULIP;
|
||||
case AZURE_BLUET;
|
||||
case LILY_OF_THE_VALLEY;
|
||||
case DANDELION;
|
||||
case BLUE_ORCHID;
|
||||
case ALLIUM;
|
||||
case OXEYE_DAISY;
|
||||
case WITHER_ROSE;
|
||||
|
||||
/**
|
||||
* @return EffectInstance[]
|
||||
* @phpstan-return list<EffectInstance>
|
||||
*/
|
||||
public function getEffects() : array{
|
||||
return ($this->effectsGetter)();
|
||||
return match($this){
|
||||
self::POPPY => [new EffectInstance(VanillaEffects::NIGHT_VISION(), 80)],
|
||||
self::CORNFLOWER => [new EffectInstance(VanillaEffects::JUMP_BOOST(), 80)],
|
||||
self::TULIP => [new EffectInstance(VanillaEffects::WEAKNESS(), 140)],
|
||||
self::AZURE_BLUET => [new EffectInstance(VanillaEffects::BLINDNESS(), 120)],
|
||||
self::LILY_OF_THE_VALLEY => [new EffectInstance(VanillaEffects::POISON(), 200)],
|
||||
self::DANDELION,
|
||||
self::BLUE_ORCHID => [new EffectInstance(VanillaEffects::SATURATION(), 6)],
|
||||
self::ALLIUM => [new EffectInstance(VanillaEffects::FIRE_RESISTANCE(), 40)],
|
||||
self::OXEYE_DAISY => [new EffectInstance(VanillaEffects::REGENERATION(), 120)],
|
||||
self::WITHER_ROSE => [new EffectInstance(VanillaEffects::WITHER(), 120)]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -51,7 +51,7 @@ abstract class TieredTool extends Tool{
|
||||
}
|
||||
|
||||
public function getFuelTime() : int{
|
||||
if($this->tier->equals(ToolTier::WOOD())){
|
||||
if($this->tier === ToolTier::WOOD){
|
||||
return 200;
|
||||
}
|
||||
|
||||
@@ -59,6 +59,6 @@ abstract class TieredTool extends Tool{
|
||||
}
|
||||
|
||||
public function isFireProof() : bool{
|
||||
return $this->tier->equals(ToolTier::NETHERITE());
|
||||
return $this->tier === ToolTier::NETHERITE;
|
||||
}
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\item;
|
||||
|
||||
use pocketmine\utils\EnumTrait;
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
|
||||
/**
|
||||
* This doc-block is generated automatically, do not modify it manually.
|
||||
@@ -37,48 +37,55 @@ use pocketmine\utils\EnumTrait;
|
||||
* @method static ToolTier NETHERITE()
|
||||
* @method static ToolTier STONE()
|
||||
* @method static ToolTier WOOD()
|
||||
*
|
||||
* @phpstan-type TMetadata array{0: int, 1: int, 2: int, 3: int, 4: int}
|
||||
*/
|
||||
final class ToolTier{
|
||||
use EnumTrait {
|
||||
__construct as Enum___construct;
|
||||
enum ToolTier{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case WOOD;
|
||||
case GOLD;
|
||||
case STONE;
|
||||
case IRON;
|
||||
case DIAMOND;
|
||||
case NETHERITE;
|
||||
|
||||
/**
|
||||
* This function exists only to permit the use of named arguments and to make the code easier to read in PhpStorm.
|
||||
* @phpstan-return TMetadata
|
||||
*/
|
||||
private static function meta(int $harvestLevel, int $maxDurability, int $baseAttackPoints, int $baseEfficiency, int $enchantability) : array{
|
||||
return [$harvestLevel, $maxDurability, $baseAttackPoints, $baseEfficiency, $enchantability];
|
||||
}
|
||||
|
||||
protected static function setup() : void{
|
||||
self::registerAll(
|
||||
new self("wood", 1, 60, 5, 2, 15),
|
||||
new self("gold", 2, 33, 5, 12, 22),
|
||||
new self("stone", 3, 132, 6, 4, 5),
|
||||
new self("iron", 4, 251, 7, 6, 14),
|
||||
new self("diamond", 5, 1562, 8, 8, 10),
|
||||
new self("netherite", 6, 2032, 9, 9, 15)
|
||||
);
|
||||
}
|
||||
|
||||
private function __construct(
|
||||
string $name,
|
||||
private int $harvestLevel,
|
||||
private int $maxDurability,
|
||||
private int $baseAttackPoints,
|
||||
private int $baseEfficiency,
|
||||
private int $enchantability
|
||||
){
|
||||
$this->Enum___construct($name);
|
||||
/**
|
||||
* @phpstan-return TMetadata
|
||||
*/
|
||||
private function getMetadata() : array{
|
||||
return match($this){
|
||||
self::WOOD => self::meta(1, 60, 5, 2, 15),
|
||||
self::GOLD => self::meta(2, 33, 5, 12, 22),
|
||||
self::STONE => self::meta(3, 132, 6, 4, 5),
|
||||
self::IRON => self::meta(4, 251, 7, 6, 14),
|
||||
self::DIAMOND => self::meta(5, 1562, 8, 8, 10),
|
||||
self::NETHERITE => self::meta(6, 2032, 9, 9, 15)
|
||||
};
|
||||
}
|
||||
|
||||
public function getHarvestLevel() : int{
|
||||
return $this->harvestLevel;
|
||||
return $this->getMetadata()[0];
|
||||
}
|
||||
|
||||
public function getMaxDurability() : int{
|
||||
return $this->maxDurability;
|
||||
return $this->getMetadata()[1];
|
||||
}
|
||||
|
||||
public function getBaseAttackPoints() : int{
|
||||
return $this->baseAttackPoints;
|
||||
return $this->getMetadata()[2];
|
||||
}
|
||||
|
||||
public function getBaseEfficiency() : int{
|
||||
return $this->baseEfficiency;
|
||||
return $this->getMetadata()[3];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,6 +95,6 @@ final class ToolTier{
|
||||
* or multiple enchantments upon being enchanted in an enchanting table.
|
||||
*/
|
||||
public function getEnchantability() : int{
|
||||
return $this->enchantability;
|
||||
return $this->getMetadata()[4];
|
||||
}
|
||||
}
|
||||
|
@@ -506,21 +506,21 @@ final class VanillaItems{
|
||||
self::register("raw_porkchop", new RawPorkchop(new IID(Ids::RAW_PORKCHOP), "Raw Porkchop"));
|
||||
self::register("raw_rabbit", new RawRabbit(new IID(Ids::RAW_RABBIT), "Raw Rabbit"));
|
||||
self::register("raw_salmon", new RawSalmon(new IID(Ids::RAW_SALMON), "Raw Salmon"));
|
||||
self::register("record_11", new Record(new IID(Ids::RECORD_11), RecordType::DISK_11(), "Record 11"));
|
||||
self::register("record_13", new Record(new IID(Ids::RECORD_13), RecordType::DISK_13(), "Record 13"));
|
||||
self::register("record_5", new Record(new IID(Ids::RECORD_5), RecordType::DISK_5(), "Record 5"));
|
||||
self::register("record_blocks", new Record(new IID(Ids::RECORD_BLOCKS), RecordType::DISK_BLOCKS(), "Record Blocks"));
|
||||
self::register("record_cat", new Record(new IID(Ids::RECORD_CAT), RecordType::DISK_CAT(), "Record Cat"));
|
||||
self::register("record_chirp", new Record(new IID(Ids::RECORD_CHIRP), RecordType::DISK_CHIRP(), "Record Chirp"));
|
||||
self::register("record_far", new Record(new IID(Ids::RECORD_FAR), RecordType::DISK_FAR(), "Record Far"));
|
||||
self::register("record_mall", new Record(new IID(Ids::RECORD_MALL), RecordType::DISK_MALL(), "Record Mall"));
|
||||
self::register("record_mellohi", new Record(new IID(Ids::RECORD_MELLOHI), RecordType::DISK_MELLOHI(), "Record Mellohi"));
|
||||
self::register("record_otherside", new Record(new IID(Ids::RECORD_OTHERSIDE), RecordType::DISK_OTHERSIDE(), "Record Otherside"));
|
||||
self::register("record_pigstep", new Record(new IID(Ids::RECORD_PIGSTEP), RecordType::DISK_PIGSTEP(), "Record Pigstep"));
|
||||
self::register("record_stal", new Record(new IID(Ids::RECORD_STAL), RecordType::DISK_STAL(), "Record Stal"));
|
||||
self::register("record_strad", new Record(new IID(Ids::RECORD_STRAD), RecordType::DISK_STRAD(), "Record Strad"));
|
||||
self::register("record_wait", new Record(new IID(Ids::RECORD_WAIT), RecordType::DISK_WAIT(), "Record Wait"));
|
||||
self::register("record_ward", new Record(new IID(Ids::RECORD_WARD), RecordType::DISK_WARD(), "Record Ward"));
|
||||
self::register("record_11", new Record(new IID(Ids::RECORD_11), RecordType::DISK_11, "Record 11"));
|
||||
self::register("record_13", new Record(new IID(Ids::RECORD_13), RecordType::DISK_13, "Record 13"));
|
||||
self::register("record_5", new Record(new IID(Ids::RECORD_5), RecordType::DISK_5, "Record 5"));
|
||||
self::register("record_blocks", new Record(new IID(Ids::RECORD_BLOCKS), RecordType::DISK_BLOCKS, "Record Blocks"));
|
||||
self::register("record_cat", new Record(new IID(Ids::RECORD_CAT), RecordType::DISK_CAT, "Record Cat"));
|
||||
self::register("record_chirp", new Record(new IID(Ids::RECORD_CHIRP), RecordType::DISK_CHIRP, "Record Chirp"));
|
||||
self::register("record_far", new Record(new IID(Ids::RECORD_FAR), RecordType::DISK_FAR, "Record Far"));
|
||||
self::register("record_mall", new Record(new IID(Ids::RECORD_MALL), RecordType::DISK_MALL, "Record Mall"));
|
||||
self::register("record_mellohi", new Record(new IID(Ids::RECORD_MELLOHI), RecordType::DISK_MELLOHI, "Record Mellohi"));
|
||||
self::register("record_otherside", new Record(new IID(Ids::RECORD_OTHERSIDE), RecordType::DISK_OTHERSIDE, "Record Otherside"));
|
||||
self::register("record_pigstep", new Record(new IID(Ids::RECORD_PIGSTEP), RecordType::DISK_PIGSTEP, "Record Pigstep"));
|
||||
self::register("record_stal", new Record(new IID(Ids::RECORD_STAL), RecordType::DISK_STAL, "Record Stal"));
|
||||
self::register("record_strad", new Record(new IID(Ids::RECORD_STRAD), RecordType::DISK_STRAD, "Record Strad"));
|
||||
self::register("record_wait", new Record(new IID(Ids::RECORD_WAIT), RecordType::DISK_WAIT, "Record Wait"));
|
||||
self::register("record_ward", new Record(new IID(Ids::RECORD_WARD), RecordType::DISK_WARD, "Record Ward"));
|
||||
self::register("redstone_dust", new Redstone(new IID(Ids::REDSTONE_DUST), "Redstone"));
|
||||
self::register("rotten_flesh", new RottenFlesh(new IID(Ids::ROTTEN_FLESH), "Rotten Flesh"));
|
||||
self::register("scute", new Item(new IID(Ids::SCUTE), "Scute"));
|
||||
@@ -579,36 +579,36 @@ final class VanillaItems{
|
||||
}
|
||||
|
||||
private static function registerTierToolItems() : void{
|
||||
self::register("diamond_axe", new Axe(new IID(Ids::DIAMOND_AXE), "Diamond Axe", ToolTier::DIAMOND(), [EnchantmentTags::AXE]));
|
||||
self::register("golden_axe", new Axe(new IID(Ids::GOLDEN_AXE), "Golden Axe", ToolTier::GOLD(), [EnchantmentTags::AXE]));
|
||||
self::register("iron_axe", new Axe(new IID(Ids::IRON_AXE), "Iron Axe", ToolTier::IRON(), [EnchantmentTags::AXE]));
|
||||
self::register("netherite_axe", new Axe(new IID(Ids::NETHERITE_AXE), "Netherite Axe", ToolTier::NETHERITE(), [EnchantmentTags::AXE]));
|
||||
self::register("stone_axe", new Axe(new IID(Ids::STONE_AXE), "Stone Axe", ToolTier::STONE(), [EnchantmentTags::AXE]));
|
||||
self::register("wooden_axe", new Axe(new IID(Ids::WOODEN_AXE), "Wooden Axe", ToolTier::WOOD(), [EnchantmentTags::AXE]));
|
||||
self::register("diamond_hoe", new Hoe(new IID(Ids::DIAMOND_HOE), "Diamond Hoe", ToolTier::DIAMOND(), [EnchantmentTags::HOE]));
|
||||
self::register("golden_hoe", new Hoe(new IID(Ids::GOLDEN_HOE), "Golden Hoe", ToolTier::GOLD(), [EnchantmentTags::HOE]));
|
||||
self::register("iron_hoe", new Hoe(new IID(Ids::IRON_HOE), "Iron Hoe", ToolTier::IRON(), [EnchantmentTags::HOE]));
|
||||
self::register("netherite_hoe", new Hoe(new IID(Ids::NETHERITE_HOE), "Netherite Hoe", ToolTier::NETHERITE(), [EnchantmentTags::HOE]));
|
||||
self::register("stone_hoe", new Hoe(new IID(Ids::STONE_HOE), "Stone Hoe", ToolTier::STONE(), [EnchantmentTags::HOE]));
|
||||
self::register("wooden_hoe", new Hoe(new IID(Ids::WOODEN_HOE), "Wooden Hoe", ToolTier::WOOD(), [EnchantmentTags::HOE]));
|
||||
self::register("diamond_pickaxe", new Pickaxe(new IID(Ids::DIAMOND_PICKAXE), "Diamond Pickaxe", ToolTier::DIAMOND(), [EnchantmentTags::PICKAXE]));
|
||||
self::register("golden_pickaxe", new Pickaxe(new IID(Ids::GOLDEN_PICKAXE), "Golden Pickaxe", ToolTier::GOLD(), [EnchantmentTags::PICKAXE]));
|
||||
self::register("iron_pickaxe", new Pickaxe(new IID(Ids::IRON_PICKAXE), "Iron Pickaxe", ToolTier::IRON(), [EnchantmentTags::PICKAXE]));
|
||||
self::register("netherite_pickaxe", new Pickaxe(new IID(Ids::NETHERITE_PICKAXE), "Netherite Pickaxe", ToolTier::NETHERITE(), [EnchantmentTags::PICKAXE]));
|
||||
self::register("stone_pickaxe", new Pickaxe(new IID(Ids::STONE_PICKAXE), "Stone Pickaxe", ToolTier::STONE(), [EnchantmentTags::PICKAXE]));
|
||||
self::register("wooden_pickaxe", new Pickaxe(new IID(Ids::WOODEN_PICKAXE), "Wooden Pickaxe", ToolTier::WOOD(), [EnchantmentTags::PICKAXE]));
|
||||
self::register("diamond_shovel", new Shovel(new IID(Ids::DIAMOND_SHOVEL), "Diamond Shovel", ToolTier::DIAMOND(), [EnchantmentTags::SHOVEL]));
|
||||
self::register("golden_shovel", new Shovel(new IID(Ids::GOLDEN_SHOVEL), "Golden Shovel", ToolTier::GOLD(), [EnchantmentTags::SHOVEL]));
|
||||
self::register("iron_shovel", new Shovel(new IID(Ids::IRON_SHOVEL), "Iron Shovel", ToolTier::IRON(), [EnchantmentTags::SHOVEL]));
|
||||
self::register("netherite_shovel", new Shovel(new IID(Ids::NETHERITE_SHOVEL), "Netherite Shovel", ToolTier::NETHERITE(), [EnchantmentTags::SHOVEL]));
|
||||
self::register("stone_shovel", new Shovel(new IID(Ids::STONE_SHOVEL), "Stone Shovel", ToolTier::STONE(), [EnchantmentTags::SHOVEL]));
|
||||
self::register("wooden_shovel", new Shovel(new IID(Ids::WOODEN_SHOVEL), "Wooden Shovel", ToolTier::WOOD(), [EnchantmentTags::SHOVEL]));
|
||||
self::register("diamond_sword", new Sword(new IID(Ids::DIAMOND_SWORD), "Diamond Sword", ToolTier::DIAMOND(), [EnchantmentTags::SWORD]));
|
||||
self::register("golden_sword", new Sword(new IID(Ids::GOLDEN_SWORD), "Golden Sword", ToolTier::GOLD(), [EnchantmentTags::SWORD]));
|
||||
self::register("iron_sword", new Sword(new IID(Ids::IRON_SWORD), "Iron Sword", ToolTier::IRON(), [EnchantmentTags::SWORD]));
|
||||
self::register("netherite_sword", new Sword(new IID(Ids::NETHERITE_SWORD), "Netherite Sword", ToolTier::NETHERITE(), [EnchantmentTags::SWORD]));
|
||||
self::register("stone_sword", new Sword(new IID(Ids::STONE_SWORD), "Stone Sword", ToolTier::STONE(), [EnchantmentTags::SWORD]));
|
||||
self::register("wooden_sword", new Sword(new IID(Ids::WOODEN_SWORD), "Wooden Sword", ToolTier::WOOD(), [EnchantmentTags::SWORD]));
|
||||
self::register("diamond_axe", new Axe(new IID(Ids::DIAMOND_AXE), "Diamond Axe", ToolTier::DIAMOND, [EnchantmentTags::AXE]));
|
||||
self::register("golden_axe", new Axe(new IID(Ids::GOLDEN_AXE), "Golden Axe", ToolTier::GOLD, [EnchantmentTags::AXE]));
|
||||
self::register("iron_axe", new Axe(new IID(Ids::IRON_AXE), "Iron Axe", ToolTier::IRON, [EnchantmentTags::AXE]));
|
||||
self::register("netherite_axe", new Axe(new IID(Ids::NETHERITE_AXE), "Netherite Axe", ToolTier::NETHERITE, [EnchantmentTags::AXE]));
|
||||
self::register("stone_axe", new Axe(new IID(Ids::STONE_AXE), "Stone Axe", ToolTier::STONE, [EnchantmentTags::AXE]));
|
||||
self::register("wooden_axe", new Axe(new IID(Ids::WOODEN_AXE), "Wooden Axe", ToolTier::WOOD, [EnchantmentTags::AXE]));
|
||||
self::register("diamond_hoe", new Hoe(new IID(Ids::DIAMOND_HOE), "Diamond Hoe", ToolTier::DIAMOND, [EnchantmentTags::HOE]));
|
||||
self::register("golden_hoe", new Hoe(new IID(Ids::GOLDEN_HOE), "Golden Hoe", ToolTier::GOLD, [EnchantmentTags::HOE]));
|
||||
self::register("iron_hoe", new Hoe(new IID(Ids::IRON_HOE), "Iron Hoe", ToolTier::IRON, [EnchantmentTags::HOE]));
|
||||
self::register("netherite_hoe", new Hoe(new IID(Ids::NETHERITE_HOE), "Netherite Hoe", ToolTier::NETHERITE, [EnchantmentTags::HOE]));
|
||||
self::register("stone_hoe", new Hoe(new IID(Ids::STONE_HOE), "Stone Hoe", ToolTier::STONE, [EnchantmentTags::HOE]));
|
||||
self::register("wooden_hoe", new Hoe(new IID(Ids::WOODEN_HOE), "Wooden Hoe", ToolTier::WOOD, [EnchantmentTags::HOE]));
|
||||
self::register("diamond_pickaxe", new Pickaxe(new IID(Ids::DIAMOND_PICKAXE), "Diamond Pickaxe", ToolTier::DIAMOND, [EnchantmentTags::PICKAXE]));
|
||||
self::register("golden_pickaxe", new Pickaxe(new IID(Ids::GOLDEN_PICKAXE), "Golden Pickaxe", ToolTier::GOLD, [EnchantmentTags::PICKAXE]));
|
||||
self::register("iron_pickaxe", new Pickaxe(new IID(Ids::IRON_PICKAXE), "Iron Pickaxe", ToolTier::IRON, [EnchantmentTags::PICKAXE]));
|
||||
self::register("netherite_pickaxe", new Pickaxe(new IID(Ids::NETHERITE_PICKAXE), "Netherite Pickaxe", ToolTier::NETHERITE, [EnchantmentTags::PICKAXE]));
|
||||
self::register("stone_pickaxe", new Pickaxe(new IID(Ids::STONE_PICKAXE), "Stone Pickaxe", ToolTier::STONE, [EnchantmentTags::PICKAXE]));
|
||||
self::register("wooden_pickaxe", new Pickaxe(new IID(Ids::WOODEN_PICKAXE), "Wooden Pickaxe", ToolTier::WOOD, [EnchantmentTags::PICKAXE]));
|
||||
self::register("diamond_shovel", new Shovel(new IID(Ids::DIAMOND_SHOVEL), "Diamond Shovel", ToolTier::DIAMOND, [EnchantmentTags::SHOVEL]));
|
||||
self::register("golden_shovel", new Shovel(new IID(Ids::GOLDEN_SHOVEL), "Golden Shovel", ToolTier::GOLD, [EnchantmentTags::SHOVEL]));
|
||||
self::register("iron_shovel", new Shovel(new IID(Ids::IRON_SHOVEL), "Iron Shovel", ToolTier::IRON, [EnchantmentTags::SHOVEL]));
|
||||
self::register("netherite_shovel", new Shovel(new IID(Ids::NETHERITE_SHOVEL), "Netherite Shovel", ToolTier::NETHERITE, [EnchantmentTags::SHOVEL]));
|
||||
self::register("stone_shovel", new Shovel(new IID(Ids::STONE_SHOVEL), "Stone Shovel", ToolTier::STONE, [EnchantmentTags::SHOVEL]));
|
||||
self::register("wooden_shovel", new Shovel(new IID(Ids::WOODEN_SHOVEL), "Wooden Shovel", ToolTier::WOOD, [EnchantmentTags::SHOVEL]));
|
||||
self::register("diamond_sword", new Sword(new IID(Ids::DIAMOND_SWORD), "Diamond Sword", ToolTier::DIAMOND, [EnchantmentTags::SWORD]));
|
||||
self::register("golden_sword", new Sword(new IID(Ids::GOLDEN_SWORD), "Golden Sword", ToolTier::GOLD, [EnchantmentTags::SWORD]));
|
||||
self::register("iron_sword", new Sword(new IID(Ids::IRON_SWORD), "Iron Sword", ToolTier::IRON, [EnchantmentTags::SWORD]));
|
||||
self::register("netherite_sword", new Sword(new IID(Ids::NETHERITE_SWORD), "Netherite Sword", ToolTier::NETHERITE, [EnchantmentTags::SWORD]));
|
||||
self::register("stone_sword", new Sword(new IID(Ids::STONE_SWORD), "Stone Sword", ToolTier::STONE, [EnchantmentTags::SWORD]));
|
||||
self::register("wooden_sword", new Sword(new IID(Ids::WOODEN_SWORD), "Wooden Sword", ToolTier::WOOD, [EnchantmentTags::SWORD]));
|
||||
}
|
||||
|
||||
private static function registerArmorItems() : void{
|
||||
|
Reference in New Issue
Block a user