mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Migrate all but two remaining legacy enums to native PHP 8.1 enums
This commit is contained in:
parent
ae564e445d
commit
94d98fb5c4
@ -48,11 +48,6 @@ abstract class BaseBanner extends Transparent{
|
||||
*/
|
||||
protected array $patterns = [];
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
|
||||
$this->color = DyeColor::BLACK();
|
||||
parent::__construct($idInfo, $name, $typeInfo);
|
||||
}
|
||||
|
||||
public function readStateFromWorld() : Block{
|
||||
parent::readStateFromWorld();
|
||||
$tile = $this->position->getWorld()->getTile($this->position);
|
||||
|
@ -172,13 +172,13 @@ abstract class BaseSign extends Transparent{
|
||||
}
|
||||
|
||||
$dyeColor = $item instanceof Dye ? $item->getColor() : match($item->getTypeId()){
|
||||
ItemTypeIds::BONE_MEAL => DyeColor::WHITE(),
|
||||
ItemTypeIds::LAPIS_LAZULI => DyeColor::BLUE(),
|
||||
ItemTypeIds::COCOA_BEANS => DyeColor::BROWN(),
|
||||
ItemTypeIds::BONE_MEAL => DyeColor::WHITE,
|
||||
ItemTypeIds::LAPIS_LAZULI => DyeColor::BLUE,
|
||||
ItemTypeIds::COCOA_BEANS => DyeColor::BROWN,
|
||||
default => null
|
||||
};
|
||||
if($dyeColor !== null){
|
||||
$color = $dyeColor->equals(DyeColor::BLACK()) ? new Color(0, 0, 0) : $dyeColor->getRgbValue();
|
||||
$color = $dyeColor === DyeColor::BLACK ? new Color(0, 0, 0) : $dyeColor->getRgbValue();
|
||||
if(
|
||||
$color->toARGB() !== $this->text->getBaseColor()->toARGB() &&
|
||||
$this->doSignChange(new SignText($this->text->getLines(), $color, $this->text->isGlowing()), $player, $item)
|
||||
|
@ -48,11 +48,6 @@ class Bed extends Transparent{
|
||||
protected bool $occupied = false;
|
||||
protected bool $head = false;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
|
||||
$this->color = DyeColor::RED();
|
||||
parent::__construct($idInfo, $name, $typeInfo);
|
||||
}
|
||||
|
||||
protected function describeBlockOnlyState(RuntimeDataDescriber $w) : void{
|
||||
$w->horizontalFacing($this->facing);
|
||||
$w->bool($this->occupied);
|
||||
@ -65,6 +60,8 @@ class Bed extends Transparent{
|
||||
$tile = $this->position->getWorld()->getTile($this->position);
|
||||
if($tile instanceof TileBed){
|
||||
$this->color = $tile->getColor();
|
||||
}else{
|
||||
$this->color = DyeColor::RED; //legacy pre-1.1 beds don't have tiles
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
@ -30,7 +30,7 @@ class CakeWithDyedCandle extends CakeWithCandle{
|
||||
use ColoredTrait;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
|
||||
$this->color = DyeColor::WHITE();
|
||||
$this->color = DyeColor::WHITE;
|
||||
parent::__construct($idInfo, $name, $typeInfo);
|
||||
}
|
||||
|
||||
|
@ -35,11 +35,6 @@ use pocketmine\world\BlockTransaction;
|
||||
class Carpet extends Flowable{
|
||||
use ColoredTrait;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
|
||||
$this->color = DyeColor::WHITE();
|
||||
parent::__construct($idInfo, $name, $typeInfo);
|
||||
}
|
||||
|
||||
public function isSolid() : bool{
|
||||
return true;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ final class Cauldron extends Transparent{
|
||||
}elseif($item->getTypeId() === ItemTypeIds::POWDER_SNOW_BUCKET){
|
||||
//TODO: powder snow cauldron
|
||||
}elseif($item instanceof Potion || $item instanceof SplashPotion){ //TODO: lingering potion
|
||||
if($item->getType()->equals(PotionType::WATER())){
|
||||
if($item->getType() === PotionType::WATER){
|
||||
$this->fill(WaterCauldron::WATER_BOTTLE_FILL_AMOUNT, VanillaBlocks::WATER_CAULDRON(), $item, VanillaItems::GLASS_BOTTLE(), $returnedItems);
|
||||
}else{
|
||||
$this->fill(PotionCauldron::POTION_FILL_AMOUNT, VanillaBlocks::POTION_CAULDRON()->setPotionItem($item), $item, VanillaItems::GLASS_BOTTLE(), $returnedItems);
|
||||
|
@ -28,9 +28,4 @@ use pocketmine\block\utils\DyeColor;
|
||||
|
||||
class Concrete extends Opaque{
|
||||
use ColoredTrait;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
|
||||
$this->color = DyeColor::WHITE();
|
||||
parent::__construct($idInfo, $name, $typeInfo);
|
||||
}
|
||||
}
|
||||
|
@ -36,11 +36,6 @@ class ConcretePowder extends Opaque implements Fallable{
|
||||
onNearbyBlockChange as protected startFalling;
|
||||
}
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
|
||||
$this->color = DyeColor::WHITE();
|
||||
parent::__construct($idInfo, $name, $typeInfo);
|
||||
}
|
||||
|
||||
public function onNearbyBlockChange() : void{
|
||||
if(($water = $this->getAdjacentWater()) !== null){
|
||||
BlockEventHelper::form($this, VanillaBlocks::CONCRETE()->setColor($this->color), $water);
|
||||
|
@ -75,7 +75,7 @@ class Dirt extends Opaque{
|
||||
$item->pop();
|
||||
$world->setBlock($down->position, VanillaBlocks::HANGING_ROOTS());
|
||||
//TODO: bonemeal particles, growth sounds
|
||||
}elseif(($item instanceof Potion || $item instanceof SplashPotion) && $item->getType()->equals(PotionType::WATER())){
|
||||
}elseif(($item instanceof Potion || $item instanceof SplashPotion) && $item->getType() === PotionType::WATER){
|
||||
$item->pop();
|
||||
$world->setBlock($this->position, VanillaBlocks::MUD());
|
||||
$world->addSound($this->position, new WaterSplashSound(0.5));
|
||||
|
@ -29,14 +29,9 @@ use pocketmine\block\utils\DyeColor;
|
||||
class DyedCandle extends Candle{
|
||||
use ColoredTrait;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
|
||||
$this->color = DyeColor::WHITE();
|
||||
parent::__construct($idInfo, $name, $typeInfo);
|
||||
}
|
||||
|
||||
protected function getCandleIfCompatibleType(Block $block) : ?Candle{
|
||||
$result = parent::getCandleIfCompatibleType($block);
|
||||
//different coloured candles can't be combined in the same block
|
||||
return $result instanceof DyedCandle && $result->color->equals($this->color) ? $result : null;
|
||||
return $result instanceof DyedCandle && $result->color === $this->color ? $result : null;
|
||||
}
|
||||
}
|
||||
|
@ -28,9 +28,4 @@ use pocketmine\block\utils\DyeColor;
|
||||
|
||||
final class DyedShulkerBox extends ShulkerBox{
|
||||
use ColoredTrait;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
|
||||
$this->color = DyeColor::WHITE();
|
||||
parent::__construct($idInfo, $name, $typeInfo);
|
||||
}
|
||||
}
|
||||
|
@ -30,9 +30,4 @@ use pocketmine\block\utils\FacesOppositePlacingPlayerTrait;
|
||||
class GlazedTerracotta extends Opaque{
|
||||
use ColoredTrait;
|
||||
use FacesOppositePlacingPlayerTrait;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
|
||||
$this->color = DyeColor::BLACK();
|
||||
parent::__construct($idInfo, $name, $typeInfo);
|
||||
}
|
||||
}
|
||||
|
@ -28,9 +28,4 @@ use pocketmine\block\utils\DyeColor;
|
||||
|
||||
final class StainedGlass extends Glass{
|
||||
use ColoredTrait;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
|
||||
$this->color = DyeColor::WHITE();
|
||||
parent::__construct($idInfo, $name, $typeInfo);
|
||||
}
|
||||
}
|
||||
|
@ -28,9 +28,4 @@ use pocketmine\block\utils\DyeColor;
|
||||
|
||||
final class StainedGlassPane extends GlassPane{
|
||||
use ColoredTrait;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
|
||||
$this->color = DyeColor::WHITE();
|
||||
parent::__construct($idInfo, $name, $typeInfo);
|
||||
}
|
||||
}
|
||||
|
@ -28,9 +28,4 @@ use pocketmine\block\utils\DyeColor;
|
||||
|
||||
final class StainedHardenedClay extends HardenedClay{
|
||||
use ColoredTrait;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
|
||||
$this->color = DyeColor::WHITE();
|
||||
parent::__construct($idInfo, $name, $typeInfo);
|
||||
}
|
||||
}
|
||||
|
@ -28,9 +28,4 @@ use pocketmine\block\utils\DyeColor;
|
||||
|
||||
final class StainedHardenedGlass extends HardenedGlass{
|
||||
use ColoredTrait;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
|
||||
$this->color = DyeColor::WHITE();
|
||||
parent::__construct($idInfo, $name, $typeInfo);
|
||||
}
|
||||
}
|
||||
|
@ -28,9 +28,4 @@ use pocketmine\block\utils\DyeColor;
|
||||
|
||||
final class StainedHardenedGlassPane extends HardenedGlassPane{
|
||||
use ColoredTrait;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
|
||||
$this->color = DyeColor::WHITE();
|
||||
parent::__construct($idInfo, $name, $typeInfo);
|
||||
}
|
||||
}
|
||||
|
@ -783,7 +783,7 @@ final class VanillaBlocks{
|
||||
$railBreakInfo = new Info(new BlockBreakInfo(0.7));
|
||||
self::register("activator_rail", new ActivatorRail(new BID(Ids::ACTIVATOR_RAIL), "Activator Rail", $railBreakInfo));
|
||||
self::register("air", new Air(new BID(Ids::AIR), "Air", new Info(BreakInfo::indestructible(-1.0))));
|
||||
self::register("anvil", new Anvil(new BID(Ids::ANVIL), "Anvil", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD(), 6000.0))));
|
||||
self::register("anvil", new Anvil(new BID(Ids::ANVIL), "Anvil", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD, 6000.0))));
|
||||
self::register("bamboo", new Bamboo(new BID(Ids::BAMBOO), "Bamboo", new Info(new class(2.0 /* 1.0 in PC */, ToolType::AXE) extends BreakInfo{
|
||||
public function getBreakTime(Item $item) : float{
|
||||
if($item->getBlockToolType() === ToolType::SWORD){
|
||||
@ -804,13 +804,13 @@ final class VanillaBlocks{
|
||||
self::register("bedrock", new Bedrock(new BID(Ids::BEDROCK), "Bedrock", new Info(BreakInfo::indestructible())));
|
||||
|
||||
self::register("beetroots", new Beetroot(new BID(Ids::BEETROOTS), "Beetroot Block", new Info(BreakInfo::instant())));
|
||||
self::register("bell", new Bell(new BID(Ids::BELL, TileBell::class), "Bell", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD()))));
|
||||
self::register("bell", new Bell(new BID(Ids::BELL, TileBell::class), "Bell", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD))));
|
||||
self::register("blue_ice", new BlueIce(new BID(Ids::BLUE_ICE), "Blue Ice", new Info(BreakInfo::pickaxe(2.8))));
|
||||
self::register("bone_block", new BoneBlock(new BID(Ids::BONE_BLOCK), "Bone Block", new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD()))));
|
||||
self::register("bone_block", new BoneBlock(new BID(Ids::BONE_BLOCK), "Bone Block", new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD))));
|
||||
self::register("bookshelf", new Bookshelf(new BID(Ids::BOOKSHELF), "Bookshelf", new Info(BreakInfo::axe(1.5))));
|
||||
self::register("brewing_stand", new BrewingStand(new BID(Ids::BREWING_STAND, TileBrewingStand::class), "Brewing Stand", new Info(BreakInfo::pickaxe(0.5, ToolTier::WOOD()))));
|
||||
self::register("brewing_stand", new BrewingStand(new BID(Ids::BREWING_STAND, TileBrewingStand::class), "Brewing Stand", new Info(BreakInfo::pickaxe(0.5, ToolTier::WOOD))));
|
||||
|
||||
$bricksBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD(), 30.0));
|
||||
$bricksBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD, 30.0));
|
||||
self::register("brick_stairs", new Stair(new BID(Ids::BRICK_STAIRS), "Brick Stairs", $bricksBreakInfo));
|
||||
self::register("bricks", new Opaque(new BID(Ids::BRICKS), "Bricks", $bricksBreakInfo));
|
||||
|
||||
@ -822,9 +822,9 @@ final class VanillaBlocks{
|
||||
$chestBreakInfo = new Info(BreakInfo::axe(2.5));
|
||||
self::register("chest", new Chest(new BID(Ids::CHEST, TileChest::class), "Chest", $chestBreakInfo));
|
||||
self::register("clay", new Clay(new BID(Ids::CLAY), "Clay Block", new Info(BreakInfo::shovel(0.6))));
|
||||
self::register("coal", new Coal(new BID(Ids::COAL), "Coal Block", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD(), 30.0))));
|
||||
self::register("coal", new Coal(new BID(Ids::COAL), "Coal Block", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD, 30.0))));
|
||||
|
||||
$cobblestoneBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD(), 30.0));
|
||||
$cobblestoneBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD, 30.0));
|
||||
self::register("cobblestone", $cobblestone = new Opaque(new BID(Ids::COBBLESTONE), "Cobblestone", $cobblestoneBreakInfo));
|
||||
self::register("mossy_cobblestone", new Opaque(new BID(Ids::MOSSY_COBBLESTONE), "Mossy Cobblestone", $cobblestoneBreakInfo));
|
||||
self::register("cobblestone_stairs", new Stair(new BID(Ids::COBBLESTONE_STAIRS), "Cobblestone Stairs", $cobblestoneBreakInfo));
|
||||
@ -832,12 +832,12 @@ final class VanillaBlocks{
|
||||
|
||||
self::register("cobweb", new Cobweb(new BID(Ids::COBWEB), "Cobweb", new Info(new BreakInfo(4.0, ToolType::SWORD | ToolType::SHEARS, 1))));
|
||||
self::register("cocoa_pod", new CocoaBlock(new BID(Ids::COCOA_POD), "Cocoa Block", new Info(BreakInfo::axe(0.2, null, 15.0))));
|
||||
self::register("coral_block", new CoralBlock(new BID(Ids::CORAL_BLOCK), "Coral Block", new Info(BreakInfo::pickaxe(7.0, ToolTier::WOOD()))));
|
||||
self::register("coral_block", new CoralBlock(new BID(Ids::CORAL_BLOCK), "Coral Block", new Info(BreakInfo::pickaxe(7.0, ToolTier::WOOD))));
|
||||
self::register("daylight_sensor", new DaylightSensor(new BID(Ids::DAYLIGHT_SENSOR, TileDaylightSensor::class), "Daylight Sensor", new Info(BreakInfo::axe(0.2))));
|
||||
self::register("dead_bush", new DeadBush(new BID(Ids::DEAD_BUSH), "Dead Bush", new Info(BreakInfo::instant(ToolType::SHEARS, 1), [Tags::POTTABLE_PLANTS])));
|
||||
self::register("detector_rail", new DetectorRail(new BID(Ids::DETECTOR_RAIL), "Detector Rail", $railBreakInfo));
|
||||
|
||||
self::register("diamond", new Opaque(new BID(Ids::DIAMOND), "Diamond Block", new Info(BreakInfo::pickaxe(5.0, ToolTier::IRON(), 30.0))));
|
||||
self::register("diamond", new Opaque(new BID(Ids::DIAMOND), "Diamond Block", new Info(BreakInfo::pickaxe(5.0, ToolTier::IRON, 30.0))));
|
||||
self::register("dirt", new Dirt(new BID(Ids::DIRT), "Dirt", new Info(BreakInfo::shovel(0.5), [Tags::DIRT])));
|
||||
self::register("sunflower", new DoublePlant(new BID(Ids::SUNFLOWER), "Sunflower", new Info(BreakInfo::instant())));
|
||||
self::register("lilac", new DoublePlant(new BID(Ids::LILAC), "Lilac", new Info(BreakInfo::instant())));
|
||||
@ -846,19 +846,19 @@ final class VanillaBlocks{
|
||||
self::register("pink_petals", new PinkPetals(new BID(Ids::PINK_PETALS), "Pink Petals", new Info(BreakInfo::instant())));
|
||||
self::register("double_tallgrass", new DoubleTallGrass(new BID(Ids::DOUBLE_TALLGRASS), "Double Tallgrass", new Info(BreakInfo::instant(ToolType::SHEARS, 1))));
|
||||
self::register("large_fern", new DoubleTallGrass(new BID(Ids::LARGE_FERN), "Large Fern", new Info(BreakInfo::instant(ToolType::SHEARS, 1))));
|
||||
self::register("dragon_egg", new DragonEgg(new BID(Ids::DRAGON_EGG), "Dragon Egg", new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD()))));
|
||||
self::register("dragon_egg", new DragonEgg(new BID(Ids::DRAGON_EGG), "Dragon Egg", new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD))));
|
||||
self::register("dried_kelp", new DriedKelp(new BID(Ids::DRIED_KELP), "Dried Kelp Block", new Info(new BreakInfo(0.5, ToolType::NONE, 0, 12.5))));
|
||||
self::register("emerald", new Opaque(new BID(Ids::EMERALD), "Emerald Block", new Info(BreakInfo::pickaxe(5.0, ToolTier::IRON(), 30.0))));
|
||||
self::register("enchanting_table", new EnchantingTable(new BID(Ids::ENCHANTING_TABLE, TileEnchantingTable::class), "Enchanting Table", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD(), 6000.0))));
|
||||
self::register("emerald", new Opaque(new BID(Ids::EMERALD), "Emerald Block", new Info(BreakInfo::pickaxe(5.0, ToolTier::IRON, 30.0))));
|
||||
self::register("enchanting_table", new EnchantingTable(new BID(Ids::ENCHANTING_TABLE, TileEnchantingTable::class), "Enchanting Table", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD, 6000.0))));
|
||||
self::register("end_portal_frame", new EndPortalFrame(new BID(Ids::END_PORTAL_FRAME), "End Portal Frame", new Info(BreakInfo::indestructible())));
|
||||
self::register("end_rod", new EndRod(new BID(Ids::END_ROD), "End Rod", new Info(BreakInfo::instant())));
|
||||
self::register("end_stone", new Opaque(new BID(Ids::END_STONE), "End Stone", new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD(), 45.0))));
|
||||
self::register("end_stone", new Opaque(new BID(Ids::END_STONE), "End Stone", new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD, 45.0))));
|
||||
|
||||
$endBrickBreakInfo = new Info(BreakInfo::pickaxe(0.8, ToolTier::WOOD(), 4.0));
|
||||
$endBrickBreakInfo = new Info(BreakInfo::pickaxe(0.8, ToolTier::WOOD, 4.0));
|
||||
self::register("end_stone_bricks", new Opaque(new BID(Ids::END_STONE_BRICKS), "End Stone Bricks", $endBrickBreakInfo));
|
||||
self::register("end_stone_brick_stairs", new Stair(new BID(Ids::END_STONE_BRICK_STAIRS), "End Stone Brick Stairs", $endBrickBreakInfo));
|
||||
|
||||
self::register("ender_chest", new EnderChest(new BID(Ids::ENDER_CHEST, TileEnderChest::class), "Ender Chest", new Info(BreakInfo::pickaxe(22.5, ToolTier::WOOD(), 3000.0))));
|
||||
self::register("ender_chest", new EnderChest(new BID(Ids::ENDER_CHEST, TileEnderChest::class), "Ender Chest", new Info(BreakInfo::pickaxe(22.5, ToolTier::WOOD, 3000.0))));
|
||||
self::register("farmland", new Farmland(new BID(Ids::FARMLAND), "Farmland", new Info(BreakInfo::shovel(0.6), [Tags::DIRT])));
|
||||
self::register("fire", new Fire(new BID(Ids::FIRE), "Fire Block", new Info(BreakInfo::instant(), [Tags::FIRE])));
|
||||
|
||||
@ -877,31 +877,31 @@ final class VanillaBlocks{
|
||||
self::register("white_tulip", new Flower(new BID(Ids::WHITE_TULIP), "White Tulip", $flowerTypeInfo));
|
||||
self::register("flower_pot", new FlowerPot(new BID(Ids::FLOWER_POT, TileFlowerPot::class), "Flower Pot", new Info(BreakInfo::instant())));
|
||||
self::register("frosted_ice", new FrostedIce(new BID(Ids::FROSTED_ICE), "Frosted Ice", new Info(BreakInfo::pickaxe(2.5))));
|
||||
self::register("furnace", new Furnace(new BID(Ids::FURNACE, TileNormalFurnace::class), "Furnace", new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD())), FurnaceType::FURNACE()));
|
||||
self::register("blast_furnace", new Furnace(new BID(Ids::BLAST_FURNACE, TileBlastFurnace::class), "Blast Furnace", new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD())), FurnaceType::BLAST_FURNACE()));
|
||||
self::register("smoker", new Furnace(new BID(Ids::SMOKER, TileSmoker::class), "Smoker", new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD())), FurnaceType::SMOKER()));
|
||||
self::register("furnace", new Furnace(new BID(Ids::FURNACE, TileNormalFurnace::class), "Furnace", new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD)), FurnaceType::FURNACE));
|
||||
self::register("blast_furnace", new Furnace(new BID(Ids::BLAST_FURNACE, TileBlastFurnace::class), "Blast Furnace", new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD)), FurnaceType::BLAST_FURNACE));
|
||||
self::register("smoker", new Furnace(new BID(Ids::SMOKER, TileSmoker::class), "Smoker", new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD)), FurnaceType::SMOKER));
|
||||
|
||||
$glassBreakInfo = new Info(new BreakInfo(0.3));
|
||||
self::register("glass", new Glass(new BID(Ids::GLASS), "Glass", $glassBreakInfo));
|
||||
self::register("glass_pane", new GlassPane(new BID(Ids::GLASS_PANE), "Glass Pane", $glassBreakInfo));
|
||||
self::register("glowing_obsidian", new GlowingObsidian(new BID(Ids::GLOWING_OBSIDIAN), "Glowing Obsidian", new Info(BreakInfo::pickaxe(10.0, ToolTier::DIAMOND(), 50.0))));
|
||||
self::register("glowing_obsidian", new GlowingObsidian(new BID(Ids::GLOWING_OBSIDIAN), "Glowing Obsidian", new Info(BreakInfo::pickaxe(10.0, ToolTier::DIAMOND, 50.0))));
|
||||
self::register("glowstone", new Glowstone(new BID(Ids::GLOWSTONE), "Glowstone", new Info(BreakInfo::pickaxe(0.3))));
|
||||
self::register("glow_lichen", new GlowLichen(new BID(Ids::GLOW_LICHEN), "Glow Lichen", new Info(BreakInfo::axe(0.2, null, 0.2))));
|
||||
self::register("gold", new Opaque(new BID(Ids::GOLD), "Gold Block", new Info(BreakInfo::pickaxe(3.0, ToolTier::IRON(), 30.0))));
|
||||
self::register("gold", new Opaque(new BID(Ids::GOLD), "Gold Block", new Info(BreakInfo::pickaxe(3.0, ToolTier::IRON, 30.0))));
|
||||
|
||||
$grassBreakInfo = BreakInfo::shovel(0.6);
|
||||
self::register("grass", new Grass(new BID(Ids::GRASS), "Grass", new Info($grassBreakInfo, [Tags::DIRT])));
|
||||
self::register("grass_path", new GrassPath(new BID(Ids::GRASS_PATH), "Grass Path", new Info($grassBreakInfo)));
|
||||
self::register("gravel", new Gravel(new BID(Ids::GRAVEL), "Gravel", new Info(BreakInfo::shovel(0.6))));
|
||||
|
||||
$hardenedClayBreakInfo = new Info(BreakInfo::pickaxe(1.25, ToolTier::WOOD(), 21.0));
|
||||
$hardenedClayBreakInfo = new Info(BreakInfo::pickaxe(1.25, ToolTier::WOOD, 21.0));
|
||||
self::register("hardened_clay", new HardenedClay(new BID(Ids::HARDENED_CLAY), "Hardened Clay", $hardenedClayBreakInfo));
|
||||
|
||||
$hardenedGlassBreakInfo = new Info(new BreakInfo(10.0));
|
||||
self::register("hardened_glass", new HardenedGlass(new BID(Ids::HARDENED_GLASS), "Hardened Glass", $hardenedGlassBreakInfo));
|
||||
self::register("hardened_glass_pane", new HardenedGlassPane(new BID(Ids::HARDENED_GLASS_PANE), "Hardened Glass Pane", $hardenedGlassBreakInfo));
|
||||
self::register("hay_bale", new HayBale(new BID(Ids::HAY_BALE), "Hay Bale", new Info(new BreakInfo(0.5))));
|
||||
self::register("hopper", new Hopper(new BID(Ids::HOPPER, TileHopper::class), "Hopper", new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD(), 15.0))));
|
||||
self::register("hopper", new Hopper(new BID(Ids::HOPPER, TileHopper::class), "Hopper", new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD, 15.0))));
|
||||
self::register("ice", new Ice(new BID(Ids::ICE), "Ice", new Info(BreakInfo::pickaxe(0.5))));
|
||||
|
||||
$updateBlockBreakInfo = new Info(new BreakInfo(1.0));
|
||||
@ -909,10 +909,10 @@ final class VanillaBlocks{
|
||||
self::register("info_update2", new Opaque(new BID(Ids::INFO_UPDATE2), "ate!upd", $updateBlockBreakInfo));
|
||||
self::register("invisible_bedrock", new Transparent(new BID(Ids::INVISIBLE_BEDROCK), "Invisible Bedrock", new Info(BreakInfo::indestructible())));
|
||||
|
||||
$ironBreakInfo = new Info(BreakInfo::pickaxe(5.0, ToolTier::STONE(), 30.0));
|
||||
$ironBreakInfo = new Info(BreakInfo::pickaxe(5.0, ToolTier::STONE, 30.0));
|
||||
self::register("iron", new Opaque(new BID(Ids::IRON), "Iron Block", $ironBreakInfo));
|
||||
self::register("iron_bars", new Thin(new BID(Ids::IRON_BARS), "Iron Bars", $ironBreakInfo));
|
||||
$ironDoorBreakInfo = new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD(), 25.0));
|
||||
$ironDoorBreakInfo = new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD, 25.0));
|
||||
self::register("iron_door", new Door(new BID(Ids::IRON_DOOR), "Iron Door", $ironDoorBreakInfo));
|
||||
self::register("iron_trapdoor", new Trapdoor(new BID(Ids::IRON_TRAPDOOR), "Iron Trapdoor", $ironDoorBreakInfo));
|
||||
|
||||
@ -923,21 +923,21 @@ final class VanillaBlocks{
|
||||
self::register("jukebox", new Jukebox(new BID(Ids::JUKEBOX, TileJukebox::class), "Jukebox", new Info(BreakInfo::axe(0.8)))); //TODO: in PC the hardness is 2.0, not 0.8, unsure if this is a MCPE bug or not
|
||||
self::register("ladder", new Ladder(new BID(Ids::LADDER), "Ladder", new Info(BreakInfo::axe(0.4))));
|
||||
|
||||
$lanternBreakInfo = new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD()));
|
||||
$lanternBreakInfo = new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD));
|
||||
self::register("lantern", new Lantern(new BID(Ids::LANTERN), "Lantern", $lanternBreakInfo, 15));
|
||||
self::register("soul_lantern", new Lantern(new BID(Ids::SOUL_LANTERN), "Soul Lantern", $lanternBreakInfo, 10));
|
||||
|
||||
self::register("lapis_lazuli", new Opaque(new BID(Ids::LAPIS_LAZULI), "Lapis Lazuli Block", new Info(BreakInfo::pickaxe(3.0, ToolTier::STONE()))));
|
||||
self::register("lapis_lazuli", new Opaque(new BID(Ids::LAPIS_LAZULI), "Lapis Lazuli Block", new Info(BreakInfo::pickaxe(3.0, ToolTier::STONE))));
|
||||
self::register("lava", new Lava(new BID(Ids::LAVA), "Lava", new Info(BreakInfo::indestructible(500.0))));
|
||||
self::register("lectern", new Lectern(new BID(Ids::LECTERN, TileLectern::class), "Lectern", new Info(BreakInfo::axe(2.0))));
|
||||
self::register("lever", new Lever(new BID(Ids::LEVER), "Lever", new Info(new BreakInfo(0.5))));
|
||||
self::register("magma", new Magma(new BID(Ids::MAGMA), "Magma Block", new Info(BreakInfo::pickaxe(0.5, ToolTier::WOOD()))));
|
||||
self::register("magma", new Magma(new BID(Ids::MAGMA), "Magma Block", new Info(BreakInfo::pickaxe(0.5, ToolTier::WOOD))));
|
||||
self::register("melon", new Melon(new BID(Ids::MELON), "Melon Block", new Info(BreakInfo::axe(1.0))));
|
||||
self::register("melon_stem", new MelonStem(new BID(Ids::MELON_STEM), "Melon Stem", new Info(BreakInfo::instant())));
|
||||
self::register("monster_spawner", new MonsterSpawner(new BID(Ids::MONSTER_SPAWNER, TileMonsterSpawner::class), "Monster Spawner", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD()))));
|
||||
self::register("monster_spawner", new MonsterSpawner(new BID(Ids::MONSTER_SPAWNER, TileMonsterSpawner::class), "Monster Spawner", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD))));
|
||||
self::register("mycelium", new Mycelium(new BID(Ids::MYCELIUM), "Mycelium", new Info(BreakInfo::shovel(0.6), [Tags::DIRT])));
|
||||
|
||||
$netherBrickBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD(), 30.0));
|
||||
$netherBrickBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD, 30.0));
|
||||
self::register("nether_bricks", new Opaque(new BID(Ids::NETHER_BRICKS), "Nether Bricks", $netherBrickBreakInfo));
|
||||
self::register("red_nether_bricks", new Opaque(new BID(Ids::RED_NETHER_BRICKS), "Red Nether Bricks", $netherBrickBreakInfo));
|
||||
self::register("nether_brick_fence", new Fence(new BID(Ids::NETHER_BRICK_FENCE), "Nether Brick Fence", $netherBrickBreakInfo));
|
||||
@ -947,18 +947,18 @@ final class VanillaBlocks{
|
||||
self::register("cracked_nether_bricks", new Opaque(new BID(Ids::CRACKED_NETHER_BRICKS), "Cracked Nether Bricks", $netherBrickBreakInfo));
|
||||
|
||||
self::register("nether_portal", new NetherPortal(new BID(Ids::NETHER_PORTAL), "Nether Portal", new Info(BreakInfo::indestructible(0.0))));
|
||||
self::register("nether_reactor_core", new NetherReactor(new BID(Ids::NETHER_REACTOR_CORE), "Nether Reactor Core", new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD()))));
|
||||
self::register("nether_reactor_core", new NetherReactor(new BID(Ids::NETHER_REACTOR_CORE), "Nether Reactor Core", new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD))));
|
||||
self::register("nether_wart_block", new Opaque(new BID(Ids::NETHER_WART_BLOCK), "Nether Wart Block", new Info(new BreakInfo(1.0, ToolType::HOE))));
|
||||
self::register("nether_wart", new NetherWartPlant(new BID(Ids::NETHER_WART), "Nether Wart", new Info(BreakInfo::instant())));
|
||||
self::register("netherrack", new Netherrack(new BID(Ids::NETHERRACK), "Netherrack", new Info(BreakInfo::pickaxe(0.4, ToolTier::WOOD()))));
|
||||
self::register("netherrack", new Netherrack(new BID(Ids::NETHERRACK), "Netherrack", new Info(BreakInfo::pickaxe(0.4, ToolTier::WOOD))));
|
||||
self::register("note_block", new Note(new BID(Ids::NOTE_BLOCK, TileNote::class), "Note Block", new Info(BreakInfo::axe(0.8))));
|
||||
self::register("obsidian", new Opaque(new BID(Ids::OBSIDIAN), "Obsidian", new Info(BreakInfo::pickaxe(35.0 /* 50 in PC */, ToolTier::DIAMOND(), 6000.0))));
|
||||
self::register("obsidian", new Opaque(new BID(Ids::OBSIDIAN), "Obsidian", new Info(BreakInfo::pickaxe(35.0 /* 50 in PC */, ToolTier::DIAMOND, 6000.0))));
|
||||
self::register("packed_ice", new PackedIce(new BID(Ids::PACKED_ICE), "Packed Ice", new Info(BreakInfo::pickaxe(0.5))));
|
||||
self::register("podzol", new Podzol(new BID(Ids::PODZOL), "Podzol", new Info(BreakInfo::shovel(0.5), [Tags::DIRT])));
|
||||
self::register("potatoes", new Potato(new BID(Ids::POTATOES), "Potato Block", new Info(BreakInfo::instant())));
|
||||
self::register("powered_rail", new PoweredRail(new BID(Ids::POWERED_RAIL), "Powered Rail", $railBreakInfo));
|
||||
|
||||
$prismarineBreakInfo = new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD(), 30.0));
|
||||
$prismarineBreakInfo = new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD, 30.0));
|
||||
self::register("prismarine", new Opaque(new BID(Ids::PRISMARINE), "Prismarine", $prismarineBreakInfo));
|
||||
self::register("dark_prismarine", new Opaque(new BID(Ids::DARK_PRISMARINE), "Dark Prismarine", $prismarineBreakInfo));
|
||||
self::register("prismarine_bricks", new Opaque(new BID(Ids::PRISMARINE_BRICKS), "Prismarine Bricks", $prismarineBreakInfo));
|
||||
@ -973,12 +973,12 @@ final class VanillaBlocks{
|
||||
|
||||
self::register("pumpkin_stem", new PumpkinStem(new BID(Ids::PUMPKIN_STEM), "Pumpkin Stem", new Info(BreakInfo::instant())));
|
||||
|
||||
$purpurBreakInfo = new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD(), 30.0));
|
||||
$purpurBreakInfo = new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD, 30.0));
|
||||
self::register("purpur", new Opaque(new BID(Ids::PURPUR), "Purpur Block", $purpurBreakInfo));
|
||||
self::register("purpur_pillar", new SimplePillar(new BID(Ids::PURPUR_PILLAR), "Purpur Pillar", $purpurBreakInfo));
|
||||
self::register("purpur_stairs", new Stair(new BID(Ids::PURPUR_STAIRS), "Purpur Stairs", $purpurBreakInfo));
|
||||
|
||||
$quartzBreakInfo = new Info(BreakInfo::pickaxe(0.8, ToolTier::WOOD()));
|
||||
$quartzBreakInfo = new Info(BreakInfo::pickaxe(0.8, ToolTier::WOOD));
|
||||
self::register("quartz", new Opaque(new BID(Ids::QUARTZ), "Quartz Block", $quartzBreakInfo));
|
||||
self::register("chiseled_quartz", new SimplePillar(new BID(Ids::CHISELED_QUARTZ), "Chiseled Quartz Block", $quartzBreakInfo));
|
||||
self::register("quartz_pillar", new SimplePillar(new BID(Ids::QUARTZ_PILLAR), "Quartz Pillar", $quartzBreakInfo));
|
||||
@ -990,7 +990,7 @@ final class VanillaBlocks{
|
||||
|
||||
self::register("rail", new Rail(new BID(Ids::RAIL), "Rail", $railBreakInfo));
|
||||
self::register("red_mushroom", new RedMushroom(new BID(Ids::RED_MUSHROOM), "Red Mushroom", new Info(BreakInfo::instant(), [Tags::POTTABLE_PLANTS])));
|
||||
self::register("redstone", new Redstone(new BID(Ids::REDSTONE), "Redstone Block", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD(), 30.0))));
|
||||
self::register("redstone", new Redstone(new BID(Ids::REDSTONE), "Redstone Block", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD, 30.0))));
|
||||
self::register("redstone_comparator", new RedstoneComparator(new BID(Ids::REDSTONE_COMPARATOR, TileComparator::class), "Redstone Comparator", new Info(BreakInfo::instant())));
|
||||
self::register("redstone_lamp", new RedstoneLamp(new BID(Ids::REDSTONE_LAMP), "Redstone Lamp", new Info(new BreakInfo(0.3))));
|
||||
self::register("redstone_repeater", new RedstoneRepeater(new BID(Ids::REDSTONE_REPEATER), "Redstone Repeater", new Info(BreakInfo::instant())));
|
||||
@ -1006,14 +1006,14 @@ final class VanillaBlocks{
|
||||
self::register("sea_pickle", new SeaPickle(new BID(Ids::SEA_PICKLE), "Sea Pickle", new Info(BreakInfo::instant())));
|
||||
self::register("mob_head", new MobHead(new BID(Ids::MOB_HEAD, TileMobHead::class), "Mob Head", new Info(new BreakInfo(1.0), enchantmentTags: [EnchantmentTags::MASK])));
|
||||
self::register("slime", new Slime(new BID(Ids::SLIME), "Slime Block", new Info(BreakInfo::instant())));
|
||||
self::register("snow", new Snow(new BID(Ids::SNOW), "Snow Block", new Info(BreakInfo::shovel(0.2, ToolTier::WOOD()))));
|
||||
self::register("snow_layer", new SnowLayer(new BID(Ids::SNOW_LAYER), "Snow Layer", new Info(BreakInfo::shovel(0.1, ToolTier::WOOD()))));
|
||||
self::register("snow", new Snow(new BID(Ids::SNOW), "Snow Block", new Info(BreakInfo::shovel(0.2, ToolTier::WOOD))));
|
||||
self::register("snow_layer", new SnowLayer(new BID(Ids::SNOW_LAYER), "Snow Layer", new Info(BreakInfo::shovel(0.1, ToolTier::WOOD))));
|
||||
self::register("soul_sand", new SoulSand(new BID(Ids::SOUL_SAND), "Soul Sand", new Info(BreakInfo::shovel(0.5))));
|
||||
self::register("sponge", new Sponge(new BID(Ids::SPONGE), "Sponge", new Info(new BreakInfo(0.6, ToolType::HOE))));
|
||||
$shulkerBoxBreakInfo = new Info(BreakInfo::pickaxe(2));
|
||||
self::register("shulker_box", new ShulkerBox(new BID(Ids::SHULKER_BOX, TileShulkerBox::class), "Shulker Box", $shulkerBoxBreakInfo));
|
||||
|
||||
$stoneBreakInfo = new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD(), 30.0));
|
||||
$stoneBreakInfo = new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD, 30.0));
|
||||
self::register(
|
||||
"stone",
|
||||
$stone = new class(new BID(Ids::STONE), "Stone", $stoneBreakInfo) extends Opaque{
|
||||
@ -1058,10 +1058,10 @@ final class VanillaBlocks{
|
||||
self::register("mossy_stone_brick_stairs", new Stair(new BID(Ids::MOSSY_STONE_BRICK_STAIRS), "Mossy Stone Brick Stairs", $stoneBreakInfo));
|
||||
self::register("stone_button", new StoneButton(new BID(Ids::STONE_BUTTON), "Stone Button", new Info(BreakInfo::pickaxe(0.5))));
|
||||
self::register("stonecutter", new Stonecutter(new BID(Ids::STONECUTTER), "Stonecutter", new Info(BreakInfo::pickaxe(3.5))));
|
||||
self::register("stone_pressure_plate", new StonePressurePlate(new BID(Ids::STONE_PRESSURE_PLATE), "Stone Pressure Plate", new Info(BreakInfo::pickaxe(0.5, ToolTier::WOOD()))));
|
||||
self::register("stone_pressure_plate", new StonePressurePlate(new BID(Ids::STONE_PRESSURE_PLATE), "Stone Pressure Plate", new Info(BreakInfo::pickaxe(0.5, ToolTier::WOOD))));
|
||||
|
||||
//TODO: in the future this won't be the same for all the types
|
||||
$stoneSlabBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD(), 30.0));
|
||||
$stoneSlabBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD, 30.0));
|
||||
|
||||
self::register("brick_slab", new Slab(new BID(Ids::BRICK_SLAB), "Brick", $stoneSlabBreakInfo));
|
||||
self::register("cobblestone_slab", new Slab(new BID(Ids::COBBLESTONE_SLAB), "Cobblestone", $stoneSlabBreakInfo));
|
||||
@ -1093,7 +1093,7 @@ final class VanillaBlocks{
|
||||
self::register("smooth_quartz_slab", new Slab(new BID(Ids::SMOOTH_QUARTZ_SLAB), "Smooth Quartz", $stoneSlabBreakInfo));
|
||||
self::register("stone_slab", new Slab(new BID(Ids::STONE_SLAB), "Stone", $stoneSlabBreakInfo));
|
||||
|
||||
self::register("legacy_stonecutter", new Opaque(new BID(Ids::LEGACY_STONECUTTER), "Legacy Stonecutter", new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD()))));
|
||||
self::register("legacy_stonecutter", new Opaque(new BID(Ids::LEGACY_STONECUTTER), "Legacy Stonecutter", new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD))));
|
||||
self::register("sugarcane", new Sugarcane(new BID(Ids::SUGARCANE), "Sugarcane", new Info(BreakInfo::instant())));
|
||||
self::register("sweet_berry_bush", new SweetBerryBush(new BID(Ids::SWEET_BERRY_BUSH), "Sweet Berry Bush", new Info(BreakInfo::instant())));
|
||||
self::register("tnt", new TNT(new BID(Ids::TNT), "TNT", new Info(BreakInfo::instant())));
|
||||
@ -1114,7 +1114,7 @@ final class VanillaBlocks{
|
||||
self::register("water", new Water(new BID(Ids::WATER), "Water", new Info(BreakInfo::indestructible(500.0))));
|
||||
self::register("lily_pad", new WaterLily(new BID(Ids::LILY_PAD), "Lily Pad", new Info(BreakInfo::instant())));
|
||||
|
||||
$weightedPressurePlateBreakInfo = new Info(BreakInfo::pickaxe(0.5, ToolTier::WOOD()));
|
||||
$weightedPressurePlateBreakInfo = new Info(BreakInfo::pickaxe(0.5, ToolTier::WOOD));
|
||||
self::register("weighted_pressure_plate_heavy", new WeightedPressurePlateHeavy(
|
||||
new BID(Ids::WEIGHTED_PRESSURE_PLATE_HEAVY),
|
||||
"Weighted Pressure Plate Heavy",
|
||||
@ -1150,7 +1150,7 @@ final class VanillaBlocks{
|
||||
self::register(strtolower($leavesType->name) . "_leaves", new Leaves(WoodLikeBlockIdHelper::getLeavesIdentifier($leavesType), $name . " Leaves", $leavesBreakInfo, $leavesType));
|
||||
}
|
||||
|
||||
$sandstoneBreakInfo = new Info(BreakInfo::pickaxe(0.8, ToolTier::WOOD()));
|
||||
$sandstoneBreakInfo = new Info(BreakInfo::pickaxe(0.8, ToolTier::WOOD));
|
||||
self::register("red_sandstone_stairs", new Stair(new BID(Ids::RED_SANDSTONE_STAIRS), "Red Sandstone Stairs", $sandstoneBreakInfo));
|
||||
self::register("smooth_red_sandstone_stairs", new Stair(new BID(Ids::SMOOTH_RED_SANDSTONE_STAIRS), "Smooth Red Sandstone Stairs", $sandstoneBreakInfo));
|
||||
self::register("red_sandstone", new Opaque(new BID(Ids::RED_SANDSTONE), "Red Sandstone", $sandstoneBreakInfo));
|
||||
@ -1165,7 +1165,7 @@ final class VanillaBlocks{
|
||||
self::register("cut_sandstone", new Opaque(new BID(Ids::CUT_SANDSTONE), "Cut Sandstone", $sandstoneBreakInfo));
|
||||
self::register("smooth_sandstone", new Opaque(new BID(Ids::SMOOTH_SANDSTONE), "Smooth Sandstone", $sandstoneBreakInfo));
|
||||
|
||||
self::register("glazed_terracotta", new GlazedTerracotta(new BID(Ids::GLAZED_TERRACOTTA), "Glazed Terracotta", new Info(BreakInfo::pickaxe(1.4, ToolTier::WOOD()))));
|
||||
self::register("glazed_terracotta", new GlazedTerracotta(new BID(Ids::GLAZED_TERRACOTTA), "Glazed Terracotta", new Info(BreakInfo::pickaxe(1.4, ToolTier::WOOD))));
|
||||
self::register("dyed_shulker_box", new DyedShulkerBox(new BID(Ids::DYED_SHULKER_BOX, TileShulkerBox::class), "Dyed Shulker Box", $shulkerBoxBreakInfo));
|
||||
self::register("stained_glass", new StainedGlass(new BID(Ids::STAINED_GLASS), "Stained Glass", $glassBreakInfo));
|
||||
self::register("stained_glass_pane", new StainedGlassPane(new BID(Ids::STAINED_GLASS_PANE), "Stained Glass Pane", $glassBreakInfo));
|
||||
@ -1173,7 +1173,7 @@ final class VanillaBlocks{
|
||||
self::register("stained_hardened_glass", new StainedHardenedGlass(new BID(Ids::STAINED_HARDENED_GLASS), "Stained Hardened Glass", $hardenedGlassBreakInfo));
|
||||
self::register("stained_hardened_glass_pane", new StainedHardenedGlassPane(new BID(Ids::STAINED_HARDENED_GLASS_PANE), "Stained Hardened Glass Pane", $hardenedGlassBreakInfo));
|
||||
self::register("carpet", new Carpet(new BID(Ids::CARPET), "Carpet", new Info(new BreakInfo(0.1))));
|
||||
self::register("concrete", new Concrete(new BID(Ids::CONCRETE), "Concrete", new Info(BreakInfo::pickaxe(1.8, ToolTier::WOOD()))));
|
||||
self::register("concrete", new Concrete(new BID(Ids::CONCRETE), "Concrete", new Info(BreakInfo::pickaxe(1.8, ToolTier::WOOD))));
|
||||
self::register("concrete_powder", new ConcretePowder(new BID(Ids::CONCRETE_POWDER), "Concrete Powder", new Info(BreakInfo::shovel(0.5))));
|
||||
self::register("wool", new Wool(new BID(Ids::WOOL), "Wool", new Info(new class(0.8, ToolType::SHEARS) extends BreakInfo{
|
||||
public function getBreakTime(Item $item) : float{
|
||||
@ -1187,7 +1187,7 @@ final class VanillaBlocks{
|
||||
})));
|
||||
|
||||
//TODO: in the future these won't all have the same hardness; they only do now because of the old metadata crap
|
||||
$wallBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD(), 30.0));
|
||||
$wallBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD, 30.0));
|
||||
self::register("cobblestone_wall", new Wall(new BID(Ids::COBBLESTONE_WALL), "Cobblestone Wall", $wallBreakInfo));
|
||||
self::register("andesite_wall", new Wall(new BID(Ids::ANDESITE_WALL), "Andesite Wall", $wallBreakInfo));
|
||||
self::register("brick_wall", new Wall(new BID(Ids::BRICK_WALL), "Brick Wall", $wallBreakInfo));
|
||||
@ -1205,7 +1205,7 @@ final class VanillaBlocks{
|
||||
|
||||
self::registerElements();
|
||||
|
||||
$chemistryTableBreakInfo = new Info(BreakInfo::pickaxe(2.5, ToolTier::WOOD()));
|
||||
$chemistryTableBreakInfo = new Info(BreakInfo::pickaxe(2.5, ToolTier::WOOD));
|
||||
self::register("compound_creator", new ChemistryTable(new BID(Ids::COMPOUND_CREATOR), "Compound Creator", $chemistryTableBreakInfo));
|
||||
self::register("element_constructor", new ChemistryTable(new BID(Ids::ELEMENT_CONSTRUCTOR), "Element Constructor", $chemistryTableBreakInfo));
|
||||
self::register("lab_table", new ChemistryTable(new BID(Ids::LAB_TABLE), "Lab Table", $chemistryTableBreakInfo));
|
||||
@ -1428,26 +1428,26 @@ final class VanillaBlocks{
|
||||
|
||||
private static function registerOres() : void{
|
||||
$stoneOreBreakInfo = fn(ToolTier $toolTier) => new Info(BreakInfo::pickaxe(3.0, $toolTier));
|
||||
self::register("coal_ore", new CoalOre(new BID(Ids::COAL_ORE), "Coal Ore", $stoneOreBreakInfo(ToolTier::WOOD())));
|
||||
self::register("copper_ore", new CopperOre(new BID(Ids::COPPER_ORE), "Copper Ore", $stoneOreBreakInfo(ToolTier::STONE())));
|
||||
self::register("diamond_ore", new DiamondOre(new BID(Ids::DIAMOND_ORE), "Diamond Ore", $stoneOreBreakInfo(ToolTier::IRON())));
|
||||
self::register("emerald_ore", new EmeraldOre(new BID(Ids::EMERALD_ORE), "Emerald Ore", $stoneOreBreakInfo(ToolTier::IRON())));
|
||||
self::register("gold_ore", new GoldOre(new BID(Ids::GOLD_ORE), "Gold Ore", $stoneOreBreakInfo(ToolTier::IRON())));
|
||||
self::register("iron_ore", new IronOre(new BID(Ids::IRON_ORE), "Iron Ore", $stoneOreBreakInfo(ToolTier::STONE())));
|
||||
self::register("lapis_lazuli_ore", new LapisOre(new BID(Ids::LAPIS_LAZULI_ORE), "Lapis Lazuli Ore", $stoneOreBreakInfo(ToolTier::STONE())));
|
||||
self::register("redstone_ore", new RedstoneOre(new BID(Ids::REDSTONE_ORE), "Redstone Ore", $stoneOreBreakInfo(ToolTier::IRON())));
|
||||
self::register("coal_ore", new CoalOre(new BID(Ids::COAL_ORE), "Coal Ore", $stoneOreBreakInfo(ToolTier::WOOD)));
|
||||
self::register("copper_ore", new CopperOre(new BID(Ids::COPPER_ORE), "Copper Ore", $stoneOreBreakInfo(ToolTier::STONE)));
|
||||
self::register("diamond_ore", new DiamondOre(new BID(Ids::DIAMOND_ORE), "Diamond Ore", $stoneOreBreakInfo(ToolTier::IRON)));
|
||||
self::register("emerald_ore", new EmeraldOre(new BID(Ids::EMERALD_ORE), "Emerald Ore", $stoneOreBreakInfo(ToolTier::IRON)));
|
||||
self::register("gold_ore", new GoldOre(new BID(Ids::GOLD_ORE), "Gold Ore", $stoneOreBreakInfo(ToolTier::IRON)));
|
||||
self::register("iron_ore", new IronOre(new BID(Ids::IRON_ORE), "Iron Ore", $stoneOreBreakInfo(ToolTier::STONE)));
|
||||
self::register("lapis_lazuli_ore", new LapisOre(new BID(Ids::LAPIS_LAZULI_ORE), "Lapis Lazuli Ore", $stoneOreBreakInfo(ToolTier::STONE)));
|
||||
self::register("redstone_ore", new RedstoneOre(new BID(Ids::REDSTONE_ORE), "Redstone Ore", $stoneOreBreakInfo(ToolTier::IRON)));
|
||||
|
||||
$deepslateOreBreakInfo = fn(ToolTier $toolTier) => new Info(BreakInfo::pickaxe(4.5, $toolTier));
|
||||
self::register("deepslate_coal_ore", new CoalOre(new BID(Ids::DEEPSLATE_COAL_ORE), "Deepslate Coal Ore", $deepslateOreBreakInfo(ToolTier::WOOD())));
|
||||
self::register("deepslate_copper_ore", new CopperOre(new BID(Ids::DEEPSLATE_COPPER_ORE), "Deepslate Copper Ore", $deepslateOreBreakInfo(ToolTier::STONE())));
|
||||
self::register("deepslate_diamond_ore", new DiamondOre(new BID(Ids::DEEPSLATE_DIAMOND_ORE), "Deepslate Diamond Ore", $deepslateOreBreakInfo(ToolTier::IRON())));
|
||||
self::register("deepslate_emerald_ore", new EmeraldOre(new BID(Ids::DEEPSLATE_EMERALD_ORE), "Deepslate Emerald Ore", $deepslateOreBreakInfo(ToolTier::IRON())));
|
||||
self::register("deepslate_gold_ore", new GoldOre(new BID(Ids::DEEPSLATE_GOLD_ORE), "Deepslate Gold Ore", $deepslateOreBreakInfo(ToolTier::IRON())));
|
||||
self::register("deepslate_iron_ore", new IronOre(new BID(Ids::DEEPSLATE_IRON_ORE), "Deepslate Iron Ore", $deepslateOreBreakInfo(ToolTier::STONE())));
|
||||
self::register("deepslate_lapis_lazuli_ore", new LapisOre(new BID(Ids::DEEPSLATE_LAPIS_LAZULI_ORE), "Deepslate Lapis Lazuli Ore", $deepslateOreBreakInfo(ToolTier::STONE())));
|
||||
self::register("deepslate_redstone_ore", new RedstoneOre(new BID(Ids::DEEPSLATE_REDSTONE_ORE), "Deepslate Redstone Ore", $deepslateOreBreakInfo(ToolTier::IRON())));
|
||||
self::register("deepslate_coal_ore", new CoalOre(new BID(Ids::DEEPSLATE_COAL_ORE), "Deepslate Coal Ore", $deepslateOreBreakInfo(ToolTier::WOOD)));
|
||||
self::register("deepslate_copper_ore", new CopperOre(new BID(Ids::DEEPSLATE_COPPER_ORE), "Deepslate Copper Ore", $deepslateOreBreakInfo(ToolTier::STONE)));
|
||||
self::register("deepslate_diamond_ore", new DiamondOre(new BID(Ids::DEEPSLATE_DIAMOND_ORE), "Deepslate Diamond Ore", $deepslateOreBreakInfo(ToolTier::IRON)));
|
||||
self::register("deepslate_emerald_ore", new EmeraldOre(new BID(Ids::DEEPSLATE_EMERALD_ORE), "Deepslate Emerald Ore", $deepslateOreBreakInfo(ToolTier::IRON)));
|
||||
self::register("deepslate_gold_ore", new GoldOre(new BID(Ids::DEEPSLATE_GOLD_ORE), "Deepslate Gold Ore", $deepslateOreBreakInfo(ToolTier::IRON)));
|
||||
self::register("deepslate_iron_ore", new IronOre(new BID(Ids::DEEPSLATE_IRON_ORE), "Deepslate Iron Ore", $deepslateOreBreakInfo(ToolTier::STONE)));
|
||||
self::register("deepslate_lapis_lazuli_ore", new LapisOre(new BID(Ids::DEEPSLATE_LAPIS_LAZULI_ORE), "Deepslate Lapis Lazuli Ore", $deepslateOreBreakInfo(ToolTier::STONE)));
|
||||
self::register("deepslate_redstone_ore", new RedstoneOre(new BID(Ids::DEEPSLATE_REDSTONE_ORE), "Deepslate Redstone Ore", $deepslateOreBreakInfo(ToolTier::IRON)));
|
||||
|
||||
$netherrackOreBreakInfo = new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD()));
|
||||
$netherrackOreBreakInfo = new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD));
|
||||
self::register("nether_quartz_ore", new NetherQuartzOre(new BID(Ids::NETHER_QUARTZ_ORE), "Nether Quartz Ore", $netherrackOreBreakInfo));
|
||||
self::register("nether_gold_ore", new NetherGoldOre(new BID(Ids::NETHER_GOLD_ORE), "Nether Gold Ore", $netherrackOreBreakInfo));
|
||||
}
|
||||
@ -1479,20 +1479,20 @@ final class VanillaBlocks{
|
||||
|
||||
private static function registerBlocksR16() : void{
|
||||
//for some reason, slabs have weird hardness like the legacy ones
|
||||
$slabBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD(), 30.0));
|
||||
$slabBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD, 30.0));
|
||||
|
||||
self::register("ancient_debris", new Opaque(new BID(Ids::ANCIENT_DEBRIS), "Ancient Debris", new Info(BreakInfo::pickaxe(30, ToolTier::DIAMOND(), 3600.0))));
|
||||
$netheriteBreakInfo = new Info(BreakInfo::pickaxe(50, ToolTier::DIAMOND(), 3600.0));
|
||||
self::register("ancient_debris", new Opaque(new BID(Ids::ANCIENT_DEBRIS), "Ancient Debris", new Info(BreakInfo::pickaxe(30, ToolTier::DIAMOND, 3600.0))));
|
||||
$netheriteBreakInfo = new Info(BreakInfo::pickaxe(50, ToolTier::DIAMOND, 3600.0));
|
||||
self::register("netherite", new class(new BID(Ids::NETHERITE), "Netherite Block", $netheriteBreakInfo) extends Opaque{
|
||||
public function isFireProofAsItem() : bool{ return true; }
|
||||
});
|
||||
|
||||
$basaltBreakInfo = new Info(BreakInfo::pickaxe(1.25, ToolTier::WOOD(), 21.0));
|
||||
$basaltBreakInfo = new Info(BreakInfo::pickaxe(1.25, ToolTier::WOOD, 21.0));
|
||||
self::register("basalt", new SimplePillar(new BID(Ids::BASALT), "Basalt", $basaltBreakInfo));
|
||||
self::register("polished_basalt", new SimplePillar(new BID(Ids::POLISHED_BASALT), "Polished Basalt", $basaltBreakInfo));
|
||||
self::register("smooth_basalt", new Opaque(new BID(Ids::SMOOTH_BASALT), "Smooth Basalt", $basaltBreakInfo));
|
||||
|
||||
$blackstoneBreakInfo = new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD(), 30.0));
|
||||
$blackstoneBreakInfo = new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD, 30.0));
|
||||
self::register("blackstone", new Opaque(new BID(Ids::BLACKSTONE), "Blackstone", $blackstoneBreakInfo));
|
||||
self::register("blackstone_slab", new Slab(new BID(Ids::BLACKSTONE_SLAB), "Blackstone", $slabBreakInfo));
|
||||
self::register("blackstone_stairs", new Stair(new BID(Ids::BLACKSTONE_STAIRS), "Blackstone Stairs", $blackstoneBreakInfo));
|
||||
@ -1504,7 +1504,7 @@ final class VanillaBlocks{
|
||||
$prefix = fn(string $thing) => "Polished Blackstone" . ($thing !== "" ? " $thing" : "");
|
||||
self::register("polished_blackstone", new Opaque(new BID(Ids::POLISHED_BLACKSTONE), $prefix(""), $blackstoneBreakInfo));
|
||||
self::register("polished_blackstone_button", new StoneButton(new BID(Ids::POLISHED_BLACKSTONE_BUTTON), $prefix("Button"), new Info(BreakInfo::pickaxe(0.5))));
|
||||
self::register("polished_blackstone_pressure_plate", new StonePressurePlate(new BID(Ids::POLISHED_BLACKSTONE_PRESSURE_PLATE), $prefix("Pressure Plate"), new Info(BreakInfo::pickaxe(0.5, ToolTier::WOOD())), 20));
|
||||
self::register("polished_blackstone_pressure_plate", new StonePressurePlate(new BID(Ids::POLISHED_BLACKSTONE_PRESSURE_PLATE), $prefix("Pressure Plate"), new Info(BreakInfo::pickaxe(0.5, ToolTier::WOOD)), 20));
|
||||
self::register("polished_blackstone_slab", new Slab(new BID(Ids::POLISHED_BLACKSTONE_SLAB), $prefix(""), $slabBreakInfo));
|
||||
self::register("polished_blackstone_stairs", new Stair(new BID(Ids::POLISHED_BLACKSTONE_STAIRS), $prefix("Stairs"), $blackstoneBreakInfo));
|
||||
self::register("polished_blackstone_wall", new Wall(new BID(Ids::POLISHED_BLACKSTONE_WALL), $prefix("Wall"), $blackstoneBreakInfo));
|
||||
@ -1528,33 +1528,33 @@ final class VanillaBlocks{
|
||||
});
|
||||
|
||||
self::register("warped_wart_block", new Opaque(new BID(Ids::WARPED_WART_BLOCK), "Warped Wart Block", new Info(new BreakInfo(1.0, ToolType::HOE))));
|
||||
self::register("crying_obsidian", new class(new BID(Ids::CRYING_OBSIDIAN), "Crying Obsidian", new Info(BreakInfo::pickaxe(35.0 /* 50 in Java */, ToolTier::DIAMOND(), 6000.0))) extends Opaque{
|
||||
self::register("crying_obsidian", new class(new BID(Ids::CRYING_OBSIDIAN), "Crying Obsidian", new Info(BreakInfo::pickaxe(35.0 /* 50 in Java */, ToolTier::DIAMOND, 6000.0))) extends Opaque{
|
||||
public function getLightLevel() : int{ return 10;}
|
||||
});
|
||||
|
||||
self::register("twisting_vines", new NetherVines(new BID(Ids::TWISTING_VINES), "Twisting Vines", new Info(BreakInfo::instant()), Facing::UP));
|
||||
self::register("weeping_vines", new NetherVines(new BID(Ids::WEEPING_VINES), "Weeping Vines", new Info(BreakInfo::instant()), Facing::DOWN));
|
||||
|
||||
self::register("chain", new Chain(new BID(Ids::CHAIN), "Chain", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD()))));
|
||||
self::register("chain", new Chain(new BID(Ids::CHAIN), "Chain", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD))));
|
||||
}
|
||||
|
||||
private static function registerBlocksR17() : void{
|
||||
//in java this can be acquired using any tool - seems to be a parity issue in bedrock
|
||||
self::register("amethyst", new class(new BID(Ids::AMETHYST), "Amethyst", new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD()))) extends Opaque{
|
||||
self::register("amethyst", new class(new BID(Ids::AMETHYST), "Amethyst", new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD))) extends Opaque{
|
||||
public function onProjectileHit(Projectile $projectile, RayTraceResult $hitResult) : void{
|
||||
$this->position->getWorld()->addSound($this->position, new AmethystBlockChimeSound());
|
||||
$this->position->getWorld()->addSound($this->position, new BlockPunchSound($this));
|
||||
}
|
||||
});
|
||||
|
||||
self::register("calcite", new Opaque(new BID(Ids::CALCITE), "Calcite", new Info(BreakInfo::pickaxe(0.75, ToolTier::WOOD()))));
|
||||
self::register("tuff", new Opaque(new BID(Ids::TUFF), "Tuff", new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD(), 30.0))));
|
||||
self::register("calcite", new Opaque(new BID(Ids::CALCITE), "Calcite", new Info(BreakInfo::pickaxe(0.75, ToolTier::WOOD))));
|
||||
self::register("tuff", new Opaque(new BID(Ids::TUFF), "Tuff", new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD, 30.0))));
|
||||
|
||||
self::register("raw_copper", new Opaque(new BID(Ids::RAW_COPPER), "Raw Copper Block", new Info(BreakInfo::pickaxe(5, ToolTier::STONE(), 30.0))));
|
||||
self::register("raw_gold", new Opaque(new BID(Ids::RAW_GOLD), "Raw Gold Block", new Info(BreakInfo::pickaxe(5, ToolTier::IRON(), 30.0))));
|
||||
self::register("raw_iron", new Opaque(new BID(Ids::RAW_IRON), "Raw Iron Block", new Info(BreakInfo::pickaxe(5, ToolTier::STONE(), 30.0))));
|
||||
self::register("raw_copper", new Opaque(new BID(Ids::RAW_COPPER), "Raw Copper Block", new Info(BreakInfo::pickaxe(5, ToolTier::STONE, 30.0))));
|
||||
self::register("raw_gold", new Opaque(new BID(Ids::RAW_GOLD), "Raw Gold Block", new Info(BreakInfo::pickaxe(5, ToolTier::IRON, 30.0))));
|
||||
self::register("raw_iron", new Opaque(new BID(Ids::RAW_IRON), "Raw Iron Block", new Info(BreakInfo::pickaxe(5, ToolTier::STONE, 30.0))));
|
||||
|
||||
$deepslateBreakInfo = new Info(BreakInfo::pickaxe(3, ToolTier::WOOD(), 18.0));
|
||||
$deepslateBreakInfo = new Info(BreakInfo::pickaxe(3, ToolTier::WOOD, 18.0));
|
||||
self::register("deepslate", new class(new BID(Ids::DEEPSLATE), "Deepslate", $deepslateBreakInfo) extends SimplePillar{
|
||||
public function getDropsForCompatibleTool(Item $item) : array{
|
||||
return [VanillaBlocks::COBBLED_DEEPSLATE()->asItem()];
|
||||
@ -1566,29 +1566,29 @@ final class VanillaBlocks{
|
||||
});
|
||||
|
||||
//TODO: parity issue here - in Java this has a hardness of 3.0, but in bedrock it's 3.5
|
||||
self::register("chiseled_deepslate", new Opaque(new BID(Ids::CHISELED_DEEPSLATE), "Chiseled Deepslate", new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD(), 18.0))));
|
||||
self::register("chiseled_deepslate", new Opaque(new BID(Ids::CHISELED_DEEPSLATE), "Chiseled Deepslate", new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD, 18.0))));
|
||||
|
||||
$deepslateBrickBreakInfo = new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD(), 18.0));
|
||||
$deepslateBrickBreakInfo = new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD, 18.0));
|
||||
self::register("deepslate_bricks", new Opaque(new BID(Ids::DEEPSLATE_BRICKS), "Deepslate Bricks", $deepslateBrickBreakInfo));
|
||||
self::register("deepslate_brick_slab", new Slab(new BID(Ids::DEEPSLATE_BRICK_SLAB), "Deepslate Brick", $deepslateBrickBreakInfo));
|
||||
self::register("deepslate_brick_stairs", new Stair(new BID(Ids::DEEPSLATE_BRICK_STAIRS), "Deepslate Brick Stairs", $deepslateBrickBreakInfo));
|
||||
self::register("deepslate_brick_wall", new Wall(new BID(Ids::DEEPSLATE_BRICK_WALL), "Deepslate Brick Wall", $deepslateBrickBreakInfo));
|
||||
self::register("cracked_deepslate_bricks", new Opaque(new BID(Ids::CRACKED_DEEPSLATE_BRICKS), "Cracked Deepslate Bricks", $deepslateBrickBreakInfo));
|
||||
|
||||
$deepslateTilesBreakInfo = new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD(), 18.0));
|
||||
$deepslateTilesBreakInfo = new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD, 18.0));
|
||||
self::register("deepslate_tiles", new Opaque(new BID(Ids::DEEPSLATE_TILES), "Deepslate Tiles", $deepslateTilesBreakInfo));
|
||||
self::register("deepslate_tile_slab", new Slab(new BID(Ids::DEEPSLATE_TILE_SLAB), "Deepslate Tile", $deepslateTilesBreakInfo));
|
||||
self::register("deepslate_tile_stairs", new Stair(new BID(Ids::DEEPSLATE_TILE_STAIRS), "Deepslate Tile Stairs", $deepslateTilesBreakInfo));
|
||||
self::register("deepslate_tile_wall", new Wall(new BID(Ids::DEEPSLATE_TILE_WALL), "Deepslate Tile Wall", $deepslateTilesBreakInfo));
|
||||
self::register("cracked_deepslate_tiles", new Opaque(new BID(Ids::CRACKED_DEEPSLATE_TILES), "Cracked Deepslate Tiles", $deepslateTilesBreakInfo));
|
||||
|
||||
$cobbledDeepslateBreakInfo = new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD(), 18.0));
|
||||
$cobbledDeepslateBreakInfo = new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD, 18.0));
|
||||
self::register("cobbled_deepslate", new Opaque(new BID(Ids::COBBLED_DEEPSLATE), "Cobbled Deepslate", $cobbledDeepslateBreakInfo));
|
||||
self::register("cobbled_deepslate_slab", new Slab(new BID(Ids::COBBLED_DEEPSLATE_SLAB), "Cobbled Deepslate", $cobbledDeepslateBreakInfo));
|
||||
self::register("cobbled_deepslate_stairs", new Stair(new BID(Ids::COBBLED_DEEPSLATE_STAIRS), "Cobbled Deepslate Stairs", $cobbledDeepslateBreakInfo));
|
||||
self::register("cobbled_deepslate_wall", new Wall(new BID(Ids::COBBLED_DEEPSLATE_WALL), "Cobbled Deepslate Wall", $cobbledDeepslateBreakInfo));
|
||||
|
||||
$polishedDeepslateBreakInfo = new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD(), 18.0));
|
||||
$polishedDeepslateBreakInfo = new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD, 18.0));
|
||||
self::register("polished_deepslate", new Opaque(new BID(Ids::POLISHED_DEEPSLATE), "Polished Deepslate", $polishedDeepslateBreakInfo));
|
||||
self::register("polished_deepslate_slab", new Slab(new BID(Ids::POLISHED_DEEPSLATE_SLAB), "Polished Deepslate", $polishedDeepslateBreakInfo));
|
||||
self::register("polished_deepslate_stairs", new Stair(new BID(Ids::POLISHED_DEEPSLATE_STAIRS), "Polished Deepslate Stairs", $polishedDeepslateBreakInfo));
|
||||
@ -1597,7 +1597,7 @@ final class VanillaBlocks{
|
||||
self::register("tinted_glass", new TintedGlass(new BID(Ids::TINTED_GLASS), "Tinted Glass", new Info(new BreakInfo(0.3))));
|
||||
|
||||
//blast resistance should be 30 if we were matched with java :(
|
||||
$copperBreakInfo = new Info(BreakInfo::pickaxe(3.0, ToolTier::STONE(), 18.0));
|
||||
$copperBreakInfo = new Info(BreakInfo::pickaxe(3.0, ToolTier::STONE, 18.0));
|
||||
self::register("lightning_rod", new LightningRod(new BID(Ids::LIGHTNING_ROD), "Lightning Rod", $copperBreakInfo));
|
||||
|
||||
self::register("copper", new Copper(new BID(Ids::COPPER), "Copper Block", $copperBreakInfo));
|
||||
@ -1631,7 +1631,7 @@ final class VanillaBlocks{
|
||||
self::register("mud", new Opaque(new BID(Ids::MUD), "Mud", new Info(BreakInfo::shovel(0.5), [Tags::MUD])));
|
||||
self::register("packed_mud", new Opaque(new BID(Ids::PACKED_MUD), "Packed Mud", new Info(BreakInfo::pickaxe(1.0, null, 15.0))));
|
||||
|
||||
$mudBricksBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD(), 30.0));
|
||||
$mudBricksBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD, 30.0));
|
||||
|
||||
self::register("mud_bricks", new Opaque(new BID(Ids::MUD_BRICKS), "Mud Bricks", $mudBricksBreakInfo));
|
||||
self::register("mud_brick_slab", new Slab(new BID(Ids::MUD_BRICK_SLAB), "Mud Brick", $mudBricksBreakInfo));
|
||||
@ -1640,7 +1640,7 @@ final class VanillaBlocks{
|
||||
}
|
||||
|
||||
private static function registerCauldronBlocks() : void{
|
||||
$cauldronBreakInfo = new Info(BreakInfo::pickaxe(2, ToolTier::WOOD()));
|
||||
$cauldronBreakInfo = new Info(BreakInfo::pickaxe(2, ToolTier::WOOD));
|
||||
|
||||
self::register("cauldron", new Cauldron(new BID(Ids::CAULDRON, TileCauldron::class), "Cauldron", $cauldronBreakInfo));
|
||||
self::register("water_cauldron", new WaterCauldron(new BID(Ids::WATER_CAULDRON, TileCauldron::class), "Water Cauldron", $cauldronBreakInfo));
|
||||
|
@ -110,10 +110,10 @@ final class WaterCauldron extends FillableCauldron{
|
||||
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null, array &$returnedItems = []) : bool{
|
||||
$world = $this->position->getWorld();
|
||||
if(($dyeColor = match($item->getTypeId()){
|
||||
ItemTypeIds::LAPIS_LAZULI => DyeColor::BLUE(),
|
||||
ItemTypeIds::INK_SAC => DyeColor::BLACK(),
|
||||
ItemTypeIds::COCOA_BEANS => DyeColor::BROWN(),
|
||||
ItemTypeIds::BONE_MEAL => DyeColor::WHITE(),
|
||||
ItemTypeIds::LAPIS_LAZULI => DyeColor::BLUE,
|
||||
ItemTypeIds::INK_SAC => DyeColor::BLACK,
|
||||
ItemTypeIds::COCOA_BEANS => DyeColor::BROWN,
|
||||
ItemTypeIds::BONE_MEAL => DyeColor::WHITE,
|
||||
ItemTypeIds::DYE => $item instanceof Dye ? $item->getColor() : null,
|
||||
default => null
|
||||
}) !== null && ($newColor = $dyeColor->getRgbValue())->toRGBA() !== $this->customWaterColor?->toRGBA()
|
||||
@ -123,7 +123,7 @@ final class WaterCauldron extends FillableCauldron{
|
||||
|
||||
$item->pop();
|
||||
}elseif($item instanceof Potion || $item instanceof SplashPotion){ //TODO: lingering potion
|
||||
if($item->getType()->equals(PotionType::WATER())){
|
||||
if($item->getType() === PotionType::WATER){
|
||||
$this->setCustomWaterColor(null)->addFillLevels(self::WATER_BOTTLE_FILL_AMOUNT, $item, VanillaItems::GLASS_BOTTLE(), $returnedItems);
|
||||
}else{
|
||||
$this->mix($item, VanillaItems::GLASS_BOTTLE(), $returnedItems);
|
||||
@ -170,7 +170,7 @@ final class WaterCauldron extends FillableCauldron{
|
||||
match($item->getTypeId()){
|
||||
ItemTypeIds::WATER_BUCKET => $this->setCustomWaterColor(null)->addFillLevels(self::MAX_FILL_LEVEL, $item, VanillaItems::BUCKET(), $returnedItems),
|
||||
ItemTypeIds::BUCKET => $this->removeFillLevels(self::MAX_FILL_LEVEL, $item, VanillaItems::WATER_BUCKET(), $returnedItems),
|
||||
ItemTypeIds::GLASS_BOTTLE => $this->removeFillLevels(self::WATER_BOTTLE_FILL_AMOUNT, $item, VanillaItems::POTION()->setType(PotionType::WATER()), $returnedItems),
|
||||
ItemTypeIds::GLASS_BOTTLE => $this->removeFillLevels(self::WATER_BOTTLE_FILL_AMOUNT, $item, VanillaItems::POTION()->setType(PotionType::WATER), $returnedItems),
|
||||
ItemTypeIds::LAVA_BUCKET, ItemTypeIds::POWDER_SNOW_BUCKET => $this->mix($item, VanillaItems::BUCKET(), $returnedItems),
|
||||
default => null
|
||||
};
|
||||
|
@ -29,11 +29,6 @@ use pocketmine\block\utils\DyeColor;
|
||||
class Wool extends Opaque{
|
||||
use ColoredTrait;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
|
||||
$this->color = DyeColor::WHITE();
|
||||
parent::__construct($idInfo, $name, $typeInfo);
|
||||
}
|
||||
|
||||
public function getFlameEncouragement() : int{
|
||||
return 30;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ class Banner extends Spawnable{
|
||||
public const TAG_PATTERN_COLOR = "Color";
|
||||
public const TAG_PATTERN_NAME = "Pattern";
|
||||
|
||||
private DyeColor $baseColor;
|
||||
private DyeColor $baseColor = DyeColor::BLACK;
|
||||
|
||||
/**
|
||||
* @var BannerPatternLayer[]
|
||||
@ -52,11 +52,6 @@ class Banner extends Spawnable{
|
||||
*/
|
||||
private array $patterns = [];
|
||||
|
||||
public function __construct(World $world, Vector3 $pos){
|
||||
$this->baseColor = DyeColor::BLACK();
|
||||
parent::__construct($world, $pos);
|
||||
}
|
||||
|
||||
public function readSaveData(CompoundTag $nbt) : void{
|
||||
$colorIdMap = DyeColorIdMap::getInstance();
|
||||
if(
|
||||
@ -65,7 +60,7 @@ class Banner extends Spawnable{
|
||||
){
|
||||
$this->baseColor = $baseColor;
|
||||
}else{
|
||||
$this->baseColor = DyeColor::BLACK(); //TODO: this should be an error
|
||||
$this->baseColor = DyeColor::BLACK; //TODO: this should be an error
|
||||
}
|
||||
|
||||
$patternTypeIdMap = BannerPatternTypeIdMap::getInstance();
|
||||
@ -74,7 +69,7 @@ class Banner extends Spawnable{
|
||||
if($patterns !== null){
|
||||
/** @var CompoundTag $pattern */
|
||||
foreach($patterns as $pattern){
|
||||
$patternColor = $colorIdMap->fromInvertedId($pattern->getInt(self::TAG_PATTERN_COLOR)) ?? DyeColor::BLACK(); //TODO: missing pattern colour should be an error
|
||||
$patternColor = $colorIdMap->fromInvertedId($pattern->getInt(self::TAG_PATTERN_COLOR)) ?? DyeColor::BLACK; //TODO: missing pattern colour should be an error
|
||||
$patternType = $patternTypeIdMap->fromId($pattern->getString(self::TAG_PATTERN_NAME));
|
||||
if($patternType === null){
|
||||
continue; //TODO: this should be an error, but right now we don't have the setup to deal with it
|
||||
|
@ -33,12 +33,7 @@ use pocketmine\world\World;
|
||||
class Bed extends Spawnable{
|
||||
public const TAG_COLOR = "color";
|
||||
|
||||
private DyeColor $color;
|
||||
|
||||
public function __construct(World $world, Vector3 $pos){
|
||||
$this->color = DyeColor::RED();
|
||||
parent::__construct($world, $pos);
|
||||
}
|
||||
private DyeColor $color = DyeColor::RED;
|
||||
|
||||
public function getColor() : DyeColor{
|
||||
return $this->color;
|
||||
@ -55,7 +50,7 @@ class Bed extends Spawnable{
|
||||
){
|
||||
$this->color = $color;
|
||||
}else{
|
||||
$this->color = DyeColor::RED(); //TODO: this should be an error, but we don't have the systems to handle it yet
|
||||
$this->color = DyeColor::RED; //TODO: this should be an error, but we don't have the systems to handle it yet
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,6 @@ use pocketmine\crafting\FurnaceType;
|
||||
|
||||
class BlastFurnace extends Furnace{
|
||||
public function getFurnaceType() : FurnaceType{
|
||||
return FurnaceType::BLAST_FURNACE();
|
||||
return FurnaceType::BLAST_FURNACE;
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,6 @@ use pocketmine\crafting\FurnaceType;
|
||||
|
||||
class NormalFurnace extends Furnace{
|
||||
public function getFurnaceType() : FurnaceType{
|
||||
return FurnaceType::FURNACE();
|
||||
return FurnaceType::FURNACE;
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,6 @@ use pocketmine\crafting\FurnaceType;
|
||||
|
||||
class Smoker extends Furnace{
|
||||
public function getFurnaceType() : FurnaceType{
|
||||
return FurnaceType::SMOKER();
|
||||
return FurnaceType::SMOKER;
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ use pocketmine\data\runtime\RuntimeDataDescriber;
|
||||
|
||||
trait ColoredTrait{
|
||||
/** @var DyeColor */
|
||||
private $color;
|
||||
private $color = DyeColor::WHITE;
|
||||
|
||||
/** @see Block::describeBlockItemState() */
|
||||
public function describeBlockItemState(RuntimeDataDescriber $w) : void{
|
||||
|
@ -24,13 +24,12 @@ declare(strict_types=1);
|
||||
namespace pocketmine\block\utils;
|
||||
|
||||
use pocketmine\color\Color;
|
||||
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 DyeColor BLACK()
|
||||
* @method static DyeColor BLUE()
|
||||
@ -48,46 +47,70 @@ use pocketmine\utils\EnumTrait;
|
||||
* @method static DyeColor RED()
|
||||
* @method static DyeColor WHITE()
|
||||
* @method static DyeColor YELLOW()
|
||||
*
|
||||
* @phpstan-type TMetadata array{0: string, 1: Color}
|
||||
*/
|
||||
final class DyeColor{
|
||||
use EnumTrait {
|
||||
__construct as Enum___construct;
|
||||
enum DyeColor{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case WHITE;
|
||||
case ORANGE;
|
||||
case MAGENTA;
|
||||
case LIGHT_BLUE;
|
||||
case YELLOW;
|
||||
case LIME;
|
||||
case PINK;
|
||||
case GRAY;
|
||||
case LIGHT_GRAY;
|
||||
case CYAN;
|
||||
case PURPLE;
|
||||
case BLUE;
|
||||
case BROWN;
|
||||
case GREEN;
|
||||
case RED;
|
||||
case BLACK;
|
||||
|
||||
/**
|
||||
* 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(string $displayName, Color $rgbValue) : array{
|
||||
return [$displayName, $rgbValue];
|
||||
}
|
||||
|
||||
protected static function setup() : void{
|
||||
self::registerAll(
|
||||
new DyeColor("white", "White", new Color(0xf0, 0xf0, 0xf0)),
|
||||
new DyeColor("orange", "Orange", new Color(0xf9, 0x80, 0x1d)),
|
||||
new DyeColor("magenta", "Magenta", new Color(0xc7, 0x4e, 0xbd)),
|
||||
new DyeColor("light_blue", "Light Blue", new Color(0x3a, 0xb3, 0xda)),
|
||||
new DyeColor("yellow", "Yellow", new Color(0xfe, 0xd8, 0x3d)),
|
||||
new DyeColor("lime", "Lime", new Color(0x80, 0xc7, 0x1f)),
|
||||
new DyeColor("pink", "Pink", new Color(0xf3, 0x8b, 0xaa)),
|
||||
new DyeColor("gray", "Gray", new Color(0x47, 0x4f, 0x52)),
|
||||
new DyeColor("light_gray", "Light Gray", new Color(0x9d, 0x9d, 0x97)),
|
||||
new DyeColor("cyan", "Cyan", new Color(0x16, 0x9c, 0x9c)),
|
||||
new DyeColor("purple", "Purple", new Color(0x89, 0x32, 0xb8)),
|
||||
new DyeColor("blue", "Blue", new Color(0x3c, 0x44, 0xaa)),
|
||||
new DyeColor("brown", "Brown", new Color(0x83, 0x54, 0x32)),
|
||||
new DyeColor("green", "Green", new Color(0x5e, 0x7c, 0x16)),
|
||||
new DyeColor("red", "Red", new Color(0xb0, 0x2e, 0x26)),
|
||||
new DyeColor("black", "Black", new Color(0x1d, 0x1d, 0x21))
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @phpstan-return TMetadata
|
||||
*/
|
||||
private function getMetadata() : array{
|
||||
/** @phpstan-var array<int, TMetadata> $cache */
|
||||
static $cache = [];
|
||||
|
||||
private function __construct(
|
||||
string $enumName,
|
||||
private string $displayName,
|
||||
private Color $rgbValue
|
||||
){
|
||||
$this->Enum___construct($enumName);
|
||||
return $cache[spl_object_id($this)] ??= match($this){
|
||||
self::WHITE => self::meta("White", new Color(0xf0, 0xf0, 0xf0)),
|
||||
self::ORANGE => self::meta("Orange", new Color(0xf9, 0x80, 0x1d)),
|
||||
self::MAGENTA => self::meta("Magenta", new Color(0xc7, 0x4e, 0xbd)),
|
||||
self::LIGHT_BLUE => self::meta("Light Blue", new Color(0x3a, 0xb3, 0xda)),
|
||||
self::YELLOW => self::meta("Yellow", new Color(0xfe, 0xd8, 0x3d)),
|
||||
self::LIME => self::meta("Lime", new Color(0x80, 0xc7, 0x1f)),
|
||||
self::PINK => self::meta("Pink", new Color(0xf3, 0x8b, 0xaa)),
|
||||
self::GRAY => self::meta("Gray", new Color(0x47, 0x4f, 0x52)),
|
||||
self::LIGHT_GRAY => self::meta("Light Gray", new Color(0x9d, 0x9d, 0x97)),
|
||||
self::CYAN => self::meta("Cyan", new Color(0x16, 0x9c, 0x9c)),
|
||||
self::PURPLE => self::meta("Purple", new Color(0x89, 0x32, 0xb8)),
|
||||
self::BLUE => self::meta("Blue", new Color(0x3c, 0x44, 0xaa)),
|
||||
self::BROWN => self::meta("Brown", new Color(0x83, 0x54, 0x32)),
|
||||
self::GREEN => self::meta("Green", new Color(0x5e, 0x7c, 0x16)),
|
||||
self::RED => self::meta("Red", new Color(0xb0, 0x2e, 0x26)),
|
||||
self::BLACK => self::meta("Black", new Color(0x1d, 0x1d, 0x21)),
|
||||
};
|
||||
}
|
||||
|
||||
public function getDisplayName() : string{
|
||||
return $this->displayName;
|
||||
return $this->getMetadata()[0];
|
||||
}
|
||||
|
||||
public function getRgbValue() : Color{
|
||||
return $this->rgbValue;
|
||||
return $this->getMetadata()[1];
|
||||
}
|
||||
}
|
||||
|
@ -26,13 +26,12 @@ namespace pocketmine\block\utils;
|
||||
use pocketmine\lang\KnownTranslationFactory;
|
||||
use pocketmine\lang\Translatable;
|
||||
use pocketmine\network\mcpe\protocol\types\LevelSoundEvent;
|
||||
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 RecordType DISK_11()
|
||||
* @method static RecordType DISK_13()
|
||||
@ -49,48 +48,63 @@ use pocketmine\utils\EnumTrait;
|
||||
* @method static RecordType DISK_STRAD()
|
||||
* @method static RecordType DISK_WAIT()
|
||||
* @method static RecordType DISK_WARD()
|
||||
*
|
||||
* @phpstan-type TMetadata array{0: string, 1: LevelSoundEvent::*, 2: Translatable}
|
||||
*/
|
||||
final class RecordType{
|
||||
use EnumTrait {
|
||||
__construct as Enum___construct;
|
||||
}
|
||||
enum RecordType{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
protected static function setup() : void{
|
||||
self::registerAll(
|
||||
new RecordType("disk_13", "C418 - 13", LevelSoundEvent::RECORD_13, KnownTranslationFactory::item_record_13_desc()),
|
||||
new RecordType("disk_5", "Samuel Åberg - 5", LevelSoundEvent::RECORD_5, KnownTranslationFactory::item_record_5_desc()),
|
||||
new RecordType("disk_cat", "C418 - cat", LevelSoundEvent::RECORD_CAT, KnownTranslationFactory::item_record_cat_desc()),
|
||||
new RecordType("disk_blocks", "C418 - blocks", LevelSoundEvent::RECORD_BLOCKS, KnownTranslationFactory::item_record_blocks_desc()),
|
||||
new RecordType("disk_chirp", "C418 - chirp", LevelSoundEvent::RECORD_CHIRP, KnownTranslationFactory::item_record_chirp_desc()),
|
||||
new RecordType("disk_far", "C418 - far", LevelSoundEvent::RECORD_FAR, KnownTranslationFactory::item_record_far_desc()),
|
||||
new RecordType("disk_mall", "C418 - mall", LevelSoundEvent::RECORD_MALL, KnownTranslationFactory::item_record_mall_desc()),
|
||||
new RecordType("disk_mellohi", "C418 - mellohi", LevelSoundEvent::RECORD_MELLOHI, KnownTranslationFactory::item_record_mellohi_desc()),
|
||||
new RecordType("disk_otherside", "Lena Raine - otherside", LevelSoundEvent::RECORD_OTHERSIDE, KnownTranslationFactory::item_record_otherside_desc()),
|
||||
new RecordType("disk_pigstep", "Lena Raine - Pigstep", LevelSoundEvent::RECORD_PIGSTEP, KnownTranslationFactory::item_record_pigstep_desc()),
|
||||
new RecordType("disk_stal", "C418 - stal", LevelSoundEvent::RECORD_STAL, KnownTranslationFactory::item_record_stal_desc()),
|
||||
new RecordType("disk_strad", "C418 - strad", LevelSoundEvent::RECORD_STRAD, KnownTranslationFactory::item_record_strad_desc()),
|
||||
new RecordType("disk_ward", "C418 - ward", LevelSoundEvent::RECORD_WARD, KnownTranslationFactory::item_record_ward_desc()),
|
||||
new RecordType("disk_11", "C418 - 11", LevelSoundEvent::RECORD_11, KnownTranslationFactory::item_record_11_desc()),
|
||||
new RecordType("disk_wait", "C418 - wait", LevelSoundEvent::RECORD_WAIT, KnownTranslationFactory::item_record_wait_desc())
|
||||
);
|
||||
}
|
||||
case DISK_13;
|
||||
case DISK_5;
|
||||
case DISK_CAT;
|
||||
case DISK_BLOCKS;
|
||||
case DISK_CHIRP;
|
||||
case DISK_FAR;
|
||||
case DISK_MALL;
|
||||
case DISK_MELLOHI;
|
||||
case DISK_OTHERSIDE;
|
||||
case DISK_PIGSTEP;
|
||||
case DISK_STAL;
|
||||
case DISK_STRAD;
|
||||
case DISK_WARD;
|
||||
case DISK_11;
|
||||
case DISK_WAIT;
|
||||
|
||||
private function __construct(
|
||||
string $enumName,
|
||||
private string $soundName,
|
||||
private int $soundId,
|
||||
private Translatable $translatableName
|
||||
){
|
||||
$this->Enum___construct($enumName);
|
||||
/**
|
||||
* @phpstan-return TMetadata
|
||||
*/
|
||||
private function getMetadata() : array{
|
||||
/** @phpstan-var array<int, TMetadata> $cache */
|
||||
static $cache = [];
|
||||
|
||||
return $cache[spl_object_id($this)] ??= match($this){
|
||||
self::DISK_13 => ["C418 - 13", LevelSoundEvent::RECORD_13, KnownTranslationFactory::item_record_13_desc()],
|
||||
self::DISK_5 => ["Samuel Åberg - 5", LevelSoundEvent::RECORD_5, KnownTranslationFactory::item_record_5_desc()],
|
||||
self::DISK_CAT => ["C418 - cat", LevelSoundEvent::RECORD_CAT, KnownTranslationFactory::item_record_cat_desc()],
|
||||
self::DISK_BLOCKS => ["C418 - blocks", LevelSoundEvent::RECORD_BLOCKS, KnownTranslationFactory::item_record_blocks_desc()],
|
||||
self::DISK_CHIRP => ["C418 - chirp", LevelSoundEvent::RECORD_CHIRP, KnownTranslationFactory::item_record_chirp_desc()],
|
||||
self::DISK_FAR => ["C418 - far", LevelSoundEvent::RECORD_FAR, KnownTranslationFactory::item_record_far_desc()],
|
||||
self::DISK_MALL => ["C418 - mall", LevelSoundEvent::RECORD_MALL, KnownTranslationFactory::item_record_mall_desc()],
|
||||
self::DISK_MELLOHI => ["C418 - mellohi", LevelSoundEvent::RECORD_MELLOHI, KnownTranslationFactory::item_record_mellohi_desc()],
|
||||
self::DISK_OTHERSIDE => ["Lena Raine - otherside", LevelSoundEvent::RECORD_OTHERSIDE, KnownTranslationFactory::item_record_otherside_desc()],
|
||||
self::DISK_PIGSTEP => ["Lena Raine - Pigstep", LevelSoundEvent::RECORD_PIGSTEP, KnownTranslationFactory::item_record_pigstep_desc()],
|
||||
self::DISK_STAL => ["C418 - stal", LevelSoundEvent::RECORD_STAL, KnownTranslationFactory::item_record_stal_desc()],
|
||||
self::DISK_STRAD => ["C418 - strad", LevelSoundEvent::RECORD_STRAD, KnownTranslationFactory::item_record_strad_desc()],
|
||||
self::DISK_WARD => ["C418 - ward", LevelSoundEvent::RECORD_WARD, KnownTranslationFactory::item_record_ward_desc()],
|
||||
self::DISK_11 => ["C418 - 11", LevelSoundEvent::RECORD_11, KnownTranslationFactory::item_record_11_desc()],
|
||||
self::DISK_WAIT => ["C418 - wait", LevelSoundEvent::RECORD_WAIT, KnownTranslationFactory::item_record_wait_desc()]
|
||||
};
|
||||
}
|
||||
|
||||
public function getSoundName() : string{
|
||||
return $this->soundName;
|
||||
return $this->getMetadata()[0];
|
||||
}
|
||||
|
||||
public function getSoundId() : int{
|
||||
return $this->soundId;
|
||||
return $this->getMetadata()[1];
|
||||
}
|
||||
|
||||
public function getTranslatableName() : Translatable{ return $this->translatableName; }
|
||||
public function getTranslatableName() : Translatable{
|
||||
return $this->getMetadata()[2];
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ use pocketmine\nbt\TreeRoot;
|
||||
use pocketmine\utils\BinaryStream;
|
||||
use pocketmine\utils\DestructorCallbackTrait;
|
||||
use pocketmine\utils\ObjectSet;
|
||||
use function spl_object_id;
|
||||
use function usort;
|
||||
|
||||
class CraftingManager{
|
||||
@ -80,8 +81,8 @@ class CraftingManager{
|
||||
|
||||
public function __construct(){
|
||||
$this->recipeRegisteredCallbacks = new ObjectSet();
|
||||
foreach(FurnaceType::getAll() as $furnaceType){
|
||||
$this->furnaceRecipeManagers[$furnaceType->id()] = new FurnaceRecipeManager();
|
||||
foreach(FurnaceType::cases() as $furnaceType){
|
||||
$this->furnaceRecipeManagers[spl_object_id($furnaceType)] = new FurnaceRecipeManager();
|
||||
}
|
||||
|
||||
$recipeRegisteredCallbacks = $this->recipeRegisteredCallbacks;
|
||||
@ -177,7 +178,7 @@ class CraftingManager{
|
||||
}
|
||||
|
||||
public function getFurnaceRecipeManager(FurnaceType $furnaceType) : FurnaceRecipeManager{
|
||||
return $this->furnaceRecipeManagers[$furnaceType->id()];
|
||||
return $this->furnaceRecipeManagers[spl_object_id($furnaceType)];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -270,9 +270,9 @@ final class CraftingManagerFromDataHelper{
|
||||
}
|
||||
foreach(self::loadJsonArrayOfObjectsFile(Path::join($directoryPath, 'smelting.json'), FurnaceRecipeData::class) as $recipe){
|
||||
$furnaceType = match ($recipe->block){
|
||||
"furnace" => FurnaceType::FURNACE(),
|
||||
"blast_furnace" => FurnaceType::BLAST_FURNACE(),
|
||||
"smoker" => FurnaceType::SMOKER(),
|
||||
"furnace" => FurnaceType::FURNACE,
|
||||
"blast_furnace" => FurnaceType::BLAST_FURNACE,
|
||||
"smoker" => FurnaceType::SMOKER,
|
||||
//TODO: campfire
|
||||
default => null
|
||||
};
|
||||
|
@ -23,40 +23,45 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\crafting;
|
||||
|
||||
use pocketmine\utils\EnumTrait;
|
||||
use pocketmine\utils\LegacyEnumShimTrait;
|
||||
use pocketmine\world\sound\BlastFurnaceSound;
|
||||
use pocketmine\world\sound\FurnaceSound;
|
||||
use pocketmine\world\sound\SmokerSound;
|
||||
use pocketmine\world\sound\Sound;
|
||||
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 FurnaceType BLAST_FURNACE()
|
||||
* @method static FurnaceType FURNACE()
|
||||
* @method static FurnaceType SMOKER()
|
||||
*
|
||||
* @phpstan-type TMetadata array{0: int, 1: Sound}
|
||||
*/
|
||||
final class FurnaceType{
|
||||
use EnumTrait {
|
||||
__construct as Enum___construct;
|
||||
enum FurnaceType{
|
||||
use LegacyEnumShimTrait;
|
||||
|
||||
case FURNACE;
|
||||
case BLAST_FURNACE;
|
||||
case SMOKER;
|
||||
|
||||
/**
|
||||
* @phpstan-return TMetadata
|
||||
*/
|
||||
private function getMetadata() : array{
|
||||
/** @phpstan-var array<int, TMetadata> $cache */
|
||||
static $cache = [];
|
||||
|
||||
return $cache[spl_object_id($this)] ??= match($this){
|
||||
self::FURNACE => [200, new FurnaceSound()],
|
||||
self::BLAST_FURNACE => [100, new BlastFurnaceSound()],
|
||||
self::SMOKER => [100, new SmokerSound()],
|
||||
};
|
||||
}
|
||||
|
||||
protected static function setup() : void{
|
||||
self::registerAll(
|
||||
new self("furnace", 200, new FurnaceSound()),
|
||||
new self("blast_furnace", 100, new BlastFurnaceSound()),
|
||||
new self("smoker", 100, new SmokerSound()),
|
||||
);
|
||||
}
|
||||
public function getCookDurationTicks() : int{ return $this->getMetadata()[0]; }
|
||||
|
||||
private function __construct(string $enumName, private int $cookDurationTicks, private Sound $cookSound){
|
||||
$this->Enum___construct($enumName);
|
||||
}
|
||||
|
||||
public function getCookDurationTicks() : int{ return $this->cookDurationTicks; }
|
||||
|
||||
public function getCookSound() : Sound{ return $this->cookSound; }
|
||||
public function getCookSound() : Sound{ return $this->getMetadata()[1]; }
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ namespace pocketmine\data\bedrock;
|
||||
use pocketmine\block\utils\DyeColor;
|
||||
use pocketmine\data\bedrock\item\ItemTypeNames;
|
||||
use pocketmine\utils\SingletonTrait;
|
||||
use function spl_object_id;
|
||||
|
||||
final class DyeColorIdMap{
|
||||
use SingletonTrait;
|
||||
@ -47,28 +48,28 @@ final class DyeColorIdMap{
|
||||
private array $enumToItemId = [];
|
||||
|
||||
private function __construct(){
|
||||
$this->register(0, ItemTypeNames::WHITE_DYE, DyeColor::WHITE());
|
||||
$this->register(1, ItemTypeNames::ORANGE_DYE, DyeColor::ORANGE());
|
||||
$this->register(2, ItemTypeNames::MAGENTA_DYE, DyeColor::MAGENTA());
|
||||
$this->register(3, ItemTypeNames::LIGHT_BLUE_DYE, DyeColor::LIGHT_BLUE());
|
||||
$this->register(4, ItemTypeNames::YELLOW_DYE, DyeColor::YELLOW());
|
||||
$this->register(5, ItemTypeNames::LIME_DYE, DyeColor::LIME());
|
||||
$this->register(6, ItemTypeNames::PINK_DYE, DyeColor::PINK());
|
||||
$this->register(7, ItemTypeNames::GRAY_DYE, DyeColor::GRAY());
|
||||
$this->register(8, ItemTypeNames::LIGHT_GRAY_DYE, DyeColor::LIGHT_GRAY());
|
||||
$this->register(9, ItemTypeNames::CYAN_DYE, DyeColor::CYAN());
|
||||
$this->register(10, ItemTypeNames::PURPLE_DYE, DyeColor::PURPLE());
|
||||
$this->register(11, ItemTypeNames::BLUE_DYE, DyeColor::BLUE());
|
||||
$this->register(12, ItemTypeNames::BROWN_DYE, DyeColor::BROWN());
|
||||
$this->register(13, ItemTypeNames::GREEN_DYE, DyeColor::GREEN());
|
||||
$this->register(14, ItemTypeNames::RED_DYE, DyeColor::RED());
|
||||
$this->register(15, ItemTypeNames::BLACK_DYE, DyeColor::BLACK());
|
||||
$this->register(0, ItemTypeNames::WHITE_DYE, DyeColor::WHITE);
|
||||
$this->register(1, ItemTypeNames::ORANGE_DYE, DyeColor::ORANGE);
|
||||
$this->register(2, ItemTypeNames::MAGENTA_DYE, DyeColor::MAGENTA);
|
||||
$this->register(3, ItemTypeNames::LIGHT_BLUE_DYE, DyeColor::LIGHT_BLUE);
|
||||
$this->register(4, ItemTypeNames::YELLOW_DYE, DyeColor::YELLOW);
|
||||
$this->register(5, ItemTypeNames::LIME_DYE, DyeColor::LIME);
|
||||
$this->register(6, ItemTypeNames::PINK_DYE, DyeColor::PINK);
|
||||
$this->register(7, ItemTypeNames::GRAY_DYE, DyeColor::GRAY);
|
||||
$this->register(8, ItemTypeNames::LIGHT_GRAY_DYE, DyeColor::LIGHT_GRAY);
|
||||
$this->register(9, ItemTypeNames::CYAN_DYE, DyeColor::CYAN);
|
||||
$this->register(10, ItemTypeNames::PURPLE_DYE, DyeColor::PURPLE);
|
||||
$this->register(11, ItemTypeNames::BLUE_DYE, DyeColor::BLUE);
|
||||
$this->register(12, ItemTypeNames::BROWN_DYE, DyeColor::BROWN);
|
||||
$this->register(13, ItemTypeNames::GREEN_DYE, DyeColor::GREEN);
|
||||
$this->register(14, ItemTypeNames::RED_DYE, DyeColor::RED);
|
||||
$this->register(15, ItemTypeNames::BLACK_DYE, DyeColor::BLACK);
|
||||
}
|
||||
|
||||
private function register(int $id, string $itemId, DyeColor $color) : void{
|
||||
$this->registerInt($id, $color);
|
||||
$this->itemIdToEnum[$itemId] = $color;
|
||||
$this->enumToItemId[$color->id()] = $itemId;
|
||||
$this->enumToItemId[spl_object_id($color)] = $itemId;
|
||||
}
|
||||
|
||||
public function toInvertedId(DyeColor $color) : int{
|
||||
@ -76,7 +77,7 @@ final class DyeColorIdMap{
|
||||
}
|
||||
|
||||
public function toItemId(DyeColor $color) : string{
|
||||
return $this->enumToItemId[$color->id()];
|
||||
return $this->enumToItemId[spl_object_id($color)];
|
||||
}
|
||||
|
||||
public function fromInvertedId(int $id) : ?DyeColor{
|
||||
|
@ -32,9 +32,9 @@ final class MedicineTypeIdMap{
|
||||
use IntSaveIdMapTrait;
|
||||
|
||||
private function __construct(){
|
||||
$this->register(MedicineTypeIds::ANTIDOTE, MedicineType::ANTIDOTE());
|
||||
$this->register(MedicineTypeIds::ELIXIR, MedicineType::ELIXIR());
|
||||
$this->register(MedicineTypeIds::EYE_DROPS, MedicineType::EYE_DROPS());
|
||||
$this->register(MedicineTypeIds::TONIC, MedicineType::TONIC());
|
||||
$this->register(MedicineTypeIds::ANTIDOTE, MedicineType::ANTIDOTE);
|
||||
$this->register(MedicineTypeIds::ELIXIR, MedicineType::ELIXIR);
|
||||
$this->register(MedicineTypeIds::EYE_DROPS, MedicineType::EYE_DROPS);
|
||||
$this->register(MedicineTypeIds::TONIC, MedicineType::TONIC);
|
||||
}
|
||||
}
|
||||
|
@ -32,48 +32,48 @@ final class PotionTypeIdMap{
|
||||
use IntSaveIdMapTrait;
|
||||
|
||||
private function __construct(){
|
||||
$this->register(PotionTypeIds::WATER, PotionType::WATER());
|
||||
$this->register(PotionTypeIds::MUNDANE, PotionType::MUNDANE());
|
||||
$this->register(PotionTypeIds::LONG_MUNDANE, PotionType::LONG_MUNDANE());
|
||||
$this->register(PotionTypeIds::THICK, PotionType::THICK());
|
||||
$this->register(PotionTypeIds::AWKWARD, PotionType::AWKWARD());
|
||||
$this->register(PotionTypeIds::NIGHT_VISION, PotionType::NIGHT_VISION());
|
||||
$this->register(PotionTypeIds::LONG_NIGHT_VISION, PotionType::LONG_NIGHT_VISION());
|
||||
$this->register(PotionTypeIds::INVISIBILITY, PotionType::INVISIBILITY());
|
||||
$this->register(PotionTypeIds::LONG_INVISIBILITY, PotionType::LONG_INVISIBILITY());
|
||||
$this->register(PotionTypeIds::LEAPING, PotionType::LEAPING());
|
||||
$this->register(PotionTypeIds::LONG_LEAPING, PotionType::LONG_LEAPING());
|
||||
$this->register(PotionTypeIds::STRONG_LEAPING, PotionType::STRONG_LEAPING());
|
||||
$this->register(PotionTypeIds::FIRE_RESISTANCE, PotionType::FIRE_RESISTANCE());
|
||||
$this->register(PotionTypeIds::LONG_FIRE_RESISTANCE, PotionType::LONG_FIRE_RESISTANCE());
|
||||
$this->register(PotionTypeIds::SWIFTNESS, PotionType::SWIFTNESS());
|
||||
$this->register(PotionTypeIds::LONG_SWIFTNESS, PotionType::LONG_SWIFTNESS());
|
||||
$this->register(PotionTypeIds::STRONG_SWIFTNESS, PotionType::STRONG_SWIFTNESS());
|
||||
$this->register(PotionTypeIds::SLOWNESS, PotionType::SLOWNESS());
|
||||
$this->register(PotionTypeIds::LONG_SLOWNESS, PotionType::LONG_SLOWNESS());
|
||||
$this->register(PotionTypeIds::WATER_BREATHING, PotionType::WATER_BREATHING());
|
||||
$this->register(PotionTypeIds::LONG_WATER_BREATHING, PotionType::LONG_WATER_BREATHING());
|
||||
$this->register(PotionTypeIds::HEALING, PotionType::HEALING());
|
||||
$this->register(PotionTypeIds::STRONG_HEALING, PotionType::STRONG_HEALING());
|
||||
$this->register(PotionTypeIds::HARMING, PotionType::HARMING());
|
||||
$this->register(PotionTypeIds::STRONG_HARMING, PotionType::STRONG_HARMING());
|
||||
$this->register(PotionTypeIds::POISON, PotionType::POISON());
|
||||
$this->register(PotionTypeIds::LONG_POISON, PotionType::LONG_POISON());
|
||||
$this->register(PotionTypeIds::STRONG_POISON, PotionType::STRONG_POISON());
|
||||
$this->register(PotionTypeIds::REGENERATION, PotionType::REGENERATION());
|
||||
$this->register(PotionTypeIds::LONG_REGENERATION, PotionType::LONG_REGENERATION());
|
||||
$this->register(PotionTypeIds::STRONG_REGENERATION, PotionType::STRONG_REGENERATION());
|
||||
$this->register(PotionTypeIds::STRENGTH, PotionType::STRENGTH());
|
||||
$this->register(PotionTypeIds::LONG_STRENGTH, PotionType::LONG_STRENGTH());
|
||||
$this->register(PotionTypeIds::STRONG_STRENGTH, PotionType::STRONG_STRENGTH());
|
||||
$this->register(PotionTypeIds::WEAKNESS, PotionType::WEAKNESS());
|
||||
$this->register(PotionTypeIds::LONG_WEAKNESS, PotionType::LONG_WEAKNESS());
|
||||
$this->register(PotionTypeIds::WITHER, PotionType::WITHER());
|
||||
$this->register(PotionTypeIds::TURTLE_MASTER, PotionType::TURTLE_MASTER());
|
||||
$this->register(PotionTypeIds::LONG_TURTLE_MASTER, PotionType::LONG_TURTLE_MASTER());
|
||||
$this->register(PotionTypeIds::STRONG_TURTLE_MASTER, PotionType::STRONG_TURTLE_MASTER());
|
||||
$this->register(PotionTypeIds::SLOW_FALLING, PotionType::SLOW_FALLING());
|
||||
$this->register(PotionTypeIds::LONG_SLOW_FALLING, PotionType::LONG_SLOW_FALLING());
|
||||
$this->register(PotionTypeIds::STRONG_SLOWNESS, PotionType::STRONG_SLOWNESS());
|
||||
$this->register(PotionTypeIds::WATER, PotionType::WATER);
|
||||
$this->register(PotionTypeIds::MUNDANE, PotionType::MUNDANE);
|
||||
$this->register(PotionTypeIds::LONG_MUNDANE, PotionType::LONG_MUNDANE);
|
||||
$this->register(PotionTypeIds::THICK, PotionType::THICK);
|
||||
$this->register(PotionTypeIds::AWKWARD, PotionType::AWKWARD);
|
||||
$this->register(PotionTypeIds::NIGHT_VISION, PotionType::NIGHT_VISION);
|
||||
$this->register(PotionTypeIds::LONG_NIGHT_VISION, PotionType::LONG_NIGHT_VISION);
|
||||
$this->register(PotionTypeIds::INVISIBILITY, PotionType::INVISIBILITY);
|
||||
$this->register(PotionTypeIds::LONG_INVISIBILITY, PotionType::LONG_INVISIBILITY);
|
||||
$this->register(PotionTypeIds::LEAPING, PotionType::LEAPING);
|
||||
$this->register(PotionTypeIds::LONG_LEAPING, PotionType::LONG_LEAPING);
|
||||
$this->register(PotionTypeIds::STRONG_LEAPING, PotionType::STRONG_LEAPING);
|
||||
$this->register(PotionTypeIds::FIRE_RESISTANCE, PotionType::FIRE_RESISTANCE);
|
||||
$this->register(PotionTypeIds::LONG_FIRE_RESISTANCE, PotionType::LONG_FIRE_RESISTANCE);
|
||||
$this->register(PotionTypeIds::SWIFTNESS, PotionType::SWIFTNESS);
|
||||
$this->register(PotionTypeIds::LONG_SWIFTNESS, PotionType::LONG_SWIFTNESS);
|
||||
$this->register(PotionTypeIds::STRONG_SWIFTNESS, PotionType::STRONG_SWIFTNESS);
|
||||
$this->register(PotionTypeIds::SLOWNESS, PotionType::SLOWNESS);
|
||||
$this->register(PotionTypeIds::LONG_SLOWNESS, PotionType::LONG_SLOWNESS);
|
||||
$this->register(PotionTypeIds::WATER_BREATHING, PotionType::WATER_BREATHING);
|
||||
$this->register(PotionTypeIds::LONG_WATER_BREATHING, PotionType::LONG_WATER_BREATHING);
|
||||
$this->register(PotionTypeIds::HEALING, PotionType::HEALING);
|
||||
$this->register(PotionTypeIds::STRONG_HEALING, PotionType::STRONG_HEALING);
|
||||
$this->register(PotionTypeIds::HARMING, PotionType::HARMING);
|
||||
$this->register(PotionTypeIds::STRONG_HARMING, PotionType::STRONG_HARMING);
|
||||
$this->register(PotionTypeIds::POISON, PotionType::POISON);
|
||||
$this->register(PotionTypeIds::LONG_POISON, PotionType::LONG_POISON);
|
||||
$this->register(PotionTypeIds::STRONG_POISON, PotionType::STRONG_POISON);
|
||||
$this->register(PotionTypeIds::REGENERATION, PotionType::REGENERATION);
|
||||
$this->register(PotionTypeIds::LONG_REGENERATION, PotionType::LONG_REGENERATION);
|
||||
$this->register(PotionTypeIds::STRONG_REGENERATION, PotionType::STRONG_REGENERATION);
|
||||
$this->register(PotionTypeIds::STRENGTH, PotionType::STRENGTH);
|
||||
$this->register(PotionTypeIds::LONG_STRENGTH, PotionType::LONG_STRENGTH);
|
||||
$this->register(PotionTypeIds::STRONG_STRENGTH, PotionType::STRONG_STRENGTH);
|
||||
$this->register(PotionTypeIds::WEAKNESS, PotionType::WEAKNESS);
|
||||
$this->register(PotionTypeIds::LONG_WEAKNESS, PotionType::LONG_WEAKNESS);
|
||||
$this->register(PotionTypeIds::WITHER, PotionType::WITHER);
|
||||
$this->register(PotionTypeIds::TURTLE_MASTER, PotionType::TURTLE_MASTER);
|
||||
$this->register(PotionTypeIds::LONG_TURTLE_MASTER, PotionType::LONG_TURTLE_MASTER);
|
||||
$this->register(PotionTypeIds::STRONG_TURTLE_MASTER, PotionType::STRONG_TURTLE_MASTER);
|
||||
$this->register(PotionTypeIds::SLOW_FALLING, PotionType::SLOW_FALLING);
|
||||
$this->register(PotionTypeIds::LONG_SLOW_FALLING, PotionType::LONG_SLOW_FALLING);
|
||||
$this->register(PotionTypeIds::STRONG_SLOWNESS, PotionType::STRONG_SLOWNESS);
|
||||
}
|
||||
}
|
||||
|
@ -32,15 +32,15 @@ final class SuspiciousStewTypeIdMap{
|
||||
use IntSaveIdMapTrait;
|
||||
|
||||
private function __construct(){
|
||||
$this->register(SuspiciousStewTypeIds::POPPY, SuspiciousStewType::POPPY());
|
||||
$this->register(SuspiciousStewTypeIds::CORNFLOWER, SuspiciousStewType::CORNFLOWER());
|
||||
$this->register(SuspiciousStewTypeIds::TULIP, SuspiciousStewType::TULIP());
|
||||
$this->register(SuspiciousStewTypeIds::AZURE_BLUET, SuspiciousStewType::AZURE_BLUET());
|
||||
$this->register(SuspiciousStewTypeIds::LILY_OF_THE_VALLEY, SuspiciousStewType::LILY_OF_THE_VALLEY());
|
||||
$this->register(SuspiciousStewTypeIds::DANDELION, SuspiciousStewType::DANDELION());
|
||||
$this->register(SuspiciousStewTypeIds::BLUE_ORCHID, SuspiciousStewType::BLUE_ORCHID());
|
||||
$this->register(SuspiciousStewTypeIds::ALLIUM, SuspiciousStewType::ALLIUM());
|
||||
$this->register(SuspiciousStewTypeIds::OXEYE_DAISY, SuspiciousStewType::OXEYE_DAISY());
|
||||
$this->register(SuspiciousStewTypeIds::WITHER_ROSE, SuspiciousStewType::WITHER_ROSE());
|
||||
$this->register(SuspiciousStewTypeIds::POPPY, SuspiciousStewType::POPPY);
|
||||
$this->register(SuspiciousStewTypeIds::CORNFLOWER, SuspiciousStewType::CORNFLOWER);
|
||||
$this->register(SuspiciousStewTypeIds::TULIP, SuspiciousStewType::TULIP);
|
||||
$this->register(SuspiciousStewTypeIds::AZURE_BLUET, SuspiciousStewType::AZURE_BLUET);
|
||||
$this->register(SuspiciousStewTypeIds::LILY_OF_THE_VALLEY, SuspiciousStewType::LILY_OF_THE_VALLEY);
|
||||
$this->register(SuspiciousStewTypeIds::DANDELION, SuspiciousStewType::DANDELION);
|
||||
$this->register(SuspiciousStewTypeIds::BLUE_ORCHID, SuspiciousStewType::BLUE_ORCHID);
|
||||
$this->register(SuspiciousStewTypeIds::ALLIUM, SuspiciousStewType::ALLIUM);
|
||||
$this->register(SuspiciousStewTypeIds::OXEYE_DAISY, SuspiciousStewType::OXEYE_DAISY);
|
||||
$this->register(SuspiciousStewTypeIds::WITHER_ROSE, SuspiciousStewType::WITHER_ROSE);
|
||||
}
|
||||
}
|
||||
|
@ -271,149 +271,142 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{
|
||||
private function registerCandleSerializers() : void{
|
||||
$this->map(Blocks::CANDLE(), fn(Candle $block) => Helper::encodeCandle($block, new Writer(Ids::CANDLE)));
|
||||
$this->map(Blocks::DYED_CANDLE(), fn(DyedCandle $block) => Helper::encodeCandle($block, new Writer(match($block->getColor()){
|
||||
DyeColor::BLACK() => Ids::BLACK_CANDLE,
|
||||
DyeColor::BLUE() => Ids::BLUE_CANDLE,
|
||||
DyeColor::BROWN() => Ids::BROWN_CANDLE,
|
||||
DyeColor::CYAN() => Ids::CYAN_CANDLE,
|
||||
DyeColor::GRAY() => Ids::GRAY_CANDLE,
|
||||
DyeColor::GREEN() => Ids::GREEN_CANDLE,
|
||||
DyeColor::LIGHT_BLUE() => Ids::LIGHT_BLUE_CANDLE,
|
||||
DyeColor::LIGHT_GRAY() => Ids::LIGHT_GRAY_CANDLE,
|
||||
DyeColor::LIME() => Ids::LIME_CANDLE,
|
||||
DyeColor::MAGENTA() => Ids::MAGENTA_CANDLE,
|
||||
DyeColor::ORANGE() => Ids::ORANGE_CANDLE,
|
||||
DyeColor::PINK() => Ids::PINK_CANDLE,
|
||||
DyeColor::PURPLE() => Ids::PURPLE_CANDLE,
|
||||
DyeColor::RED() => Ids::RED_CANDLE,
|
||||
DyeColor::WHITE() => Ids::WHITE_CANDLE,
|
||||
DyeColor::YELLOW() => Ids::YELLOW_CANDLE,
|
||||
default => throw new AssumptionFailedError("Unhandled DyeColor " . $block->getColor()->name())
|
||||
DyeColor::BLACK => Ids::BLACK_CANDLE,
|
||||
DyeColor::BLUE => Ids::BLUE_CANDLE,
|
||||
DyeColor::BROWN => Ids::BROWN_CANDLE,
|
||||
DyeColor::CYAN => Ids::CYAN_CANDLE,
|
||||
DyeColor::GRAY => Ids::GRAY_CANDLE,
|
||||
DyeColor::GREEN => Ids::GREEN_CANDLE,
|
||||
DyeColor::LIGHT_BLUE => Ids::LIGHT_BLUE_CANDLE,
|
||||
DyeColor::LIGHT_GRAY => Ids::LIGHT_GRAY_CANDLE,
|
||||
DyeColor::LIME => Ids::LIME_CANDLE,
|
||||
DyeColor::MAGENTA => Ids::MAGENTA_CANDLE,
|
||||
DyeColor::ORANGE => Ids::ORANGE_CANDLE,
|
||||
DyeColor::PINK => Ids::PINK_CANDLE,
|
||||
DyeColor::PURPLE => Ids::PURPLE_CANDLE,
|
||||
DyeColor::RED => Ids::RED_CANDLE,
|
||||
DyeColor::WHITE => Ids::WHITE_CANDLE,
|
||||
DyeColor::YELLOW => Ids::YELLOW_CANDLE,
|
||||
})));
|
||||
$this->map(Blocks::CAKE_WITH_CANDLE(), fn(CakeWithCandle $block) => Writer::create(Ids::CANDLE_CAKE)
|
||||
->writeBool(StateNames::LIT, $block->isLit()));
|
||||
$this->map(Blocks::CAKE_WITH_DYED_CANDLE(), fn(CakeWithDyedCandle $block) => Writer::create(match($block->getColor()){
|
||||
DyeColor::BLACK() => Ids::BLACK_CANDLE_CAKE,
|
||||
DyeColor::BLUE() => Ids::BLUE_CANDLE_CAKE,
|
||||
DyeColor::BROWN() => Ids::BROWN_CANDLE_CAKE,
|
||||
DyeColor::CYAN() => Ids::CYAN_CANDLE_CAKE,
|
||||
DyeColor::GRAY() => Ids::GRAY_CANDLE_CAKE,
|
||||
DyeColor::GREEN() => Ids::GREEN_CANDLE_CAKE,
|
||||
DyeColor::LIGHT_BLUE() => Ids::LIGHT_BLUE_CANDLE_CAKE,
|
||||
DyeColor::LIGHT_GRAY() => Ids::LIGHT_GRAY_CANDLE_CAKE,
|
||||
DyeColor::LIME() => Ids::LIME_CANDLE_CAKE,
|
||||
DyeColor::MAGENTA() => Ids::MAGENTA_CANDLE_CAKE,
|
||||
DyeColor::ORANGE() => Ids::ORANGE_CANDLE_CAKE,
|
||||
DyeColor::PINK() => Ids::PINK_CANDLE_CAKE,
|
||||
DyeColor::PURPLE() => Ids::PURPLE_CANDLE_CAKE,
|
||||
DyeColor::RED() => Ids::RED_CANDLE_CAKE,
|
||||
DyeColor::WHITE() => Ids::WHITE_CANDLE_CAKE,
|
||||
DyeColor::YELLOW() => Ids::YELLOW_CANDLE_CAKE,
|
||||
default => throw new AssumptionFailedError("Unhandled DyeColor " . $block->getColor()->name())
|
||||
DyeColor::BLACK => Ids::BLACK_CANDLE_CAKE,
|
||||
DyeColor::BLUE => Ids::BLUE_CANDLE_CAKE,
|
||||
DyeColor::BROWN => Ids::BROWN_CANDLE_CAKE,
|
||||
DyeColor::CYAN => Ids::CYAN_CANDLE_CAKE,
|
||||
DyeColor::GRAY => Ids::GRAY_CANDLE_CAKE,
|
||||
DyeColor::GREEN => Ids::GREEN_CANDLE_CAKE,
|
||||
DyeColor::LIGHT_BLUE => Ids::LIGHT_BLUE_CANDLE_CAKE,
|
||||
DyeColor::LIGHT_GRAY => Ids::LIGHT_GRAY_CANDLE_CAKE,
|
||||
DyeColor::LIME => Ids::LIME_CANDLE_CAKE,
|
||||
DyeColor::MAGENTA => Ids::MAGENTA_CANDLE_CAKE,
|
||||
DyeColor::ORANGE => Ids::ORANGE_CANDLE_CAKE,
|
||||
DyeColor::PINK => Ids::PINK_CANDLE_CAKE,
|
||||
DyeColor::PURPLE => Ids::PURPLE_CANDLE_CAKE,
|
||||
DyeColor::RED => Ids::RED_CANDLE_CAKE,
|
||||
DyeColor::WHITE => Ids::WHITE_CANDLE_CAKE,
|
||||
DyeColor::YELLOW => Ids::YELLOW_CANDLE_CAKE,
|
||||
})->writeBool(StateNames::LIT, $block->isLit()));
|
||||
}
|
||||
|
||||
public function registerFlatColorBlockSerializers() : void{
|
||||
$this->map(Blocks::GLAZED_TERRACOTTA(), function(GlazedTerracotta $block) : Writer{
|
||||
return Writer::create(match($color = $block->getColor()){
|
||||
DyeColor::BLACK() => Ids::BLACK_GLAZED_TERRACOTTA,
|
||||
DyeColor::BLUE() => Ids::BLUE_GLAZED_TERRACOTTA,
|
||||
DyeColor::BROWN() => Ids::BROWN_GLAZED_TERRACOTTA,
|
||||
DyeColor::CYAN() => Ids::CYAN_GLAZED_TERRACOTTA,
|
||||
DyeColor::GRAY() => Ids::GRAY_GLAZED_TERRACOTTA,
|
||||
DyeColor::GREEN() => Ids::GREEN_GLAZED_TERRACOTTA,
|
||||
DyeColor::LIGHT_BLUE() => Ids::LIGHT_BLUE_GLAZED_TERRACOTTA,
|
||||
DyeColor::LIGHT_GRAY() => Ids::SILVER_GLAZED_TERRACOTTA,
|
||||
DyeColor::LIME() => Ids::LIME_GLAZED_TERRACOTTA,
|
||||
DyeColor::MAGENTA() => Ids::MAGENTA_GLAZED_TERRACOTTA,
|
||||
DyeColor::ORANGE() => Ids::ORANGE_GLAZED_TERRACOTTA,
|
||||
DyeColor::PINK() => Ids::PINK_GLAZED_TERRACOTTA,
|
||||
DyeColor::PURPLE() => Ids::PURPLE_GLAZED_TERRACOTTA,
|
||||
DyeColor::RED() => Ids::RED_GLAZED_TERRACOTTA,
|
||||
DyeColor::WHITE() => Ids::WHITE_GLAZED_TERRACOTTA,
|
||||
DyeColor::YELLOW() => Ids::YELLOW_GLAZED_TERRACOTTA,
|
||||
default => throw new AssumptionFailedError("Unhandled dye colour " . $color->name())
|
||||
return Writer::create(match($block->getColor()){
|
||||
DyeColor::BLACK => Ids::BLACK_GLAZED_TERRACOTTA,
|
||||
DyeColor::BLUE => Ids::BLUE_GLAZED_TERRACOTTA,
|
||||
DyeColor::BROWN => Ids::BROWN_GLAZED_TERRACOTTA,
|
||||
DyeColor::CYAN => Ids::CYAN_GLAZED_TERRACOTTA,
|
||||
DyeColor::GRAY => Ids::GRAY_GLAZED_TERRACOTTA,
|
||||
DyeColor::GREEN => Ids::GREEN_GLAZED_TERRACOTTA,
|
||||
DyeColor::LIGHT_BLUE => Ids::LIGHT_BLUE_GLAZED_TERRACOTTA,
|
||||
DyeColor::LIGHT_GRAY => Ids::SILVER_GLAZED_TERRACOTTA,
|
||||
DyeColor::LIME => Ids::LIME_GLAZED_TERRACOTTA,
|
||||
DyeColor::MAGENTA => Ids::MAGENTA_GLAZED_TERRACOTTA,
|
||||
DyeColor::ORANGE => Ids::ORANGE_GLAZED_TERRACOTTA,
|
||||
DyeColor::PINK => Ids::PINK_GLAZED_TERRACOTTA,
|
||||
DyeColor::PURPLE => Ids::PURPLE_GLAZED_TERRACOTTA,
|
||||
DyeColor::RED => Ids::RED_GLAZED_TERRACOTTA,
|
||||
DyeColor::WHITE => Ids::WHITE_GLAZED_TERRACOTTA,
|
||||
DyeColor::YELLOW => Ids::YELLOW_GLAZED_TERRACOTTA,
|
||||
})
|
||||
->writeHorizontalFacing($block->getFacing());
|
||||
});
|
||||
|
||||
$this->map(Blocks::WOOL(), fn(Wool $block) => Writer::create(match($color = $block->getColor()){
|
||||
DyeColor::BLACK() => Ids::BLACK_WOOL,
|
||||
DyeColor::BLUE() => Ids::BLUE_WOOL,
|
||||
DyeColor::BROWN() => Ids::BROWN_WOOL,
|
||||
DyeColor::CYAN() => Ids::CYAN_WOOL,
|
||||
DyeColor::GRAY() => Ids::GRAY_WOOL,
|
||||
DyeColor::GREEN() => Ids::GREEN_WOOL,
|
||||
DyeColor::LIGHT_BLUE() => Ids::LIGHT_BLUE_WOOL,
|
||||
DyeColor::LIGHT_GRAY() => Ids::LIGHT_GRAY_WOOL,
|
||||
DyeColor::LIME() => Ids::LIME_WOOL,
|
||||
DyeColor::MAGENTA() => Ids::MAGENTA_WOOL,
|
||||
DyeColor::ORANGE() => Ids::ORANGE_WOOL,
|
||||
DyeColor::PINK() => Ids::PINK_WOOL,
|
||||
DyeColor::PURPLE() => Ids::PURPLE_WOOL,
|
||||
DyeColor::RED() => Ids::RED_WOOL,
|
||||
DyeColor::WHITE() => Ids::WHITE_WOOL,
|
||||
DyeColor::YELLOW() => Ids::YELLOW_WOOL,
|
||||
default => throw new AssumptionFailedError("Unhandled dye colour " . $color->name())
|
||||
$this->map(Blocks::WOOL(), fn(Wool $block) => Writer::create(match($block->getColor()){
|
||||
DyeColor::BLACK => Ids::BLACK_WOOL,
|
||||
DyeColor::BLUE => Ids::BLUE_WOOL,
|
||||
DyeColor::BROWN => Ids::BROWN_WOOL,
|
||||
DyeColor::CYAN => Ids::CYAN_WOOL,
|
||||
DyeColor::GRAY => Ids::GRAY_WOOL,
|
||||
DyeColor::GREEN => Ids::GREEN_WOOL,
|
||||
DyeColor::LIGHT_BLUE => Ids::LIGHT_BLUE_WOOL,
|
||||
DyeColor::LIGHT_GRAY => Ids::LIGHT_GRAY_WOOL,
|
||||
DyeColor::LIME => Ids::LIME_WOOL,
|
||||
DyeColor::MAGENTA => Ids::MAGENTA_WOOL,
|
||||
DyeColor::ORANGE => Ids::ORANGE_WOOL,
|
||||
DyeColor::PINK => Ids::PINK_WOOL,
|
||||
DyeColor::PURPLE => Ids::PURPLE_WOOL,
|
||||
DyeColor::RED => Ids::RED_WOOL,
|
||||
DyeColor::WHITE => Ids::WHITE_WOOL,
|
||||
DyeColor::YELLOW => Ids::YELLOW_WOOL,
|
||||
}));
|
||||
|
||||
$this->map(Blocks::CARPET(), fn(Carpet $block) => Writer::create(match($color = $block->getColor()){
|
||||
DyeColor::BLACK() => Ids::BLACK_CARPET,
|
||||
DyeColor::BLUE() => Ids::BLUE_CARPET,
|
||||
DyeColor::BROWN() => Ids::BROWN_CARPET,
|
||||
DyeColor::CYAN() => Ids::CYAN_CARPET,
|
||||
DyeColor::GRAY() => Ids::GRAY_CARPET,
|
||||
DyeColor::GREEN() => Ids::GREEN_CARPET,
|
||||
DyeColor::LIGHT_BLUE() => Ids::LIGHT_BLUE_CARPET,
|
||||
DyeColor::LIGHT_GRAY() => Ids::LIGHT_GRAY_CARPET,
|
||||
DyeColor::LIME() => Ids::LIME_CARPET,
|
||||
DyeColor::MAGENTA() => Ids::MAGENTA_CARPET,
|
||||
DyeColor::ORANGE() => Ids::ORANGE_CARPET,
|
||||
DyeColor::PINK() => Ids::PINK_CARPET,
|
||||
DyeColor::PURPLE() => Ids::PURPLE_CARPET,
|
||||
DyeColor::RED() => Ids::RED_CARPET,
|
||||
DyeColor::WHITE() => Ids::WHITE_CARPET,
|
||||
DyeColor::YELLOW() => Ids::YELLOW_CARPET,
|
||||
default => throw new AssumptionFailedError("Unhandled dye colour " . $color->name())
|
||||
$this->map(Blocks::CARPET(), fn(Carpet $block) => Writer::create(match($block->getColor()){
|
||||
DyeColor::BLACK => Ids::BLACK_CARPET,
|
||||
DyeColor::BLUE => Ids::BLUE_CARPET,
|
||||
DyeColor::BROWN => Ids::BROWN_CARPET,
|
||||
DyeColor::CYAN => Ids::CYAN_CARPET,
|
||||
DyeColor::GRAY => Ids::GRAY_CARPET,
|
||||
DyeColor::GREEN => Ids::GREEN_CARPET,
|
||||
DyeColor::LIGHT_BLUE => Ids::LIGHT_BLUE_CARPET,
|
||||
DyeColor::LIGHT_GRAY => Ids::LIGHT_GRAY_CARPET,
|
||||
DyeColor::LIME => Ids::LIME_CARPET,
|
||||
DyeColor::MAGENTA => Ids::MAGENTA_CARPET,
|
||||
DyeColor::ORANGE => Ids::ORANGE_CARPET,
|
||||
DyeColor::PINK => Ids::PINK_CARPET,
|
||||
DyeColor::PURPLE => Ids::PURPLE_CARPET,
|
||||
DyeColor::RED => Ids::RED_CARPET,
|
||||
DyeColor::WHITE => Ids::WHITE_CARPET,
|
||||
DyeColor::YELLOW => Ids::YELLOW_CARPET,
|
||||
}));
|
||||
|
||||
$this->map(Blocks::DYED_SHULKER_BOX(), fn(DyedShulkerBox $block) => Writer::create(match($color = $block->getColor()){
|
||||
DyeColor::BLACK() => Ids::BLACK_SHULKER_BOX,
|
||||
DyeColor::BLUE() => Ids::BLUE_SHULKER_BOX,
|
||||
DyeColor::BROWN() => Ids::BROWN_SHULKER_BOX,
|
||||
DyeColor::CYAN() => Ids::CYAN_SHULKER_BOX,
|
||||
DyeColor::GRAY() => Ids::GRAY_SHULKER_BOX,
|
||||
DyeColor::GREEN() => Ids::GREEN_SHULKER_BOX,
|
||||
DyeColor::LIGHT_BLUE() => Ids::LIGHT_BLUE_SHULKER_BOX,
|
||||
DyeColor::LIGHT_GRAY() => Ids::LIGHT_GRAY_SHULKER_BOX,
|
||||
DyeColor::LIME() => Ids::LIME_SHULKER_BOX,
|
||||
DyeColor::MAGENTA() => Ids::MAGENTA_SHULKER_BOX,
|
||||
DyeColor::ORANGE() => Ids::ORANGE_SHULKER_BOX,
|
||||
DyeColor::PINK() => Ids::PINK_SHULKER_BOX,
|
||||
DyeColor::PURPLE() => Ids::PURPLE_SHULKER_BOX,
|
||||
DyeColor::RED() => Ids::RED_SHULKER_BOX,
|
||||
DyeColor::WHITE() => Ids::WHITE_SHULKER_BOX,
|
||||
DyeColor::YELLOW() => Ids::YELLOW_SHULKER_BOX,
|
||||
default => throw new AssumptionFailedError("Unhandled dye colour " . $color->name())
|
||||
$this->map(Blocks::DYED_SHULKER_BOX(), fn(DyedShulkerBox $block) => Writer::create(match($block->getColor()){
|
||||
DyeColor::BLACK => Ids::BLACK_SHULKER_BOX,
|
||||
DyeColor::BLUE => Ids::BLUE_SHULKER_BOX,
|
||||
DyeColor::BROWN => Ids::BROWN_SHULKER_BOX,
|
||||
DyeColor::CYAN => Ids::CYAN_SHULKER_BOX,
|
||||
DyeColor::GRAY => Ids::GRAY_SHULKER_BOX,
|
||||
DyeColor::GREEN => Ids::GREEN_SHULKER_BOX,
|
||||
DyeColor::LIGHT_BLUE => Ids::LIGHT_BLUE_SHULKER_BOX,
|
||||
DyeColor::LIGHT_GRAY => Ids::LIGHT_GRAY_SHULKER_BOX,
|
||||
DyeColor::LIME => Ids::LIME_SHULKER_BOX,
|
||||
DyeColor::MAGENTA => Ids::MAGENTA_SHULKER_BOX,
|
||||
DyeColor::ORANGE => Ids::ORANGE_SHULKER_BOX,
|
||||
DyeColor::PINK => Ids::PINK_SHULKER_BOX,
|
||||
DyeColor::PURPLE => Ids::PURPLE_SHULKER_BOX,
|
||||
DyeColor::RED => Ids::RED_SHULKER_BOX,
|
||||
DyeColor::WHITE => Ids::WHITE_SHULKER_BOX,
|
||||
DyeColor::YELLOW => Ids::YELLOW_SHULKER_BOX,
|
||||
}));
|
||||
|
||||
$this->map(Blocks::CONCRETE(), fn(Concrete $block) => Writer::create(match($color = $block->getColor()){
|
||||
DyeColor::BLACK() => Ids::BLACK_CONCRETE,
|
||||
DyeColor::BLUE() => Ids::BLUE_CONCRETE,
|
||||
DyeColor::BROWN() => Ids::BROWN_CONCRETE,
|
||||
DyeColor::CYAN() => Ids::CYAN_CONCRETE,
|
||||
DyeColor::GRAY() => Ids::GRAY_CONCRETE,
|
||||
DyeColor::GREEN() => Ids::GREEN_CONCRETE,
|
||||
DyeColor::LIGHT_BLUE() => Ids::LIGHT_BLUE_CONCRETE,
|
||||
DyeColor::LIGHT_GRAY() => Ids::LIGHT_GRAY_CONCRETE,
|
||||
DyeColor::LIME() => Ids::LIME_CONCRETE,
|
||||
DyeColor::MAGENTA() => Ids::MAGENTA_CONCRETE,
|
||||
DyeColor::ORANGE() => Ids::ORANGE_CONCRETE,
|
||||
DyeColor::PINK() => Ids::PINK_CONCRETE,
|
||||
DyeColor::PURPLE() => Ids::PURPLE_CONCRETE,
|
||||
DyeColor::RED() => Ids::RED_CONCRETE,
|
||||
DyeColor::WHITE() => Ids::WHITE_CONCRETE,
|
||||
DyeColor::YELLOW() => Ids::YELLOW_CONCRETE,
|
||||
default => throw new AssumptionFailedError("Unhandled dye colour " . $color->name())
|
||||
$this->map(Blocks::CONCRETE(), fn(Concrete $block) => Writer::create(match($block->getColor()){
|
||||
DyeColor::BLACK => Ids::BLACK_CONCRETE,
|
||||
DyeColor::BLUE => Ids::BLUE_CONCRETE,
|
||||
DyeColor::BROWN => Ids::BROWN_CONCRETE,
|
||||
DyeColor::CYAN => Ids::CYAN_CONCRETE,
|
||||
DyeColor::GRAY => Ids::GRAY_CONCRETE,
|
||||
DyeColor::GREEN => Ids::GREEN_CONCRETE,
|
||||
DyeColor::LIGHT_BLUE => Ids::LIGHT_BLUE_CONCRETE,
|
||||
DyeColor::LIGHT_GRAY => Ids::LIGHT_GRAY_CONCRETE,
|
||||
DyeColor::LIME => Ids::LIME_CONCRETE,
|
||||
DyeColor::MAGENTA => Ids::MAGENTA_CONCRETE,
|
||||
DyeColor::ORANGE => Ids::ORANGE_CONCRETE,
|
||||
DyeColor::PINK => Ids::PINK_CONCRETE,
|
||||
DyeColor::PURPLE => Ids::PURPLE_CONCRETE,
|
||||
DyeColor::RED => Ids::RED_CONCRETE,
|
||||
DyeColor::WHITE => Ids::WHITE_CONCRETE,
|
||||
DyeColor::YELLOW => Ids::YELLOW_CONCRETE,
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -227,22 +227,22 @@ final class BlockStateReader{
|
||||
public function readColor() : DyeColor{
|
||||
// * color (StringTag) = black, blue, brown, cyan, gray, green, light_blue, lime, magenta, orange, pink, purple, red, silver, white, yellow
|
||||
return match($color = $this->readString(BlockStateNames::COLOR)){
|
||||
StringValues::COLOR_BLACK => DyeColor::BLACK(),
|
||||
StringValues::COLOR_BLUE => DyeColor::BLUE(),
|
||||
StringValues::COLOR_BROWN => DyeColor::BROWN(),
|
||||
StringValues::COLOR_CYAN => DyeColor::CYAN(),
|
||||
StringValues::COLOR_GRAY => DyeColor::GRAY(),
|
||||
StringValues::COLOR_GREEN => DyeColor::GREEN(),
|
||||
StringValues::COLOR_LIGHT_BLUE => DyeColor::LIGHT_BLUE(),
|
||||
StringValues::COLOR_LIME => DyeColor::LIME(),
|
||||
StringValues::COLOR_MAGENTA => DyeColor::MAGENTA(),
|
||||
StringValues::COLOR_ORANGE => DyeColor::ORANGE(),
|
||||
StringValues::COLOR_PINK => DyeColor::PINK(),
|
||||
StringValues::COLOR_PURPLE => DyeColor::PURPLE(),
|
||||
StringValues::COLOR_RED => DyeColor::RED(),
|
||||
StringValues::COLOR_SILVER => DyeColor::LIGHT_GRAY(),
|
||||
StringValues::COLOR_WHITE => DyeColor::WHITE(),
|
||||
StringValues::COLOR_YELLOW => DyeColor::YELLOW(),
|
||||
StringValues::COLOR_BLACK => DyeColor::BLACK,
|
||||
StringValues::COLOR_BLUE => DyeColor::BLUE,
|
||||
StringValues::COLOR_BROWN => DyeColor::BROWN,
|
||||
StringValues::COLOR_CYAN => DyeColor::CYAN,
|
||||
StringValues::COLOR_GRAY => DyeColor::GRAY,
|
||||
StringValues::COLOR_GREEN => DyeColor::GREEN,
|
||||
StringValues::COLOR_LIGHT_BLUE => DyeColor::LIGHT_BLUE,
|
||||
StringValues::COLOR_LIME => DyeColor::LIME,
|
||||
StringValues::COLOR_MAGENTA => DyeColor::MAGENTA,
|
||||
StringValues::COLOR_ORANGE => DyeColor::ORANGE,
|
||||
StringValues::COLOR_PINK => DyeColor::PINK,
|
||||
StringValues::COLOR_PURPLE => DyeColor::PURPLE,
|
||||
StringValues::COLOR_RED => DyeColor::RED,
|
||||
StringValues::COLOR_SILVER => DyeColor::LIGHT_GRAY,
|
||||
StringValues::COLOR_WHITE => DyeColor::WHITE,
|
||||
StringValues::COLOR_YELLOW => DyeColor::YELLOW,
|
||||
default => throw $this->badValueException(BlockStateNames::COLOR, $color),
|
||||
};
|
||||
}
|
||||
|
@ -134,44 +134,44 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{
|
||||
private function registerCandleDeserializers() : void{
|
||||
$this->map(Ids::CANDLE, fn(Reader $in) => Helper::decodeCandle(Blocks::CANDLE(), $in));
|
||||
foreach([
|
||||
Ids::BLACK_CANDLE => DyeColor::BLACK(),
|
||||
Ids::BLUE_CANDLE => DyeColor::BLUE(),
|
||||
Ids::BROWN_CANDLE => DyeColor::BROWN(),
|
||||
Ids::CYAN_CANDLE => DyeColor::CYAN(),
|
||||
Ids::GRAY_CANDLE => DyeColor::GRAY(),
|
||||
Ids::GREEN_CANDLE => DyeColor::GREEN(),
|
||||
Ids::LIGHT_BLUE_CANDLE => DyeColor::LIGHT_BLUE(),
|
||||
Ids::LIGHT_GRAY_CANDLE => DyeColor::LIGHT_GRAY(),
|
||||
Ids::LIME_CANDLE => DyeColor::LIME(),
|
||||
Ids::MAGENTA_CANDLE => DyeColor::MAGENTA(),
|
||||
Ids::ORANGE_CANDLE => DyeColor::ORANGE(),
|
||||
Ids::PINK_CANDLE => DyeColor::PINK(),
|
||||
Ids::PURPLE_CANDLE => DyeColor::PURPLE(),
|
||||
Ids::RED_CANDLE => DyeColor::RED(),
|
||||
Ids::WHITE_CANDLE => DyeColor::WHITE(),
|
||||
Ids::YELLOW_CANDLE => DyeColor::YELLOW(),
|
||||
Ids::BLACK_CANDLE => DyeColor::BLACK,
|
||||
Ids::BLUE_CANDLE => DyeColor::BLUE,
|
||||
Ids::BROWN_CANDLE => DyeColor::BROWN,
|
||||
Ids::CYAN_CANDLE => DyeColor::CYAN,
|
||||
Ids::GRAY_CANDLE => DyeColor::GRAY,
|
||||
Ids::GREEN_CANDLE => DyeColor::GREEN,
|
||||
Ids::LIGHT_BLUE_CANDLE => DyeColor::LIGHT_BLUE,
|
||||
Ids::LIGHT_GRAY_CANDLE => DyeColor::LIGHT_GRAY,
|
||||
Ids::LIME_CANDLE => DyeColor::LIME,
|
||||
Ids::MAGENTA_CANDLE => DyeColor::MAGENTA,
|
||||
Ids::ORANGE_CANDLE => DyeColor::ORANGE,
|
||||
Ids::PINK_CANDLE => DyeColor::PINK,
|
||||
Ids::PURPLE_CANDLE => DyeColor::PURPLE,
|
||||
Ids::RED_CANDLE => DyeColor::RED,
|
||||
Ids::WHITE_CANDLE => DyeColor::WHITE,
|
||||
Ids::YELLOW_CANDLE => DyeColor::YELLOW,
|
||||
] as $id => $color){
|
||||
$this->map($id, fn(Reader $in) => Helper::decodeCandle(Blocks::DYED_CANDLE()->setColor($color), $in));
|
||||
}
|
||||
|
||||
$this->map(Ids::CANDLE_CAKE, fn(Reader $in) => Blocks::CAKE_WITH_CANDLE()->setLit($in->readBool(StateNames::LIT)));
|
||||
foreach([
|
||||
Ids::BLACK_CANDLE_CAKE => DyeColor::BLACK(),
|
||||
Ids::BLUE_CANDLE_CAKE => DyeColor::BLUE(),
|
||||
Ids::BROWN_CANDLE_CAKE => DyeColor::BROWN(),
|
||||
Ids::CYAN_CANDLE_CAKE => DyeColor::CYAN(),
|
||||
Ids::GRAY_CANDLE_CAKE => DyeColor::GRAY(),
|
||||
Ids::GREEN_CANDLE_CAKE => DyeColor::GREEN(),
|
||||
Ids::LIGHT_BLUE_CANDLE_CAKE => DyeColor::LIGHT_BLUE(),
|
||||
Ids::LIGHT_GRAY_CANDLE_CAKE => DyeColor::LIGHT_GRAY(),
|
||||
Ids::LIME_CANDLE_CAKE => DyeColor::LIME(),
|
||||
Ids::MAGENTA_CANDLE_CAKE => DyeColor::MAGENTA(),
|
||||
Ids::ORANGE_CANDLE_CAKE => DyeColor::ORANGE(),
|
||||
Ids::PINK_CANDLE_CAKE => DyeColor::PINK(),
|
||||
Ids::PURPLE_CANDLE_CAKE => DyeColor::PURPLE(),
|
||||
Ids::RED_CANDLE_CAKE => DyeColor::RED(),
|
||||
Ids::WHITE_CANDLE_CAKE => DyeColor::WHITE(),
|
||||
Ids::YELLOW_CANDLE_CAKE => DyeColor::YELLOW(),
|
||||
Ids::BLACK_CANDLE_CAKE => DyeColor::BLACK,
|
||||
Ids::BLUE_CANDLE_CAKE => DyeColor::BLUE,
|
||||
Ids::BROWN_CANDLE_CAKE => DyeColor::BROWN,
|
||||
Ids::CYAN_CANDLE_CAKE => DyeColor::CYAN,
|
||||
Ids::GRAY_CANDLE_CAKE => DyeColor::GRAY,
|
||||
Ids::GREEN_CANDLE_CAKE => DyeColor::GREEN,
|
||||
Ids::LIGHT_BLUE_CANDLE_CAKE => DyeColor::LIGHT_BLUE,
|
||||
Ids::LIGHT_GRAY_CANDLE_CAKE => DyeColor::LIGHT_GRAY,
|
||||
Ids::LIME_CANDLE_CAKE => DyeColor::LIME,
|
||||
Ids::MAGENTA_CANDLE_CAKE => DyeColor::MAGENTA,
|
||||
Ids::ORANGE_CANDLE_CAKE => DyeColor::ORANGE,
|
||||
Ids::PINK_CANDLE_CAKE => DyeColor::PINK,
|
||||
Ids::PURPLE_CANDLE_CAKE => DyeColor::PURPLE,
|
||||
Ids::RED_CANDLE_CAKE => DyeColor::RED,
|
||||
Ids::WHITE_CANDLE_CAKE => DyeColor::WHITE,
|
||||
Ids::YELLOW_CANDLE_CAKE => DyeColor::YELLOW,
|
||||
] as $id => $color){
|
||||
$this->map($id, fn(Reader $in) => Blocks::CAKE_WITH_DYED_CANDLE()
|
||||
->setColor($color)
|
||||
@ -182,22 +182,22 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{
|
||||
|
||||
private function registerFlatColorBlockDeserializers() : void{
|
||||
foreach([
|
||||
Ids::BLACK_GLAZED_TERRACOTTA => DyeColor::BLACK(),
|
||||
Ids::BLUE_GLAZED_TERRACOTTA => DyeColor::BLUE(),
|
||||
Ids::BROWN_GLAZED_TERRACOTTA => DyeColor::BROWN(),
|
||||
Ids::CYAN_GLAZED_TERRACOTTA => DyeColor::CYAN(),
|
||||
Ids::GRAY_GLAZED_TERRACOTTA => DyeColor::GRAY(),
|
||||
Ids::GREEN_GLAZED_TERRACOTTA => DyeColor::GREEN(),
|
||||
Ids::LIGHT_BLUE_GLAZED_TERRACOTTA => DyeColor::LIGHT_BLUE(),
|
||||
Ids::SILVER_GLAZED_TERRACOTTA => DyeColor::LIGHT_GRAY(),
|
||||
Ids::LIME_GLAZED_TERRACOTTA => DyeColor::LIME(),
|
||||
Ids::MAGENTA_GLAZED_TERRACOTTA => DyeColor::MAGENTA(),
|
||||
Ids::ORANGE_GLAZED_TERRACOTTA => DyeColor::ORANGE(),
|
||||
Ids::PINK_GLAZED_TERRACOTTA => DyeColor::PINK(),
|
||||
Ids::PURPLE_GLAZED_TERRACOTTA => DyeColor::PURPLE(),
|
||||
Ids::RED_GLAZED_TERRACOTTA => DyeColor::RED(),
|
||||
Ids::WHITE_GLAZED_TERRACOTTA => DyeColor::WHITE(),
|
||||
Ids::YELLOW_GLAZED_TERRACOTTA => DyeColor::YELLOW(),
|
||||
Ids::BLACK_GLAZED_TERRACOTTA => DyeColor::BLACK,
|
||||
Ids::BLUE_GLAZED_TERRACOTTA => DyeColor::BLUE,
|
||||
Ids::BROWN_GLAZED_TERRACOTTA => DyeColor::BROWN,
|
||||
Ids::CYAN_GLAZED_TERRACOTTA => DyeColor::CYAN,
|
||||
Ids::GRAY_GLAZED_TERRACOTTA => DyeColor::GRAY,
|
||||
Ids::GREEN_GLAZED_TERRACOTTA => DyeColor::GREEN,
|
||||
Ids::LIGHT_BLUE_GLAZED_TERRACOTTA => DyeColor::LIGHT_BLUE,
|
||||
Ids::SILVER_GLAZED_TERRACOTTA => DyeColor::LIGHT_GRAY,
|
||||
Ids::LIME_GLAZED_TERRACOTTA => DyeColor::LIME,
|
||||
Ids::MAGENTA_GLAZED_TERRACOTTA => DyeColor::MAGENTA,
|
||||
Ids::ORANGE_GLAZED_TERRACOTTA => DyeColor::ORANGE,
|
||||
Ids::PINK_GLAZED_TERRACOTTA => DyeColor::PINK,
|
||||
Ids::PURPLE_GLAZED_TERRACOTTA => DyeColor::PURPLE,
|
||||
Ids::RED_GLAZED_TERRACOTTA => DyeColor::RED,
|
||||
Ids::WHITE_GLAZED_TERRACOTTA => DyeColor::WHITE,
|
||||
Ids::YELLOW_GLAZED_TERRACOTTA => DyeColor::YELLOW,
|
||||
] as $id => $color){
|
||||
$this->map($id, fn(Reader $in) => Blocks::GLAZED_TERRACOTTA()
|
||||
->setColor($color)
|
||||
@ -206,85 +206,85 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{
|
||||
}
|
||||
|
||||
foreach([
|
||||
Ids::BLACK_WOOL => DyeColor::BLACK(),
|
||||
Ids::BLUE_WOOL => DyeColor::BLUE(),
|
||||
Ids::BROWN_WOOL => DyeColor::BROWN(),
|
||||
Ids::CYAN_WOOL => DyeColor::CYAN(),
|
||||
Ids::GRAY_WOOL => DyeColor::GRAY(),
|
||||
Ids::GREEN_WOOL => DyeColor::GREEN(),
|
||||
Ids::LIGHT_BLUE_WOOL => DyeColor::LIGHT_BLUE(),
|
||||
Ids::LIGHT_GRAY_WOOL => DyeColor::LIGHT_GRAY(),
|
||||
Ids::LIME_WOOL => DyeColor::LIME(),
|
||||
Ids::MAGENTA_WOOL => DyeColor::MAGENTA(),
|
||||
Ids::ORANGE_WOOL => DyeColor::ORANGE(),
|
||||
Ids::PINK_WOOL => DyeColor::PINK(),
|
||||
Ids::PURPLE_WOOL => DyeColor::PURPLE(),
|
||||
Ids::RED_WOOL => DyeColor::RED(),
|
||||
Ids::WHITE_WOOL => DyeColor::WHITE(),
|
||||
Ids::YELLOW_WOOL => DyeColor::YELLOW(),
|
||||
Ids::BLACK_WOOL => DyeColor::BLACK,
|
||||
Ids::BLUE_WOOL => DyeColor::BLUE,
|
||||
Ids::BROWN_WOOL => DyeColor::BROWN,
|
||||
Ids::CYAN_WOOL => DyeColor::CYAN,
|
||||
Ids::GRAY_WOOL => DyeColor::GRAY,
|
||||
Ids::GREEN_WOOL => DyeColor::GREEN,
|
||||
Ids::LIGHT_BLUE_WOOL => DyeColor::LIGHT_BLUE,
|
||||
Ids::LIGHT_GRAY_WOOL => DyeColor::LIGHT_GRAY,
|
||||
Ids::LIME_WOOL => DyeColor::LIME,
|
||||
Ids::MAGENTA_WOOL => DyeColor::MAGENTA,
|
||||
Ids::ORANGE_WOOL => DyeColor::ORANGE,
|
||||
Ids::PINK_WOOL => DyeColor::PINK,
|
||||
Ids::PURPLE_WOOL => DyeColor::PURPLE,
|
||||
Ids::RED_WOOL => DyeColor::RED,
|
||||
Ids::WHITE_WOOL => DyeColor::WHITE,
|
||||
Ids::YELLOW_WOOL => DyeColor::YELLOW,
|
||||
] as $id => $color){
|
||||
$this->mapSimple($id, fn() => Blocks::WOOL()->setColor($color));
|
||||
}
|
||||
|
||||
foreach([
|
||||
Ids::BLACK_CARPET => DyeColor::BLACK(),
|
||||
Ids::BLUE_CARPET => DyeColor::BLUE(),
|
||||
Ids::BROWN_CARPET => DyeColor::BROWN(),
|
||||
Ids::CYAN_CARPET => DyeColor::CYAN(),
|
||||
Ids::GRAY_CARPET => DyeColor::GRAY(),
|
||||
Ids::GREEN_CARPET => DyeColor::GREEN(),
|
||||
Ids::LIGHT_BLUE_CARPET => DyeColor::LIGHT_BLUE(),
|
||||
Ids::LIGHT_GRAY_CARPET => DyeColor::LIGHT_GRAY(),
|
||||
Ids::LIME_CARPET => DyeColor::LIME(),
|
||||
Ids::MAGENTA_CARPET => DyeColor::MAGENTA(),
|
||||
Ids::ORANGE_CARPET => DyeColor::ORANGE(),
|
||||
Ids::PINK_CARPET => DyeColor::PINK(),
|
||||
Ids::PURPLE_CARPET => DyeColor::PURPLE(),
|
||||
Ids::RED_CARPET => DyeColor::RED(),
|
||||
Ids::WHITE_CARPET => DyeColor::WHITE(),
|
||||
Ids::YELLOW_CARPET => DyeColor::YELLOW(),
|
||||
Ids::BLACK_CARPET => DyeColor::BLACK,
|
||||
Ids::BLUE_CARPET => DyeColor::BLUE,
|
||||
Ids::BROWN_CARPET => DyeColor::BROWN,
|
||||
Ids::CYAN_CARPET => DyeColor::CYAN,
|
||||
Ids::GRAY_CARPET => DyeColor::GRAY,
|
||||
Ids::GREEN_CARPET => DyeColor::GREEN,
|
||||
Ids::LIGHT_BLUE_CARPET => DyeColor::LIGHT_BLUE,
|
||||
Ids::LIGHT_GRAY_CARPET => DyeColor::LIGHT_GRAY,
|
||||
Ids::LIME_CARPET => DyeColor::LIME,
|
||||
Ids::MAGENTA_CARPET => DyeColor::MAGENTA,
|
||||
Ids::ORANGE_CARPET => DyeColor::ORANGE,
|
||||
Ids::PINK_CARPET => DyeColor::PINK,
|
||||
Ids::PURPLE_CARPET => DyeColor::PURPLE,
|
||||
Ids::RED_CARPET => DyeColor::RED,
|
||||
Ids::WHITE_CARPET => DyeColor::WHITE,
|
||||
Ids::YELLOW_CARPET => DyeColor::YELLOW,
|
||||
] as $id => $color){
|
||||
$this->mapSimple($id, fn() => Blocks::CARPET()->setColor($color));
|
||||
}
|
||||
|
||||
foreach([
|
||||
Ids::BLACK_SHULKER_BOX => DyeColor::BLACK(),
|
||||
Ids::BLUE_SHULKER_BOX => DyeColor::BLUE(),
|
||||
Ids::BROWN_SHULKER_BOX => DyeColor::BROWN(),
|
||||
Ids::CYAN_SHULKER_BOX => DyeColor::CYAN(),
|
||||
Ids::GRAY_SHULKER_BOX => DyeColor::GRAY(),
|
||||
Ids::GREEN_SHULKER_BOX => DyeColor::GREEN(),
|
||||
Ids::LIGHT_BLUE_SHULKER_BOX => DyeColor::LIGHT_BLUE(),
|
||||
Ids::LIGHT_GRAY_SHULKER_BOX => DyeColor::LIGHT_GRAY(),
|
||||
Ids::LIME_SHULKER_BOX => DyeColor::LIME(),
|
||||
Ids::MAGENTA_SHULKER_BOX => DyeColor::MAGENTA(),
|
||||
Ids::ORANGE_SHULKER_BOX => DyeColor::ORANGE(),
|
||||
Ids::PINK_SHULKER_BOX => DyeColor::PINK(),
|
||||
Ids::PURPLE_SHULKER_BOX => DyeColor::PURPLE(),
|
||||
Ids::RED_SHULKER_BOX => DyeColor::RED(),
|
||||
Ids::WHITE_SHULKER_BOX => DyeColor::WHITE(),
|
||||
Ids::YELLOW_SHULKER_BOX => DyeColor::YELLOW(),
|
||||
Ids::BLACK_SHULKER_BOX => DyeColor::BLACK,
|
||||
Ids::BLUE_SHULKER_BOX => DyeColor::BLUE,
|
||||
Ids::BROWN_SHULKER_BOX => DyeColor::BROWN,
|
||||
Ids::CYAN_SHULKER_BOX => DyeColor::CYAN,
|
||||
Ids::GRAY_SHULKER_BOX => DyeColor::GRAY,
|
||||
Ids::GREEN_SHULKER_BOX => DyeColor::GREEN,
|
||||
Ids::LIGHT_BLUE_SHULKER_BOX => DyeColor::LIGHT_BLUE,
|
||||
Ids::LIGHT_GRAY_SHULKER_BOX => DyeColor::LIGHT_GRAY,
|
||||
Ids::LIME_SHULKER_BOX => DyeColor::LIME,
|
||||
Ids::MAGENTA_SHULKER_BOX => DyeColor::MAGENTA,
|
||||
Ids::ORANGE_SHULKER_BOX => DyeColor::ORANGE,
|
||||
Ids::PINK_SHULKER_BOX => DyeColor::PINK,
|
||||
Ids::PURPLE_SHULKER_BOX => DyeColor::PURPLE,
|
||||
Ids::RED_SHULKER_BOX => DyeColor::RED,
|
||||
Ids::WHITE_SHULKER_BOX => DyeColor::WHITE,
|
||||
Ids::YELLOW_SHULKER_BOX => DyeColor::YELLOW,
|
||||
] as $id => $color){
|
||||
$this->mapSimple($id, fn() => Blocks::DYED_SHULKER_BOX()->setColor($color));
|
||||
}
|
||||
|
||||
foreach([
|
||||
Ids::BLACK_CONCRETE => DyeColor::BLACK(),
|
||||
Ids::BLUE_CONCRETE => DyeColor::BLUE(),
|
||||
Ids::BROWN_CONCRETE => DyeColor::BROWN(),
|
||||
Ids::CYAN_CONCRETE => DyeColor::CYAN(),
|
||||
Ids::GRAY_CONCRETE => DyeColor::GRAY(),
|
||||
Ids::GREEN_CONCRETE => DyeColor::GREEN(),
|
||||
Ids::LIGHT_BLUE_CONCRETE => DyeColor::LIGHT_BLUE(),
|
||||
Ids::LIGHT_GRAY_CONCRETE => DyeColor::LIGHT_GRAY(),
|
||||
Ids::LIME_CONCRETE => DyeColor::LIME(),
|
||||
Ids::MAGENTA_CONCRETE => DyeColor::MAGENTA(),
|
||||
Ids::ORANGE_CONCRETE => DyeColor::ORANGE(),
|
||||
Ids::PINK_CONCRETE => DyeColor::PINK(),
|
||||
Ids::PURPLE_CONCRETE => DyeColor::PURPLE(),
|
||||
Ids::RED_CONCRETE => DyeColor::RED(),
|
||||
Ids::WHITE_CONCRETE => DyeColor::WHITE(),
|
||||
Ids::YELLOW_CONCRETE => DyeColor::YELLOW(),
|
||||
Ids::BLACK_CONCRETE => DyeColor::BLACK,
|
||||
Ids::BLUE_CONCRETE => DyeColor::BLUE,
|
||||
Ids::BROWN_CONCRETE => DyeColor::BROWN,
|
||||
Ids::CYAN_CONCRETE => DyeColor::CYAN,
|
||||
Ids::GRAY_CONCRETE => DyeColor::GRAY,
|
||||
Ids::GREEN_CONCRETE => DyeColor::GREEN,
|
||||
Ids::LIGHT_BLUE_CONCRETE => DyeColor::LIGHT_BLUE,
|
||||
Ids::LIGHT_GRAY_CONCRETE => DyeColor::LIGHT_GRAY,
|
||||
Ids::LIME_CONCRETE => DyeColor::LIME,
|
||||
Ids::MAGENTA_CONCRETE => DyeColor::MAGENTA,
|
||||
Ids::ORANGE_CONCRETE => DyeColor::ORANGE,
|
||||
Ids::PINK_CONCRETE => DyeColor::PINK,
|
||||
Ids::PURPLE_CONCRETE => DyeColor::PURPLE,
|
||||
Ids::RED_CONCRETE => DyeColor::RED,
|
||||
Ids::WHITE_CONCRETE => DyeColor::WHITE,
|
||||
Ids::YELLOW_CONCRETE => DyeColor::YELLOW,
|
||||
] as $id => $color){
|
||||
$this->mapSimple($id, fn() => Blocks::CONCRETE()->setColor($color));
|
||||
}
|
||||
|
@ -181,24 +181,23 @@ final class BlockStateWriter{
|
||||
|
||||
/** @return $this */
|
||||
public function writeColor(DyeColor $color) : self{
|
||||
$this->writeString(BlockStateNames::COLOR, match($color->id()){
|
||||
DyeColor::BLACK()->id() => StringValues::COLOR_BLACK,
|
||||
DyeColor::BLUE()->id() => StringValues::COLOR_BLUE,
|
||||
DyeColor::BROWN()->id() => StringValues::COLOR_BROWN,
|
||||
DyeColor::CYAN()->id() => StringValues::COLOR_CYAN,
|
||||
DyeColor::GRAY()->id() => StringValues::COLOR_GRAY,
|
||||
DyeColor::GREEN()->id() => StringValues::COLOR_GREEN,
|
||||
DyeColor::LIGHT_BLUE()->id() => StringValues::COLOR_LIGHT_BLUE,
|
||||
DyeColor::LIGHT_GRAY()->id() => StringValues::COLOR_SILVER,
|
||||
DyeColor::LIME()->id() => StringValues::COLOR_LIME,
|
||||
DyeColor::MAGENTA()->id() => StringValues::COLOR_MAGENTA,
|
||||
DyeColor::ORANGE()->id() => StringValues::COLOR_ORANGE,
|
||||
DyeColor::PINK()->id() => StringValues::COLOR_PINK,
|
||||
DyeColor::PURPLE()->id() => StringValues::COLOR_PURPLE,
|
||||
DyeColor::RED()->id() => StringValues::COLOR_RED,
|
||||
DyeColor::WHITE()->id() => StringValues::COLOR_WHITE,
|
||||
DyeColor::YELLOW()->id() => StringValues::COLOR_YELLOW,
|
||||
default => throw new BlockStateSerializeException("Invalid Color " . $color->name())
|
||||
$this->writeString(BlockStateNames::COLOR, match($color){
|
||||
DyeColor::BLACK => StringValues::COLOR_BLACK,
|
||||
DyeColor::BLUE => StringValues::COLOR_BLUE,
|
||||
DyeColor::BROWN => StringValues::COLOR_BROWN,
|
||||
DyeColor::CYAN => StringValues::COLOR_CYAN,
|
||||
DyeColor::GRAY => StringValues::COLOR_GRAY,
|
||||
DyeColor::GREEN => StringValues::COLOR_GREEN,
|
||||
DyeColor::LIGHT_BLUE => StringValues::COLOR_LIGHT_BLUE,
|
||||
DyeColor::LIGHT_GRAY => StringValues::COLOR_SILVER,
|
||||
DyeColor::LIME => StringValues::COLOR_LIME,
|
||||
DyeColor::MAGENTA => StringValues::COLOR_MAGENTA,
|
||||
DyeColor::ORANGE => StringValues::COLOR_ORANGE,
|
||||
DyeColor::PINK => StringValues::COLOR_PINK,
|
||||
DyeColor::PURPLE => StringValues::COLOR_PURPLE,
|
||||
DyeColor::RED => StringValues::COLOR_RED,
|
||||
DyeColor::WHITE => StringValues::COLOR_WHITE,
|
||||
DyeColor::YELLOW => StringValues::COLOR_YELLOW,
|
||||
});
|
||||
return $this;
|
||||
}
|
||||
|
@ -510,7 +510,7 @@ final class ItemSerializerDeserializerRegistrar{
|
||||
* complex to implement in a generic way.
|
||||
*/
|
||||
private function registerMiscItemMappings() : void{
|
||||
foreach(DyeColor::getAll() as $color){
|
||||
foreach(DyeColor::cases() as $color){
|
||||
$id = DyeColorIdMap::getInstance()->toItemId($color);
|
||||
$this->deserializer?->map($id, fn() => Items::DYE()->setColor($color));
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ class SplashPotion extends Throwable{
|
||||
}else{
|
||||
//TODO: lingering potions
|
||||
}
|
||||
}elseif($event instanceof ProjectileHitBlockEvent && $this->getPotionType()->equals(PotionType::WATER())){
|
||||
}elseif($event instanceof ProjectileHitBlockEvent && $this->getPotionType() === PotionType::WATER){
|
||||
$blockIn = $event->getBlockHit()->getSide($event->getRayTraceResult()->getHitFace());
|
||||
|
||||
if($blockIn->hasTypeTag(BlockTypeTags::FIRE)){
|
||||
|
@ -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{
|
||||
|
@ -352,11 +352,10 @@ class InventoryManager{
|
||||
$blockPosition = BlockPosition::fromVector3($inv->getHolder());
|
||||
$windowType = match(true){
|
||||
$inv instanceof LoomInventory => WindowTypes::LOOM,
|
||||
$inv instanceof FurnaceInventory => match($inv->getFurnaceType()->id()){
|
||||
FurnaceType::FURNACE()->id() => WindowTypes::FURNACE,
|
||||
FurnaceType::BLAST_FURNACE()->id() => WindowTypes::BLAST_FURNACE,
|
||||
FurnaceType::SMOKER()->id() => WindowTypes::SMOKER,
|
||||
default => throw new AssumptionFailedError("Unreachable")
|
||||
$inv instanceof FurnaceInventory => match($inv->getFurnaceType()){
|
||||
FurnaceType::FURNACE => WindowTypes::FURNACE,
|
||||
FurnaceType::BLAST_FURNACE => WindowTypes::BLAST_FURNACE,
|
||||
FurnaceType::SMOKER => WindowTypes::SMOKER,
|
||||
},
|
||||
$inv instanceof EnchantInventory => WindowTypes::ENCHANTMENT,
|
||||
$inv instanceof BrewingStandInventory => WindowTypes::BREWING_STAND,
|
||||
|
11
src/network/mcpe/cache/CraftingDataCache.php
vendored
11
src/network/mcpe/cache/CraftingDataCache.php
vendored
@ -120,12 +120,11 @@ final class CraftingDataCache{
|
||||
}
|
||||
}
|
||||
|
||||
foreach(FurnaceType::getAll() as $furnaceType){
|
||||
$typeTag = match($furnaceType->id()){
|
||||
FurnaceType::FURNACE()->id() => FurnaceRecipeBlockName::FURNACE,
|
||||
FurnaceType::BLAST_FURNACE()->id() => FurnaceRecipeBlockName::BLAST_FURNACE,
|
||||
FurnaceType::SMOKER()->id() => FurnaceRecipeBlockName::SMOKER,
|
||||
default => throw new AssumptionFailedError("Unreachable"),
|
||||
foreach(FurnaceType::cases() as $furnaceType){
|
||||
$typeTag = match($furnaceType){
|
||||
FurnaceType::FURNACE => FurnaceRecipeBlockName::FURNACE,
|
||||
FurnaceType::BLAST_FURNACE => FurnaceRecipeBlockName::BLAST_FURNACE,
|
||||
FurnaceType::SMOKER => FurnaceRecipeBlockName::SMOKER,
|
||||
};
|
||||
foreach($manager->getFurnaceRecipeManager($furnaceType)->getAll() as $recipe){
|
||||
$input = $converter->coreRecipeIngredientToNet($recipe->getInput())->getDescriptor();
|
||||
|
Loading…
x
Reference in New Issue
Block a user