diff --git a/src/block/Air.php b/src/block/Air.php index ae201328f..8e1104bba 100644 --- a/src/block/Air.php +++ b/src/block/Air.php @@ -30,10 +30,6 @@ use pocketmine\math\AxisAlignedBB; */ class Air extends Transparent{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::indestructible(-1.0)); - } - public function canBeFlowedInto() : bool{ return true; } diff --git a/src/block/Anvil.php b/src/block/Anvil.php index 313e6ef8c..bc84f55d4 100644 --- a/src/block/Anvil.php +++ b/src/block/Anvil.php @@ -29,7 +29,6 @@ use pocketmine\block\utils\Fallable; use pocketmine\block\utils\FallableTrait; use pocketmine\block\utils\HorizontalFacingTrait; use pocketmine\item\Item; -use pocketmine\item\ToolTier; use pocketmine\math\AxisAlignedBB; use pocketmine\math\Facing; use pocketmine\math\Vector3; @@ -43,10 +42,6 @@ class Anvil extends Transparent implements Fallable{ /** @var int */ private $damage = 0; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(5.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 6000.0)); - } - protected function writeStateToMeta() : int{ return BlockDataSerializer::writeLegacyHorizontalFacing($this->facing) | ($this->damage << 2); } diff --git a/src/block/Barrel.php b/src/block/Barrel.php index 2c939c43a..27301cee9 100644 --- a/src/block/Barrel.php +++ b/src/block/Barrel.php @@ -39,10 +39,6 @@ class Barrel extends Opaque{ /** @var bool */ protected $open = false; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(2.5, BlockToolType::AXE)); - } - protected function writeStateToMeta() : int{ return BlockDataSerializer::writeFacing($this->facing) | ($this->open ? BlockLegacyMetadata::BARREL_FLAG_OPEN : 0); } diff --git a/src/block/BaseBanner.php b/src/block/BaseBanner.php index 9c09012c9..e9bf340ec 100644 --- a/src/block/BaseBanner.php +++ b/src/block/BaseBanner.php @@ -49,8 +49,8 @@ abstract class BaseBanner extends Transparent{ */ protected $patterns = []; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(1.0, BlockToolType::AXE)); + public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){ + parent::__construct($idInfo, $name, $breakInfo); $this->baseColor = DyeColor::BLACK(); } diff --git a/src/block/BaseRail.php b/src/block/BaseRail.php index 017a3953b..f78bc98c1 100644 --- a/src/block/BaseRail.php +++ b/src/block/BaseRail.php @@ -74,10 +74,6 @@ abstract class BaseRail extends Flowable{ /** @var int[] */ protected $connections = []; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.7)); - } - protected function writeStateToMeta() : int{ if(count($this->connections) === 0){ return BlockLegacyMetadata::RAIL_STRAIGHT_NORTH_SOUTH; diff --git a/src/block/BaseSign.php b/src/block/BaseSign.php index 3e047c2bd..21de8f6f7 100644 --- a/src/block/BaseSign.php +++ b/src/block/BaseSign.php @@ -45,8 +45,8 @@ abstract class BaseSign extends Transparent{ /** @var int|null */ protected $editorEntityRuntimeId = null; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(1.0, BlockToolType::AXE)); + public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){ + parent::__construct($idInfo, $name, $breakInfo); $this->text = new SignText(); } diff --git a/src/block/Bed.php b/src/block/Bed.php index 958f771dd..6b581759e 100644 --- a/src/block/Bed.php +++ b/src/block/Bed.php @@ -50,8 +50,8 @@ class Bed extends Transparent{ /** @var DyeColor */ protected $color; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.2)); + public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){ + parent::__construct($idInfo, $name, $breakInfo); $this->color = DyeColor::RED(); } diff --git a/src/block/Bedrock.php b/src/block/Bedrock.php index c9429d1a8..7cc9624ec 100644 --- a/src/block/Bedrock.php +++ b/src/block/Bedrock.php @@ -28,10 +28,6 @@ class Bedrock extends Opaque{ /** @var bool */ private $burnsForever = false; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::indestructible()); - } - public function readStateFromData(int $id, int $stateMeta) : void{ $this->burnsForever = ($stateMeta & BlockLegacyMetadata::BEDROCK_FLAG_INFINIBURN) !== 0; } diff --git a/src/block/BlockFactory.php b/src/block/BlockFactory.php index 5554646ad..8dd64ab42 100644 --- a/src/block/BlockFactory.php +++ b/src/block/BlockFactory.php @@ -99,108 +99,125 @@ class BlockFactory{ $this->blocksDirectSkyLight = \SplFixedArray::fromArray(array_fill(0, 16384, false)); $this->blastResistance = \SplFixedArray::fromArray(array_fill(0, 16384, 0.0)); - $this->register(new ActivatorRail(new BID(Ids::ACTIVATOR_RAIL, 0), "Activator Rail")); - $this->register(new Air(new BID(Ids::AIR, 0), "Air")); - $this->register(new Anvil(new BID(Ids::ANVIL, 0), "Anvil")); + $railBreakInfo = new BlockBreakInfo(0.7); + $this->register(new ActivatorRail(new BID(Ids::ACTIVATOR_RAIL, 0), "Activator Rail", $railBreakInfo)); + $this->register(new Air(new BID(Ids::AIR, 0), "Air", BlockBreakInfo::indestructible(-1.0))); + $this->register(new Anvil(new BID(Ids::ANVIL, 0), "Anvil", new BlockBreakInfo(5.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 6000.0))); $this->register(new Bamboo(new BID(Ids::BAMBOO, 0), "Bamboo", new BlockBreakInfo(2.0 /* 1.0 in PC */, BlockToolType::AXE))); $this->register(new BambooSapling(new BID(Ids::BAMBOO_SAPLING, 0), "Bamboo Sapling", BlockBreakInfo::instant())); - $this->register(new FloorBanner(new BID(Ids::STANDING_BANNER, 0, ItemIds::BANNER, TileBanner::class), "Banner")); - $this->register(new WallBanner(new BID(Ids::WALL_BANNER, 0, ItemIds::BANNER, TileBanner::class), "Wall Banner")); - $this->register(new Barrel(new BID(Ids::BARREL, 0, null, TileBarrel::class), "Barrel")); + + $bannerBreakInfo = new BlockBreakInfo(1.0, BlockToolType::AXE); + $this->register(new FloorBanner(new BID(Ids::STANDING_BANNER, 0, ItemIds::BANNER, TileBanner::class), "Banner", $bannerBreakInfo)); + $this->register(new WallBanner(new BID(Ids::WALL_BANNER, 0, ItemIds::BANNER, TileBanner::class), "Wall Banner", $bannerBreakInfo)); + $this->register(new Barrel(new BID(Ids::BARREL, 0, null, TileBarrel::class), "Barrel", new BlockBreakInfo(2.5, BlockToolType::AXE))); $this->register(new Transparent(new BID(Ids::BARRIER, 0), "Barrier", BlockBreakInfo::indestructible())); $this->register(new Beacon(new BID(Ids::BEACON, 0, null, TileBeacon::class), "Beacon", new BlockBreakInfo(3.0))); - $this->register(new Bed(new BID(Ids::BED_BLOCK, 0, ItemIds::BED, TileBed::class), "Bed Block")); - $this->register(new Bedrock(new BID(Ids::BEDROCK, 0), "Bedrock")); - $this->register(new Beetroot(new BID(Ids::BEETROOT_BLOCK, 0), "Beetroot Block")); - $this->register(new BlueIce(new BID(Ids::BLUE_ICE, 0), "Blue Ice")); - $this->register(new BoneBlock(new BID(Ids::BONE_BLOCK, 0), "Bone Block")); - $this->register(new Bookshelf(new BID(Ids::BOOKSHELF, 0), "Bookshelf")); - $this->register(new BrewingStand(new BID(Ids::BREWING_STAND_BLOCK, 0, ItemIds::BREWING_STAND, TileBrewingStand::class), "Brewing Stand")); + $this->register(new Bed(new BID(Ids::BED_BLOCK, 0, ItemIds::BED, TileBed::class), "Bed Block", new BlockBreakInfo(0.2))); + $this->register(new Bedrock(new BID(Ids::BEDROCK, 0), "Bedrock", BlockBreakInfo::indestructible())); + + $this->register(new Beetroot(new BID(Ids::BEETROOT_BLOCK, 0), "Beetroot Block", BlockBreakInfo::instant())); + $this->register(new BlueIce(new BID(Ids::BLUE_ICE, 0), "Blue Ice", new BlockBreakInfo(2.8, BlockToolType::PICKAXE))); + $this->register(new BoneBlock(new BID(Ids::BONE_BLOCK, 0), "Bone Block", new BlockBreakInfo(2.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel()))); + $this->register(new Bookshelf(new BID(Ids::BOOKSHELF, 0), "Bookshelf", new BlockBreakInfo(1.5, BlockToolType::AXE))); + $this->register(new BrewingStand(new BID(Ids::BREWING_STAND_BLOCK, 0, ItemIds::BREWING_STAND, TileBrewingStand::class), "Brewing Stand", new BlockBreakInfo(0.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel()))); $bricksBreakInfo = new BlockBreakInfo(2.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 30.0); $this->register(new Stair(new BID(Ids::BRICK_STAIRS, 0), "Brick Stairs", $bricksBreakInfo)); $this->register(new Opaque(new BID(Ids::BRICK_BLOCK, 0), "Bricks", $bricksBreakInfo)); - $this->register(new BrownMushroom(new BID(Ids::BROWN_MUSHROOM, 0), "Brown Mushroom")); - $this->register(new Cactus(new BID(Ids::CACTUS, 0), "Cactus")); - $this->register(new Cake(new BID(Ids::CAKE_BLOCK, 0, ItemIds::CAKE), "Cake")); - $this->register(new Carrot(new BID(Ids::CARROTS, 0), "Carrot Block")); - $this->register(new Chest(new BID(Ids::CHEST, 0, null, TileChest::class), "Chest")); - $this->register(new Clay(new BID(Ids::CLAY_BLOCK, 0), "Clay Block")); - $this->register(new Coal(new BID(Ids::COAL_BLOCK, 0), "Coal Block")); - $this->register(new CoalOre(new BID(Ids::COAL_ORE, 0), "Coal Ore")); - $this->register(new CoarseDirt(new BID(Ids::DIRT, Meta::DIRT_COARSE), "Coarse Dirt")); + $this->register(new BrownMushroom(new BID(Ids::BROWN_MUSHROOM, 0), "Brown Mushroom", BlockBreakInfo::instant())); + $this->register(new Cactus(new BID(Ids::CACTUS, 0), "Cactus", new BlockBreakInfo(0.4))); + $this->register(new Cake(new BID(Ids::CAKE_BLOCK, 0, ItemIds::CAKE), "Cake", new BlockBreakInfo(0.5))); + $this->register(new Carrot(new BID(Ids::CARROTS, 0), "Carrot Block", BlockBreakInfo::instant())); + + $chestBreakInfo = new BlockBreakInfo(2.5, BlockToolType::AXE); + $this->register(new Chest(new BID(Ids::CHEST, 0, null, TileChest::class), "Chest", $chestBreakInfo)); + $this->register(new Clay(new BID(Ids::CLAY_BLOCK, 0), "Clay Block", new BlockBreakInfo(0.6, BlockToolType::SHOVEL))); + $this->register(new Coal(new BID(Ids::COAL_BLOCK, 0), "Coal Block", new BlockBreakInfo(5.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 30.0))); + $this->register(new CoalOre(new BID(Ids::COAL_ORE, 0), "Coal Ore", new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel()))); + + $dirtBreakInfo = new BlockBreakInfo(0.5, BlockToolType::SHOVEL); + $this->register(new CoarseDirt(new BID(Ids::DIRT, Meta::DIRT_COARSE), "Coarse Dirt", $dirtBreakInfo)); $cobblestoneBreakInfo = new BlockBreakInfo(2.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 30.0); $this->register($cobblestone = new Opaque(new BID(Ids::COBBLESTONE, 0), "Cobblestone", $cobblestoneBreakInfo)); - $this->register(new InfestedStone(new BID(Ids::MONSTER_EGG, Meta::INFESTED_COBBLESTONE), "Infested Cobblestone", $cobblestone)); + $infestedStoneBreakInfo = new BlockBreakInfo(0.75); + $this->register(new InfestedStone(new BID(Ids::MONSTER_EGG, Meta::INFESTED_COBBLESTONE), "Infested Cobblestone", $infestedStoneBreakInfo, $cobblestone)); $this->register(new Opaque(new BID(Ids::MOSSY_COBBLESTONE, 0), "Mossy Cobblestone", $cobblestoneBreakInfo)); $this->register(new Stair(new BID(Ids::COBBLESTONE_STAIRS, 0), "Cobblestone Stairs", $cobblestoneBreakInfo)); $this->register(new Stair(new BID(Ids::MOSSY_COBBLESTONE_STAIRS, 0), "Mossy Cobblestone Stairs", $cobblestoneBreakInfo)); - $this->register(new Cobweb(new BID(Ids::COBWEB, 0), "Cobweb")); - $this->register(new CocoaBlock(new BID(Ids::COCOA, 0), "Cocoa Block")); + $this->register(new Cobweb(new BID(Ids::COBWEB, 0), "Cobweb", new BlockBreakInfo(4.0, BlockToolType::SWORD | BlockToolType::SHEARS, 1))); + $this->register(new CocoaBlock(new BID(Ids::COCOA, 0), "Cocoa Block", new BlockBreakInfo(0.2, BlockToolType::AXE, 0, 15.0))); $this->register(new CoralBlock(new BID(Ids::CORAL_BLOCK, 0), "Coral Block", new BlockBreakInfo(7.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel()))); - $this->register(new CraftingTable(new BID(Ids::CRAFTING_TABLE, 0), "Crafting Table")); - $this->register(new DaylightSensor(new BIDFlattened(Ids::DAYLIGHT_DETECTOR, [Ids::DAYLIGHT_DETECTOR_INVERTED], 0, null, TileDaylightSensor::class), "Daylight Sensor")); - $this->register(new DeadBush(new BID(Ids::DEADBUSH, 0), "Dead Bush")); - $this->register(new DetectorRail(new BID(Ids::DETECTOR_RAIL, 0), "Detector Rail")); + $this->register(new CraftingTable(new BID(Ids::CRAFTING_TABLE, 0), "Crafting Table", new BlockBreakInfo(2.5, BlockToolType::AXE))); + $this->register(new DaylightSensor(new BIDFlattened(Ids::DAYLIGHT_DETECTOR, [Ids::DAYLIGHT_DETECTOR_INVERTED], 0, null, TileDaylightSensor::class), "Daylight Sensor", new BlockBreakInfo(0.2, BlockToolType::AXE))); + $this->register(new DeadBush(new BID(Ids::DEADBUSH, 0), "Dead Bush", BlockBreakInfo::instant(BlockToolType::SHEARS, 1))); + $this->register(new DetectorRail(new BID(Ids::DETECTOR_RAIL, 0), "Detector Rail", $railBreakInfo)); $this->register(new Opaque(new BID(Ids::DIAMOND_BLOCK, 0), "Diamond Block", new BlockBreakInfo(5.0, BlockToolType::PICKAXE, ToolTier::IRON()->getHarvestLevel(), 30.0))); - $this->register(new DiamondOre(new BID(Ids::DIAMOND_ORE, 0), "Diamond Ore")); - $this->register(new Dirt(new BID(Ids::DIRT, Meta::DIRT_NORMAL), "Dirt")); - $this->register(new DoublePlant(new BID(Ids::DOUBLE_PLANT, Meta::DOUBLE_PLANT_SUNFLOWER), "Sunflower")); - $this->register(new DoublePlant(new BID(Ids::DOUBLE_PLANT, Meta::DOUBLE_PLANT_LILAC), "Lilac")); - $this->register(new DoublePlant(new BID(Ids::DOUBLE_PLANT, Meta::DOUBLE_PLANT_ROSE_BUSH), "Rose Bush")); - $this->register(new DoublePlant(new BID(Ids::DOUBLE_PLANT, Meta::DOUBLE_PLANT_PEONY), "Peony")); - $this->register(new DoubleTallGrass(new BID(Ids::DOUBLE_PLANT, Meta::DOUBLE_PLANT_TALLGRASS), "Double Tallgrass")); - $this->register(new DoubleTallGrass(new BID(Ids::DOUBLE_PLANT, Meta::DOUBLE_PLANT_LARGE_FERN), "Large Fern")); - $this->register(new DragonEgg(new BID(Ids::DRAGON_EGG, 0), "Dragon Egg")); + $this->register(new DiamondOre(new BID(Ids::DIAMOND_ORE, 0), "Diamond Ore", new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::IRON()->getHarvestLevel()))); + $this->register(new Dirt(new BID(Ids::DIRT, Meta::DIRT_NORMAL), "Dirt", $dirtBreakInfo)); + $this->register(new DoublePlant(new BID(Ids::DOUBLE_PLANT, Meta::DOUBLE_PLANT_SUNFLOWER), "Sunflower", BlockBreakInfo::instant())); + $this->register(new DoublePlant(new BID(Ids::DOUBLE_PLANT, Meta::DOUBLE_PLANT_LILAC), "Lilac", BlockBreakInfo::instant())); + $this->register(new DoublePlant(new BID(Ids::DOUBLE_PLANT, Meta::DOUBLE_PLANT_ROSE_BUSH), "Rose Bush", BlockBreakInfo::instant())); + $this->register(new DoublePlant(new BID(Ids::DOUBLE_PLANT, Meta::DOUBLE_PLANT_PEONY), "Peony", BlockBreakInfo::instant())); + $this->register(new DoubleTallGrass(new BID(Ids::DOUBLE_PLANT, Meta::DOUBLE_PLANT_TALLGRASS), "Double Tallgrass", BlockBreakInfo::instant(BlockToolType::SHEARS, 1))); + $this->register(new DoubleTallGrass(new BID(Ids::DOUBLE_PLANT, Meta::DOUBLE_PLANT_LARGE_FERN), "Large Fern", BlockBreakInfo::instant(BlockToolType::SHEARS, 1))); + $this->register(new DragonEgg(new BID(Ids::DRAGON_EGG, 0), "Dragon Egg", new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel()))); $this->register(new DriedKelp(new BID(Ids::DRIED_KELP_BLOCK, 0), "Dried Kelp Block", new BlockBreakInfo(0.5, BlockToolType::NONE, 0, 12.5))); $this->register(new Opaque(new BID(Ids::EMERALD_BLOCK, 0), "Emerald Block", new BlockBreakInfo(5.0, BlockToolType::PICKAXE, ToolTier::IRON()->getHarvestLevel(), 30.0))); - $this->register(new EmeraldOre(new BID(Ids::EMERALD_ORE, 0), "Emerald Ore")); - $this->register(new EnchantingTable(new BID(Ids::ENCHANTING_TABLE, 0, null, TileEnchantingTable::class), "Enchanting Table")); - $this->register(new EndPortalFrame(new BID(Ids::END_PORTAL_FRAME, 0), "End Portal Frame")); - $this->register(new EndRod(new BID(Ids::END_ROD, 0), "End Rod")); + $this->register(new EmeraldOre(new BID(Ids::EMERALD_ORE, 0), "Emerald Ore", new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::IRON()->getHarvestLevel()))); + $this->register(new EnchantingTable(new BID(Ids::ENCHANTING_TABLE, 0, null, TileEnchantingTable::class), "Enchanting Table", new BlockBreakInfo(5.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 6000.0))); + $this->register(new EndPortalFrame(new BID(Ids::END_PORTAL_FRAME, 0), "End Portal Frame", BlockBreakInfo::indestructible())); + $this->register(new EndRod(new BID(Ids::END_ROD, 0), "End Rod", BlockBreakInfo::instant())); $this->register(new Opaque(new BID(Ids::END_STONE, 0), "End Stone", new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 45.0))); $endBrickBreakInfo = new BlockBreakInfo(0.8, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 4.0); $this->register(new Opaque(new BID(Ids::END_BRICKS, 0), "End Stone Bricks", $endBrickBreakInfo)); $this->register(new Stair(new BID(Ids::END_BRICK_STAIRS, 0), "End Stone Brick Stairs", $endBrickBreakInfo)); - $this->register(new EnderChest(new BID(Ids::ENDER_CHEST, 0, null, TileEnderChest::class), "Ender Chest")); - $this->register(new Farmland(new BID(Ids::FARMLAND, 0), "Farmland")); - $this->register(new Fire(new BID(Ids::FIRE, 0), "Fire Block")); - $this->register(new Flower(new BID(Ids::DANDELION, 0), "Dandelion")); - $this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_ALLIUM), "Allium")); - $this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_AZURE_BLUET), "Azure Bluet")); - $this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_BLUE_ORCHID), "Blue Orchid")); - $this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_CORNFLOWER), "Cornflower")); - $this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_LILY_OF_THE_VALLEY), "Lily of the Valley")); - $this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_ORANGE_TULIP), "Orange Tulip")); - $this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_OXEYE_DAISY), "Oxeye Daisy")); - $this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_PINK_TULIP), "Pink Tulip")); - $this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_POPPY), "Poppy")); - $this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_RED_TULIP), "Red Tulip")); - $this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_WHITE_TULIP), "White Tulip")); - $this->register(new FlowerPot(new BID(Ids::FLOWER_POT_BLOCK, 0, ItemIds::FLOWER_POT, TileFlowerPot::class), "Flower Pot")); - $this->register(new FrostedIce(new BID(Ids::FROSTED_ICE, 0), "Frosted Ice")); - $this->register(new Furnace(new BIDFlattened(Ids::FURNACE, [Ids::LIT_FURNACE], 0, null, TileFurnace::class), "Furnace")); - $this->register(new Glass(new BID(Ids::GLASS, 0), "Glass")); - $this->register(new GlassPane(new BID(Ids::GLASS_PANE, 0), "Glass Pane")); - $this->register(new GlowingObsidian(new BID(Ids::GLOWINGOBSIDIAN, 0), "Glowing Obsidian")); - $this->register(new Glowstone(new BID(Ids::GLOWSTONE, 0), "Glowstone")); + $this->register(new EnderChest(new BID(Ids::ENDER_CHEST, 0, null, TileEnderChest::class), "Ender Chest", new BlockBreakInfo(22.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 3000.0))); + $this->register(new Farmland(new BID(Ids::FARMLAND, 0), "Farmland", new BlockBreakInfo(0.6, BlockToolType::SHOVEL))); + $this->register(new Fire(new BID(Ids::FIRE, 0), "Fire Block", BlockBreakInfo::instant())); + $this->register(new Flower(new BID(Ids::DANDELION, 0), "Dandelion", BlockBreakInfo::instant())); + $this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_ALLIUM), "Allium", BlockBreakInfo::instant())); + $this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_AZURE_BLUET), "Azure Bluet", BlockBreakInfo::instant())); + $this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_BLUE_ORCHID), "Blue Orchid", BlockBreakInfo::instant())); + $this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_CORNFLOWER), "Cornflower", BlockBreakInfo::instant())); + $this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_LILY_OF_THE_VALLEY), "Lily of the Valley", BlockBreakInfo::instant())); + $this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_ORANGE_TULIP), "Orange Tulip", BlockBreakInfo::instant())); + $this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_OXEYE_DAISY), "Oxeye Daisy", BlockBreakInfo::instant())); + $this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_PINK_TULIP), "Pink Tulip", BlockBreakInfo::instant())); + $this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_POPPY), "Poppy", BlockBreakInfo::instant())); + $this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_RED_TULIP), "Red Tulip", BlockBreakInfo::instant())); + $this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_WHITE_TULIP), "White Tulip", BlockBreakInfo::instant())); + $this->register(new FlowerPot(new BID(Ids::FLOWER_POT_BLOCK, 0, ItemIds::FLOWER_POT, TileFlowerPot::class), "Flower Pot", BlockBreakInfo::instant())); + $this->register(new FrostedIce(new BID(Ids::FROSTED_ICE, 0), "Frosted Ice", new BlockBreakInfo(2.5, BlockToolType::PICKAXE))); + $this->register(new Furnace(new BIDFlattened(Ids::FURNACE, [Ids::LIT_FURNACE], 0, null, TileFurnace::class), "Furnace", new BlockBreakInfo(3.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel()))); + + $glassBreakInfo = new BlockBreakInfo(0.3); + $this->register(new Glass(new BID(Ids::GLASS, 0), "Glass", $glassBreakInfo)); + $this->register(new GlassPane(new BID(Ids::GLASS_PANE, 0), "Glass Pane", $glassBreakInfo)); + $this->register(new GlowingObsidian(new BID(Ids::GLOWINGOBSIDIAN, 0), "Glowing Obsidian", new BlockBreakInfo(10.0, BlockToolType::PICKAXE, ToolTier::DIAMOND()->getHarvestLevel(), 50.0))); + $this->register(new Glowstone(new BID(Ids::GLOWSTONE, 0), "Glowstone", new BlockBreakInfo(0.3, BlockToolType::PICKAXE))); $this->register(new Opaque(new BID(Ids::GOLD_BLOCK, 0), "Gold Block", new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::IRON()->getHarvestLevel(), 30.0))); $this->register(new Opaque(new BID(Ids::GOLD_ORE, 0), "Gold Ore", new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::IRON()->getHarvestLevel()))); - $this->register(new Grass(new BID(Ids::GRASS, 0), "Grass")); - $this->register(new GrassPath(new BID(Ids::GRASS_PATH, 0), "Grass Path")); - $this->register(new Gravel(new BID(Ids::GRAVEL, 0), "Gravel")); - $this->register(new HardenedClay(new BID(Ids::HARDENED_CLAY, 0), "Hardened Clay")); - $this->register(new HardenedGlass(new BID(Ids::HARD_GLASS, 0), "Hardened Glass")); - $this->register(new HardenedGlassPane(new BID(Ids::HARD_GLASS_PANE, 0), "Hardened Glass Pane")); - $this->register(new HayBale(new BID(Ids::HAY_BALE, 0), "Hay Bale")); + + $grassBreakInfo = new BlockBreakInfo(0.6, BlockToolType::SHOVEL); + $this->register(new Grass(new BID(Ids::GRASS, 0), "Grass", $grassBreakInfo)); + $this->register(new GrassPath(new BID(Ids::GRASS_PATH, 0), "Grass Path", $grassBreakInfo)); + $this->register(new Gravel(new BID(Ids::GRAVEL, 0), "Gravel", new BlockBreakInfo(0.6, BlockToolType::SHOVEL))); + + $hardenedClayBreakInfo = new BlockBreakInfo(1.25, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 21.0); + $this->register(new HardenedClay(new BID(Ids::HARDENED_CLAY, 0), "Hardened Clay", $hardenedClayBreakInfo)); + + $hardenedGlassBreakInfo = new BlockBreakInfo(10.0); + $this->register(new HardenedGlass(new BID(Ids::HARD_GLASS, 0), "Hardened Glass", $hardenedGlassBreakInfo)); + $this->register(new HardenedGlassPane(new BID(Ids::HARD_GLASS_PANE, 0), "Hardened Glass Pane", $hardenedGlassBreakInfo)); + $this->register(new HayBale(new BID(Ids::HAY_BALE, 0), "Hay Bale", new BlockBreakInfo(0.5))); $this->register(new Hopper(new BID(Ids::HOPPER_BLOCK, 0, ItemIds::HOPPER, TileHopper::class), "Hopper", new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 15.0))); - $this->register(new Ice(new BID(Ids::ICE, 0), "Ice")); + $this->register(new Ice(new BID(Ids::ICE, 0), "Ice", new BlockBreakInfo(0.5, BlockToolType::PICKAXE))); $updateBlockBreakInfo = new BlockBreakInfo(1.0); $this->register(new Opaque(new BID(Ids::INFO_UPDATE, 0), "update!", $updateBlockBreakInfo)); @@ -211,20 +228,20 @@ class BlockFactory{ $this->register(new Door(new BID(Ids::IRON_DOOR_BLOCK, 0, ItemIds::IRON_DOOR), "Iron Door", new BlockBreakInfo(5.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 25.0))); $this->register(new Opaque(new BID(Ids::IRON_ORE, 0), "Iron Ore", new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::STONE()->getHarvestLevel()))); $this->register(new Trapdoor(new BID(Ids::IRON_TRAPDOOR, 0), "Iron Trapdoor", new BlockBreakInfo(5.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 25.0))); - $this->register(new ItemFrame(new BID(Ids::FRAME_BLOCK, 0, ItemIds::FRAME, TileItemFrame::class), "Item Frame")); - $this->register(new Jukebox(new BID(Ids::JUKEBOX, 0, ItemIds::JUKEBOX, TileJukebox::class), "Jukebox")); - $this->register(new Ladder(new BID(Ids::LADDER, 0), "Ladder")); + $this->register(new ItemFrame(new BID(Ids::FRAME_BLOCK, 0, ItemIds::FRAME, TileItemFrame::class), "Item Frame", new BlockBreakInfo(0.25))); + $this->register(new Jukebox(new BID(Ids::JUKEBOX, 0, ItemIds::JUKEBOX, TileJukebox::class), "Jukebox", new BlockBreakInfo(0.8, BlockToolType::AXE))); //TODO: in PC the hardness is 2.0, not 0.8, unsure if this is a MCPE bug or not + $this->register(new Ladder(new BID(Ids::LADDER, 0), "Ladder", new BlockBreakInfo(0.4, BlockToolType::AXE))); $this->register(new Lantern(new BID(Ids::LANTERN, 0), "Lantern", new BlockBreakInfo(5.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel()))); $this->register(new Opaque(new BID(Ids::LAPIS_BLOCK, 0), "Lapis Lazuli Block", new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::STONE()->getHarvestLevel()))); - $this->register(new LapisOre(new BID(Ids::LAPIS_ORE, 0), "Lapis Lazuli Ore")); - $this->register(new Lava(new BIDFlattened(Ids::FLOWING_LAVA, [Ids::STILL_LAVA], 0), "Lava")); - $this->register(new Lever(new BID(Ids::LEVER, 0), "Lever")); + $this->register(new LapisOre(new BID(Ids::LAPIS_ORE, 0), "Lapis Lazuli Ore", new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::STONE()->getHarvestLevel()))); + $this->register(new Lava(new BIDFlattened(Ids::FLOWING_LAVA, [Ids::STILL_LAVA], 0), "Lava", BlockBreakInfo::indestructible(500.0))); + $this->register(new Lever(new BID(Ids::LEVER, 0), "Lever", new BlockBreakInfo(0.5))); $this->register(new Loom(new BID(Ids::LOOM, 0), "Loom", new BlockBreakInfo(2.5, BlockToolType::AXE))); - $this->register(new Magma(new BID(Ids::MAGMA, 0), "Magma Block")); - $this->register(new Melon(new BID(Ids::MELON_BLOCK, 0), "Melon Block")); - $this->register(new MelonStem(new BID(Ids::MELON_STEM, 0, ItemIds::MELON_SEEDS), "Melon Stem")); - $this->register(new MonsterSpawner(new BID(Ids::MOB_SPAWNER, 0, null, TileMonsterSpawner::class), "Monster Spawner")); - $this->register(new Mycelium(new BID(Ids::MYCELIUM, 0), "Mycelium")); + $this->register(new Magma(new BID(Ids::MAGMA, 0), "Magma Block", new BlockBreakInfo(0.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel()))); + $this->register(new Melon(new BID(Ids::MELON_BLOCK, 0), "Melon Block", new BlockBreakInfo(1.0, BlockToolType::AXE))); + $this->register(new MelonStem(new BID(Ids::MELON_STEM, 0, ItemIds::MELON_SEEDS), "Melon Stem", BlockBreakInfo::instant())); + $this->register(new MonsterSpawner(new BID(Ids::MOB_SPAWNER, 0, null, TileMonsterSpawner::class), "Monster Spawner", new BlockBreakInfo(5.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel()))); + $this->register(new Mycelium(new BID(Ids::MYCELIUM, 0), "Mycelium", new BlockBreakInfo(0.6, BlockToolType::SHOVEL))); $netherBrickBreakInfo = new BlockBreakInfo(2.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 30.0); $this->register(new Opaque(new BID(Ids::NETHER_BRICK_BLOCK, 0), "Nether Bricks", $netherBrickBreakInfo)); @@ -232,18 +249,18 @@ class BlockFactory{ $this->register(new Fence(new BID(Ids::NETHER_BRICK_FENCE, 0), "Nether Brick Fence", $netherBrickBreakInfo)); $this->register(new Stair(new BID(Ids::NETHER_BRICK_STAIRS, 0), "Nether Brick Stairs", $netherBrickBreakInfo)); $this->register(new Stair(new BID(Ids::RED_NETHER_BRICK_STAIRS, 0), "Red Nether Brick Stairs", $netherBrickBreakInfo)); - $this->register(new NetherPortal(new BID(Ids::PORTAL, 0), "Nether Portal")); - $this->register(new NetherQuartzOre(new BID(Ids::NETHER_QUARTZ_ORE, 0), "Nether Quartz Ore")); - $this->register(new NetherReactor(new BID(Ids::NETHERREACTOR, 0), "Nether Reactor Core")); + $this->register(new NetherPortal(new BID(Ids::PORTAL, 0), "Nether Portal", BlockBreakInfo::indestructible(0.0))); + $this->register(new NetherQuartzOre(new BID(Ids::NETHER_QUARTZ_ORE, 0), "Nether Quartz Ore", new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel()))); + $this->register(new NetherReactor(new BID(Ids::NETHERREACTOR, 0), "Nether Reactor Core", new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel()))); $this->register(new Opaque(new BID(Ids::NETHER_WART_BLOCK, 0), "Nether Wart Block", new BlockBreakInfo(1.0))); - $this->register(new NetherWartPlant(new BID(Ids::NETHER_WART_PLANT, 0, ItemIds::NETHER_WART), "Nether Wart")); - $this->register(new Netherrack(new BID(Ids::NETHERRACK, 0), "Netherrack")); - $this->register(new Note(new BID(Ids::NOTEBLOCK, 0, null, TileNote::class), "Note Block")); + $this->register(new NetherWartPlant(new BID(Ids::NETHER_WART_PLANT, 0, ItemIds::NETHER_WART), "Nether Wart", BlockBreakInfo::instant())); + $this->register(new Netherrack(new BID(Ids::NETHERRACK, 0), "Netherrack", new BlockBreakInfo(0.4, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel()))); + $this->register(new Note(new BID(Ids::NOTEBLOCK, 0, null, TileNote::class), "Note Block", new BlockBreakInfo(0.8, BlockToolType::AXE))); $this->register(new Opaque(new BID(Ids::OBSIDIAN, 0), "Obsidian", new BlockBreakInfo(35.0 /* 50 in PC */, BlockToolType::PICKAXE, ToolTier::DIAMOND()->getHarvestLevel(), 6000.0))); - $this->register(new PackedIce(new BID(Ids::PACKED_ICE, 0), "Packed Ice")); - $this->register(new Podzol(new BID(Ids::PODZOL, 0), "Podzol")); - $this->register(new Potato(new BID(Ids::POTATOES, 0), "Potato Block")); - $this->register(new PoweredRail(new BID(Ids::GOLDEN_RAIL, Meta::RAIL_STRAIGHT_NORTH_SOUTH), "Powered Rail")); + $this->register(new PackedIce(new BID(Ids::PACKED_ICE, 0), "Packed Ice", new BlockBreakInfo(0.5, BlockToolType::PICKAXE))); + $this->register(new Podzol(new BID(Ids::PODZOL, 0), "Podzol", new BlockBreakInfo(0.5, BlockToolType::SHOVEL))); + $this->register(new Potato(new BID(Ids::POTATOES, 0), "Potato Block", BlockBreakInfo::instant())); + $this->register(new PoweredRail(new BID(Ids::GOLDEN_RAIL, Meta::RAIL_STRAIGHT_NORTH_SOUTH), "Powered Rail", $railBreakInfo)); $prismarineBreakInfo = new BlockBreakInfo(1.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 30.0); $this->register(new Opaque(new BID(Ids::PRISMARINE, Meta::PRISMARINE_BRICKS), "Prismarine Bricks", $prismarineBreakInfo)); @@ -261,7 +278,7 @@ class BlockFactory{ $this->register(new CarvedPumpkin(new BID(Ids::CARVED_PUMPKIN, 0), "Carved Pumpkin", $pumpkinBreakInfo)); $this->register(new LitPumpkin(new BID(Ids::JACK_O_LANTERN, 0), "Jack o'Lantern", $pumpkinBreakInfo)); - $this->register(new PumpkinStem(new BID(Ids::PUMPKIN_STEM, 0, ItemIds::PUMPKIN_SEEDS), "Pumpkin Stem")); + $this->register(new PumpkinStem(new BID(Ids::PUMPKIN_STEM, 0, ItemIds::PUMPKIN_SEEDS), "Pumpkin Stem", BlockBreakInfo::instant())); $purpurBreakInfo = new BlockBreakInfo(1.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 30.0); $this->register(new Opaque(new BID(Ids::PURPUR_BLOCK, Meta::PURPUR_NORMAL), "Purpur Block", $purpurBreakInfo)); @@ -276,26 +293,28 @@ class BlockFactory{ $this->register(new Opaque(new BID(Ids::QUARTZ_BLOCK, Meta::QUARTZ_SMOOTH), "Smooth Quartz Block", $quartzBreakInfo)); //TODO: this has axis rotation in 1.9, unsure if a bug (https://bugs.mojang.com/browse/MCPE-39074) $this->register(new Stair(new BID(Ids::SMOOTH_QUARTZ_STAIRS, 0), "Smooth Quartz Stairs", $quartzBreakInfo)); - $this->register(new Rail(new BID(Ids::RAIL, 0), "Rail")); - $this->register(new RedMushroom(new BID(Ids::RED_MUSHROOM, 0), "Red Mushroom")); - $this->register(new Redstone(new BID(Ids::REDSTONE_BLOCK, 0), "Redstone Block")); - $this->register(new RedstoneComparator(new BIDFlattened(Ids::UNPOWERED_COMPARATOR, [Ids::POWERED_COMPARATOR], 0, ItemIds::COMPARATOR, TileComparator::class), "Redstone Comparator")); - $this->register(new RedstoneLamp(new BIDFlattened(Ids::REDSTONE_LAMP, [Ids::LIT_REDSTONE_LAMP], 0), "Redstone Lamp")); - $this->register(new RedstoneOre(new BIDFlattened(Ids::REDSTONE_ORE, [Ids::LIT_REDSTONE_ORE], 0), "Redstone Ore")); - $this->register(new RedstoneRepeater(new BIDFlattened(Ids::UNPOWERED_REPEATER, [Ids::POWERED_REPEATER], 0, ItemIds::REPEATER), "Redstone Repeater")); - $this->register(new RedstoneTorch(new BIDFlattened(Ids::REDSTONE_TORCH, [Ids::UNLIT_REDSTONE_TORCH], 0), "Redstone Torch")); - $this->register(new RedstoneWire(new BID(Ids::REDSTONE_WIRE, 0, ItemIds::REDSTONE), "Redstone")); - $this->register(new Reserved6(new BID(Ids::RESERVED6, 0), "reserved6")); - $this->register(new Sand(new BID(Ids::SAND, 0), "Sand")); - $this->register(new Sand(new BID(Ids::SAND, 1), "Red Sand")); - $this->register(new SeaLantern(new BID(Ids::SEALANTERN, 0), "Sea Lantern")); - $this->register(new SeaPickle(new BID(Ids::SEA_PICKLE, 0), "Sea Pickle")); - $this->register(new Skull(new BID(Ids::MOB_HEAD_BLOCK, 0, null, TileSkull::class), "Mob Head")); + $this->register(new Rail(new BID(Ids::RAIL, 0), "Rail", $railBreakInfo)); + $this->register(new RedMushroom(new BID(Ids::RED_MUSHROOM, 0), "Red Mushroom", BlockBreakInfo::instant())); + $this->register(new Redstone(new BID(Ids::REDSTONE_BLOCK, 0), "Redstone Block", new BlockBreakInfo(5.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 30.0))); + $this->register(new RedstoneComparator(new BIDFlattened(Ids::UNPOWERED_COMPARATOR, [Ids::POWERED_COMPARATOR], 0, ItemIds::COMPARATOR, TileComparator::class), "Redstone Comparator", BlockBreakInfo::instant())); + $this->register(new RedstoneLamp(new BIDFlattened(Ids::REDSTONE_LAMP, [Ids::LIT_REDSTONE_LAMP], 0), "Redstone Lamp", new BlockBreakInfo(0.3))); + $this->register(new RedstoneOre(new BIDFlattened(Ids::REDSTONE_ORE, [Ids::LIT_REDSTONE_ORE], 0), "Redstone Ore", new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::IRON()->getHarvestLevel()))); + $this->register(new RedstoneRepeater(new BIDFlattened(Ids::UNPOWERED_REPEATER, [Ids::POWERED_REPEATER], 0, ItemIds::REPEATER), "Redstone Repeater", BlockBreakInfo::instant())); + $this->register(new RedstoneTorch(new BIDFlattened(Ids::REDSTONE_TORCH, [Ids::UNLIT_REDSTONE_TORCH], 0), "Redstone Torch", BlockBreakInfo::instant())); + $this->register(new RedstoneWire(new BID(Ids::REDSTONE_WIRE, 0, ItemIds::REDSTONE), "Redstone", BlockBreakInfo::instant())); + $this->register(new Reserved6(new BID(Ids::RESERVED6, 0), "reserved6", BlockBreakInfo::instant())); - $this->register(new Snow(new BID(Ids::SNOW, 0), "Snow Block")); - $this->register(new SnowLayer(new BID(Ids::SNOW_LAYER, 0), "Snow Layer")); - $this->register(new SoulSand(new BID(Ids::SOUL_SAND, 0), "Soul Sand")); - $this->register(new Sponge(new BID(Ids::SPONGE, 0), "Sponge")); + $sandBreakInfo = new BlockBreakInfo(0.5, BlockToolType::SHOVEL); + $this->register(new Sand(new BID(Ids::SAND, 0), "Sand", $sandBreakInfo)); + $this->register(new Sand(new BID(Ids::SAND, 1), "Red Sand", $sandBreakInfo)); + $this->register(new SeaLantern(new BID(Ids::SEALANTERN, 0), "Sea Lantern", new BlockBreakInfo(0.3))); + $this->register(new SeaPickle(new BID(Ids::SEA_PICKLE, 0), "Sea Pickle", BlockBreakInfo::instant())); + $this->register(new Skull(new BID(Ids::MOB_HEAD_BLOCK, 0, null, TileSkull::class), "Mob Head", new BlockBreakInfo(1.0))); + + $this->register(new Snow(new BID(Ids::SNOW, 0), "Snow Block", new BlockBreakInfo(0.2, BlockToolType::SHOVEL, ToolTier::WOOD()->getHarvestLevel()))); + $this->register(new SnowLayer(new BID(Ids::SNOW_LAYER, 0), "Snow Layer", new BlockBreakInfo(0.1, BlockToolType::SHOVEL, ToolTier::WOOD()->getHarvestLevel()))); + $this->register(new SoulSand(new BID(Ids::SOUL_SAND, 0), "Soul Sand", new BlockBreakInfo(0.5, BlockToolType::SHOVEL))); + $this->register(new Sponge(new BID(Ids::SPONGE, 0), "Sponge", new BlockBreakInfo(0.6, BlockToolType::HOE))); $stoneBreakInfo = new BlockBreakInfo(1.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 30.0); $this->register($stone = new class(new BID(Ids::STONE, Meta::STONE_NORMAL), "Stone", $stoneBreakInfo) extends Opaque{ @@ -307,7 +326,7 @@ class BlockFactory{ return true; } }); - $this->register(new InfestedStone(new BID(Ids::MONSTER_EGG, Meta::INFESTED_STONE), "Infested Stone", $stone)); + $this->register(new InfestedStone(new BID(Ids::MONSTER_EGG, Meta::INFESTED_STONE), "Infested Stone", $infestedStoneBreakInfo, $stone)); $this->register(new Stair(new BID(Ids::NORMAL_STONE_STAIRS, 0), "Stone Stairs", $stoneBreakInfo)); $this->register(new Opaque(new BID(Ids::SMOOTH_STONE, 0), "Smooth Stone", $stoneBreakInfo)); $this->register(new Opaque(new BID(Ids::STONE, Meta::STONE_ANDESITE), "Andesite", $stoneBreakInfo)); @@ -324,16 +343,16 @@ class BlockFactory{ $this->register(new Stair(new BID(Ids::POLISHED_GRANITE_STAIRS, 0), "Polished Granite Stairs", $stoneBreakInfo)); $this->register(new Stair(new BID(Ids::STONE_BRICK_STAIRS, 0), "Stone Brick Stairs", $stoneBreakInfo)); $this->register($chiseledStoneBrick = new Opaque(new BID(Ids::STONEBRICK, Meta::STONE_BRICK_CHISELED), "Chiseled Stone Bricks", $stoneBreakInfo)); - $this->register(new InfestedStone(new BID(Ids::MONSTER_EGG, Meta::INFESTED_STONE_BRICK_CHISELED), "Infested Chiseled Stone Brick", $chiseledStoneBrick)); + $this->register(new InfestedStone(new BID(Ids::MONSTER_EGG, Meta::INFESTED_STONE_BRICK_CHISELED), "Infested Chiseled Stone Brick", $infestedStoneBreakInfo, $chiseledStoneBrick)); $this->register($crackedStoneBrick = new Opaque(new BID(Ids::STONEBRICK, Meta::STONE_BRICK_CRACKED), "Cracked Stone Bricks", $stoneBreakInfo)); - $this->register(new InfestedStone(new BID(Ids::MONSTER_EGG, Meta::INFESTED_STONE_BRICK_CRACKED), "Infested Cracked Stone Brick", $crackedStoneBrick)); + $this->register(new InfestedStone(new BID(Ids::MONSTER_EGG, Meta::INFESTED_STONE_BRICK_CRACKED), "Infested Cracked Stone Brick", $infestedStoneBreakInfo, $crackedStoneBrick)); $this->register($mossyStoneBrick = new Opaque(new BID(Ids::STONEBRICK, Meta::STONE_BRICK_MOSSY), "Mossy Stone Bricks", $stoneBreakInfo)); - $this->register(new InfestedStone(new BID(Ids::MONSTER_EGG, Meta::INFESTED_STONE_BRICK_MOSSY), "Infested Mossy Stone Brick", $mossyStoneBrick)); + $this->register(new InfestedStone(new BID(Ids::MONSTER_EGG, Meta::INFESTED_STONE_BRICK_MOSSY), "Infested Mossy Stone Brick", $infestedStoneBreakInfo, $mossyStoneBrick)); $this->register(new Stair(new BID(Ids::MOSSY_STONE_BRICK_STAIRS, 0), "Mossy Stone Brick Stairs", $stoneBreakInfo)); $this->register($stoneBrick = new Opaque(new BID(Ids::STONEBRICK, Meta::STONE_BRICK_NORMAL), "Stone Bricks", $stoneBreakInfo)); - $this->register(new InfestedStone(new BID(Ids::MONSTER_EGG, Meta::INFESTED_STONE_BRICK), "Infested Stone Brick", $stoneBrick)); - $this->register(new StoneButton(new BID(Ids::STONE_BUTTON, 0), "Stone Button")); - $this->register(new StonePressurePlate(new BID(Ids::STONE_PRESSURE_PLATE, 0), "Stone Pressure Plate")); + $this->register(new InfestedStone(new BID(Ids::MONSTER_EGG, Meta::INFESTED_STONE_BRICK), "Infested Stone Brick", $infestedStoneBreakInfo, $stoneBrick)); + $this->register(new StoneButton(new BID(Ids::STONE_BUTTON, 0), "Stone Button", new BlockBreakInfo(0.5, BlockToolType::PICKAXE))); + $this->register(new StonePressurePlate(new BID(Ids::STONE_PRESSURE_PLATE, 0), "Stone Pressure Plate", new BlockBreakInfo(0.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel()))); //TODO: in the future this won't be the same for all the types $stoneSlabBreakInfo = new BlockBreakInfo(2.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 30.0); @@ -367,57 +386,71 @@ class BlockFactory{ $this->register(new Slab(BlockLegacyIdHelper::getStoneSlabIdentifier(4, Meta::STONE_SLAB4_SMOOTH_QUARTZ), "Smooth Quartz", $stoneSlabBreakInfo)); $this->register(new Slab(BlockLegacyIdHelper::getStoneSlabIdentifier(4, Meta::STONE_SLAB4_STONE), "Stone", $stoneSlabBreakInfo)); $this->register(new Opaque(new BID(Ids::STONECUTTER, 0), "Stonecutter", new BlockBreakInfo(3.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel()))); - $this->register(new Sugarcane(new BID(Ids::REEDS_BLOCK, 0, ItemIds::REEDS), "Sugarcane")); - $this->register(new TNT(new BID(Ids::TNT, 0), "TNT")); + $this->register(new Sugarcane(new BID(Ids::REEDS_BLOCK, 0, ItemIds::REEDS), "Sugarcane", BlockBreakInfo::instant())); + $this->register(new TNT(new BID(Ids::TNT, 0), "TNT", BlockBreakInfo::instant())); - $fern = new TallGrass(new BID(Ids::TALLGRASS, Meta::TALLGRASS_FERN), "Fern"); + $fern = new TallGrass(new BID(Ids::TALLGRASS, Meta::TALLGRASS_FERN), "Fern", BlockBreakInfo::instant(BlockToolType::SHEARS, 1)); $this->register($fern); $this->remap(Ids::TALLGRASS, 0, $fern); $this->remap(Ids::TALLGRASS, 3, $fern); - $this->register(new TallGrass(new BID(Ids::TALLGRASS, Meta::TALLGRASS_NORMAL), "Tall Grass")); - $this->register(new Torch(new BID(Ids::COLORED_TORCH_BP, 0), "Blue Torch")); - $this->register(new Torch(new BID(Ids::COLORED_TORCH_BP, 8), "Purple Torch")); - $this->register(new Torch(new BID(Ids::COLORED_TORCH_RG, 0), "Red Torch")); - $this->register(new Torch(new BID(Ids::COLORED_TORCH_RG, 8), "Green Torch")); - $this->register(new Torch(new BID(Ids::TORCH, 0), "Torch")); - $this->register(new TrappedChest(new BID(Ids::TRAPPED_CHEST, 0, null, TileChest::class), "Trapped Chest")); - $this->register(new Tripwire(new BID(Ids::TRIPWIRE, 0, ItemIds::STRING), "Tripwire")); - $this->register(new TripwireHook(new BID(Ids::TRIPWIRE_HOOK, 0), "Tripwire Hook")); - $this->register(new UnderwaterTorch(new BID(Ids::UNDERWATER_TORCH, 0), "Underwater Torch")); - $this->register(new Vine(new BID(Ids::VINE, 0), "Vines")); - $this->register(new Water(new BIDFlattened(Ids::FLOWING_WATER, [Ids::STILL_WATER], 0), "Water")); - $this->register(new WaterLily(new BID(Ids::LILY_PAD, 0), "Lily Pad")); - $this->register(new WeightedPressurePlateHeavy(new BID(Ids::HEAVY_WEIGHTED_PRESSURE_PLATE, 0), "Weighted Pressure Plate Heavy")); - $this->register(new WeightedPressurePlateLight(new BID(Ids::LIGHT_WEIGHTED_PRESSURE_PLATE, 0), "Weighted Pressure Plate Light")); - $this->register(new Wheat(new BID(Ids::WHEAT_BLOCK, 0), "Wheat Block")); + $this->register(new TallGrass(new BID(Ids::TALLGRASS, Meta::TALLGRASS_NORMAL), "Tall Grass", BlockBreakInfo::instant(BlockToolType::SHEARS, 1))); + $this->register(new Torch(new BID(Ids::COLORED_TORCH_BP, 0), "Blue Torch", BlockBreakInfo::instant())); + $this->register(new Torch(new BID(Ids::COLORED_TORCH_BP, 8), "Purple Torch", BlockBreakInfo::instant())); + $this->register(new Torch(new BID(Ids::COLORED_TORCH_RG, 0), "Red Torch", BlockBreakInfo::instant())); + $this->register(new Torch(new BID(Ids::COLORED_TORCH_RG, 8), "Green Torch", BlockBreakInfo::instant())); + $this->register(new Torch(new BID(Ids::TORCH, 0), "Torch", BlockBreakInfo::instant())); + $this->register(new TrappedChest(new BID(Ids::TRAPPED_CHEST, 0, null, TileChest::class), "Trapped Chest", $chestBreakInfo)); + $this->register(new Tripwire(new BID(Ids::TRIPWIRE, 0, ItemIds::STRING), "Tripwire", BlockBreakInfo::instant())); + $this->register(new TripwireHook(new BID(Ids::TRIPWIRE_HOOK, 0), "Tripwire Hook", BlockBreakInfo::instant())); + $this->register(new UnderwaterTorch(new BID(Ids::UNDERWATER_TORCH, 0), "Underwater Torch", BlockBreakInfo::instant())); + $this->register(new Vine(new BID(Ids::VINE, 0), "Vines", new BlockBreakInfo(0.2, BlockToolType::AXE))); + $this->register(new Water(new BIDFlattened(Ids::FLOWING_WATER, [Ids::STILL_WATER], 0), "Water", BlockBreakInfo::indestructible(500.0))); + $this->register(new WaterLily(new BID(Ids::LILY_PAD, 0), "Lily Pad", new BlockBreakInfo(0.6))); + $weightedPressurePlateBreakInfo = new BlockBreakInfo(0.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel()); + $this->register(new WeightedPressurePlateHeavy(new BID(Ids::HEAVY_WEIGHTED_PRESSURE_PLATE, 0), "Weighted Pressure Plate Heavy", $weightedPressurePlateBreakInfo)); + $this->register(new WeightedPressurePlateLight(new BID(Ids::LIGHT_WEIGHTED_PRESSURE_PLATE, 0), "Weighted Pressure Plate Light", $weightedPressurePlateBreakInfo)); + $this->register(new Wheat(new BID(Ids::WHEAT_BLOCK, 0), "Wheat Block", BlockBreakInfo::instant())); + + $fenceGateBreakInfo = new BlockBreakInfo(2.0, BlockToolType::AXE); + $leavesBreakInfo = new BlockBreakInfo(0.2, BlockToolType::SHEARS); + $planksBreakInfo = new BlockBreakInfo(2.0, BlockToolType::AXE, 0, 15.0); + $signBreakInfo = new BlockBreakInfo(1.0, BlockToolType::AXE); + $logBreakInfo = new BlockBreakInfo(2.0, BlockToolType::AXE); + $woodenDoorBreakInfo = new BlockBreakInfo(3.0, BlockToolType::AXE); + $woodenButtonBreakInfo = new BlockBreakInfo(0.5, BlockToolType::AXE); + $woodenFenceBreakInfo = new BlockBreakInfo(2.0, BlockToolType::AXE, 0, 15.0); + $woodenPressurePlateBreakInfo = new BlockBreakInfo(0.5, BlockToolType::AXE); + $woodenSlabBreakInfo = new BlockBreakInfo(2.0, BlockToolType::AXE, 0, 15.0); + $woodenStairsBreakInfo = new BlockBreakInfo(2.0, BlockToolType::AXE, 0, 15.0); + $woodenTrapdoorBreakInfo = new BlockBreakInfo(3.0, BlockToolType::AXE, 0, 15.0); foreach(TreeType::getAll() as $treeType){ $magicNumber = $treeType->getMagicNumber(); $name = $treeType->getDisplayName(); - $this->register(new Planks(new BID(Ids::PLANKS, $magicNumber), $name . " Planks")); - $this->register(new Sapling(new BID(Ids::SAPLING, $magicNumber), $name . " Sapling", $treeType)); - $this->register(new WoodenFence(new BID(Ids::FENCE, $magicNumber), $name . " Fence")); - $this->register(new WoodenSlab(new BIDFlattened(Ids::WOODEN_SLAB, [Ids::DOUBLE_WOODEN_SLAB], $treeType->getMagicNumber()), $treeType->getDisplayName())); + $this->register(new Planks(new BID(Ids::PLANKS, $magicNumber), $name . " Planks", $planksBreakInfo)); + $this->register(new Sapling(new BID(Ids::SAPLING, $magicNumber), $name . " Sapling", BlockBreakInfo::instant(), $treeType)); + $this->register(new WoodenFence(new BID(Ids::FENCE, $magicNumber), $name . " Fence", $woodenFenceBreakInfo)); + $this->register(new WoodenSlab(new BIDFlattened(Ids::WOODEN_SLAB, [Ids::DOUBLE_WOODEN_SLAB], $treeType->getMagicNumber()), $treeType->getDisplayName(), $woodenSlabBreakInfo)); //TODO: find a better way to deal with this split - $this->register(new Leaves(new BID($magicNumber >= 4 ? Ids::LEAVES2 : Ids::LEAVES, $magicNumber & 0x03), $name . " Leaves", $treeType)); - $this->register(new Log(new BID($magicNumber >= 4 ? Ids::LOG2 : Ids::LOG, $magicNumber & 0x03), $name . " Log", $treeType, false)); + $this->register(new Leaves(new BID($magicNumber >= 4 ? Ids::LEAVES2 : Ids::LEAVES, $magicNumber & 0x03), $name . " Leaves", $leavesBreakInfo, $treeType)); + $this->register(new Log(new BID($magicNumber >= 4 ? Ids::LOG2 : Ids::LOG, $magicNumber & 0x03), $name . " Log", $logBreakInfo, $treeType, false)); - $wood = new Wood(new BID(Ids::WOOD, $magicNumber), $name . " Wood", $treeType, false); + $wood = new Wood(new BID(Ids::WOOD, $magicNumber), $name . " Wood", $logBreakInfo, $treeType, false); $this->register($wood); $this->remap($magicNumber >= 4 ? Ids::LOG2 : Ids::LOG, ($magicNumber & 0x03) | 0b1100, $wood); - $this->register(new Log(BlockLegacyIdHelper::getStrippedLogIdentifier($treeType), "Stripped " . $treeType->getDisplayName() . " Log", $treeType, true)); - $this->register(new FenceGate(BlockLegacyIdHelper::getWoodenFenceIdentifier($treeType), $treeType->getDisplayName() . " Fence Gate")); - $this->register(new WoodenStairs(BlockLegacyIdHelper::getWoodenStairsIdentifier($treeType), $treeType->getDisplayName() . " Stairs")); - $this->register(new WoodenDoor(BlockLegacyIdHelper::getWoodenDoorIdentifier($treeType), $treeType->getDisplayName() . " Door")); + $this->register(new Log(BlockLegacyIdHelper::getStrippedLogIdentifier($treeType), "Stripped " . $treeType->getDisplayName() . " Log", $logBreakInfo, $treeType, true)); + $this->register(new FenceGate(BlockLegacyIdHelper::getWoodenFenceIdentifier($treeType), $treeType->getDisplayName() . " Fence Gate", $fenceGateBreakInfo)); + $this->register(new WoodenStairs(BlockLegacyIdHelper::getWoodenStairsIdentifier($treeType), $treeType->getDisplayName() . " Stairs", $woodenStairsBreakInfo)); + $this->register(new WoodenDoor(BlockLegacyIdHelper::getWoodenDoorIdentifier($treeType), $treeType->getDisplayName() . " Door", $woodenDoorBreakInfo)); - $this->register(new WoodenButton(BlockLegacyIdHelper::getWoodenButtonIdentifier($treeType), $treeType->getDisplayName() . " Button")); - $this->register(new WoodenPressurePlate(BlockLegacyIdHelper::getWoodenPressurePlateIdentifier($treeType), $treeType->getDisplayName() . " Pressure Plate")); - $this->register(new WoodenTrapdoor(BlockLegacyIdHelper::getWoodenTrapdoorIdentifier($treeType), $treeType->getDisplayName() . " Trapdoor")); + $this->register(new WoodenButton(BlockLegacyIdHelper::getWoodenButtonIdentifier($treeType), $treeType->getDisplayName() . " Button", $woodenButtonBreakInfo)); + $this->register(new WoodenPressurePlate(BlockLegacyIdHelper::getWoodenPressurePlateIdentifier($treeType), $treeType->getDisplayName() . " Pressure Plate", $woodenPressurePlateBreakInfo)); + $this->register(new WoodenTrapdoor(BlockLegacyIdHelper::getWoodenTrapdoorIdentifier($treeType), $treeType->getDisplayName() . " Trapdoor", $woodenTrapdoorBreakInfo)); - $this->register(new FloorSign(BlockLegacyIdHelper::getWoodenFloorSignIdentifier($treeType), $treeType->getDisplayName() . " Sign")); - $this->register(new WallSign(BlockLegacyIdHelper::getWoodenWallSignIdentifier($treeType), $treeType->getDisplayName() . " Wall Sign")); + $this->register(new FloorSign(BlockLegacyIdHelper::getWoodenFloorSignIdentifier($treeType), $treeType->getDisplayName() . " Sign", $signBreakInfo)); + $this->register(new WallSign(BlockLegacyIdHelper::getWoodenWallSignIdentifier($treeType), $treeType->getDisplayName() . " Wall Sign", $signBreakInfo)); } static $sandstoneTypes = [ @@ -436,36 +469,48 @@ class BlockFactory{ $this->register(new Opaque(new BID(Ids::RED_SANDSTONE, $variant), $prefix . "Red Sandstone", $sandstoneBreakInfo)); } + $glazedTerracottaBreakInfo = new BlockBreakInfo(1.4, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel()); foreach(DyeColor::getAll() as $color){ $coloredName = function(string $name) use($color) : string{ return $color->getDisplayName() . " " . $name; }; - $this->register(new GlazedTerracotta(BlockLegacyIdHelper::getGlazedTerracottaIdentifier($color), $coloredName("Glazed Terracotta"))); + $this->register(new GlazedTerracotta(BlockLegacyIdHelper::getGlazedTerracottaIdentifier($color), $coloredName("Glazed Terracotta"), $glazedTerracottaBreakInfo)); } - $this->register(new StainedGlass(new BID(Ids::STAINED_GLASS, 0), "Stained Glass")); - $this->register(new StainedGlassPane(new BID(Ids::STAINED_GLASS_PANE, 0), "Stained Glass Pane")); - $this->register(new StainedHardenedClay(new BID(Ids::STAINED_CLAY, 0), "Stained Clay")); - $this->register(new StainedHardenedGlass(new BID(Ids::HARD_STAINED_GLASS, 0), "Stained Hardened Glass")); - $this->register(new StainedHardenedGlassPane(new BID(Ids::HARD_STAINED_GLASS_PANE, 0), "Stained Hardened Glass Pane")); - $this->register(new Carpet(new BID(Ids::CARPET, 0), "Carpet")); - $this->register(new Concrete(new BID(Ids::CONCRETE, 0), "Concrete")); - $this->register(new ConcretePowder(new BID(Ids::CONCRETE_POWDER, 0), "Concrete Powder")); - $this->register(new Wool(new BID(Ids::WOOL, 0), "Wool")); + $this->register(new StainedGlass(new BID(Ids::STAINED_GLASS, 0), "Stained Glass", $glassBreakInfo)); + $this->register(new StainedGlassPane(new BID(Ids::STAINED_GLASS_PANE, 0), "Stained Glass Pane", $glassBreakInfo)); + $this->register(new StainedHardenedClay(new BID(Ids::STAINED_CLAY, 0), "Stained Clay", $hardenedClayBreakInfo)); + $this->register(new StainedHardenedGlass(new BID(Ids::HARD_STAINED_GLASS, 0), "Stained Hardened Glass", $hardenedGlassBreakInfo)); + $this->register(new StainedHardenedGlassPane(new BID(Ids::HARD_STAINED_GLASS_PANE, 0), "Stained Hardened Glass Pane", $hardenedGlassBreakInfo)); + $this->register(new Carpet(new BID(Ids::CARPET, 0), "Carpet", new BlockBreakInfo(0.1))); + $this->register(new Concrete(new BID(Ids::CONCRETE, 0), "Concrete", new BlockBreakInfo(1.8, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel()))); + $this->register(new ConcretePowder(new BID(Ids::CONCRETE_POWDER, 0), "Concrete Powder", new BlockBreakInfo(0.5, BlockToolType::SHOVEL))); + $this->register(new Wool(new BID(Ids::WOOL, 0), "Wool", new class(0.8, BlockToolType::SHEARS) extends BlockBreakInfo{ + public function getBreakTime(Item $item) : float{ + $time = parent::getBreakTime($item); + if($item->getBlockToolType() === BlockToolType::SHEARS){ + $time *= 3; //shears break compatible blocks 15x faster, but wool 5x + } - $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_ANDESITE), "Andesite Wall")); - $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_BRICK), "Brick Wall")); - $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_DIORITE), "Diorite Wall")); - $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_END_STONE_BRICK), "End Stone Brick Wall")); - $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_GRANITE), "Granite Wall")); - $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_MOSSY_STONE_BRICK), "Mossy Stone Brick Wall")); - $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_MOSSY_COBBLESTONE), "Mossy Cobblestone Wall")); - $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_NETHER_BRICK), "Nether Brick Wall")); - $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_COBBLESTONE), "Cobblestone Wall")); - $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_PRISMARINE), "Prismarine Wall")); - $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_RED_NETHER_BRICK), "Red Nether Brick Wall")); - $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_RED_SANDSTONE), "Red Sandstone Wall")); - $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_SANDSTONE), "Sandstone Wall")); - $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_STONE_BRICK), "Stone Brick Wall")); + return $time; + } + })); + + //TODO: in the future these won't all have the same hardness; they only do now because of the old metadata crap + $wallBreakInfo = new BlockBreakInfo(2.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 30.0); + $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_ANDESITE), "Andesite Wall", $wallBreakInfo)); + $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_BRICK), "Brick Wall", $wallBreakInfo)); + $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_DIORITE), "Diorite Wall", $wallBreakInfo)); + $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_END_STONE_BRICK), "End Stone Brick Wall", $wallBreakInfo)); + $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_GRANITE), "Granite Wall", $wallBreakInfo)); + $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_MOSSY_STONE_BRICK), "Mossy Stone Brick Wall", $wallBreakInfo)); + $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_MOSSY_COBBLESTONE), "Mossy Cobblestone Wall", $wallBreakInfo)); + $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_NETHER_BRICK), "Nether Brick Wall", $wallBreakInfo)); + $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_COBBLESTONE), "Cobblestone Wall", $wallBreakInfo)); + $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_PRISMARINE), "Prismarine Wall", $wallBreakInfo)); + $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_RED_NETHER_BRICK), "Red Nether Brick Wall", $wallBreakInfo)); + $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_RED_SANDSTONE), "Red Sandstone Wall", $wallBreakInfo)); + $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_SANDSTONE), "Sandstone Wall", $wallBreakInfo)); + $this->register(new Wall(new BID(Ids::COBBLESTONE_WALL, Meta::WALL_STONE_BRICK), "Stone Brick Wall", $wallBreakInfo)); $this->registerElements(); @@ -914,7 +959,7 @@ class BlockFactory{ } if($block === null){ - $block = new UnknownBlock(new BID($id, $meta)); + $block = new UnknownBlock(new BID($id, $meta), BlockBreakInfo::instant()); } return $block; diff --git a/src/block/BlueIce.php b/src/block/BlueIce.php index 7339f8271..bcd39d24c 100644 --- a/src/block/BlueIce.php +++ b/src/block/BlueIce.php @@ -27,10 +27,6 @@ use pocketmine\item\Item; class BlueIce extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(2.8, BlockToolType::PICKAXE)); - } - public function getLightLevel() : int{ return 1; } diff --git a/src/block/BoneBlock.php b/src/block/BoneBlock.php index 49ca51f9b..d00ab63f3 100644 --- a/src/block/BoneBlock.php +++ b/src/block/BoneBlock.php @@ -24,12 +24,7 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\block\utils\PillarRotationInMetadataTrait; -use pocketmine\item\ToolTier; class BoneBlock extends Opaque{ use PillarRotationInMetadataTrait; - - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(2.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel())); - } } diff --git a/src/block/Bookshelf.php b/src/block/Bookshelf.php index e72d99b96..2c4ec12a6 100644 --- a/src/block/Bookshelf.php +++ b/src/block/Bookshelf.php @@ -28,10 +28,6 @@ use pocketmine\item\VanillaItems; class Bookshelf extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(1.5, BlockToolType::AXE)); - } - public function getDropsForCompatibleTool(Item $item) : array{ return [ VanillaItems::BOOK()->setCount(3) diff --git a/src/block/BrewingStand.php b/src/block/BrewingStand.php index 8fca8f216..f94f73c2a 100644 --- a/src/block/BrewingStand.php +++ b/src/block/BrewingStand.php @@ -26,7 +26,6 @@ namespace pocketmine\block; use pocketmine\block\tile\BrewingStand as TileBrewingStand; use pocketmine\block\utils\BrewingStandSlot; use pocketmine\item\Item; -use pocketmine\item\ToolTier; use pocketmine\math\Vector3; use pocketmine\player\Player; use function array_key_exists; @@ -39,10 +38,6 @@ class BrewingStand extends Transparent{ */ protected $slots = []; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel())); - } - protected function writeStateToMeta() : int{ $flags = 0; foreach([ diff --git a/src/block/Cactus.php b/src/block/Cactus.php index dde4dac4d..69ea4eb98 100644 --- a/src/block/Cactus.php +++ b/src/block/Cactus.php @@ -40,10 +40,6 @@ class Cactus extends Transparent{ /** @var int */ protected $age = 0; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.4)); - } - protected function writeStateToMeta() : int{ return $this->age; } diff --git a/src/block/Cake.php b/src/block/Cake.php index 53f44a423..392657949 100644 --- a/src/block/Cake.php +++ b/src/block/Cake.php @@ -39,10 +39,6 @@ class Cake extends Transparent implements FoodSource{ /** @var int */ protected $bites = 0; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.5)); - } - protected function writeStateToMeta() : int{ return $this->bites; } diff --git a/src/block/Carpet.php b/src/block/Carpet.php index 19de695e6..8878b7b81 100644 --- a/src/block/Carpet.php +++ b/src/block/Carpet.php @@ -35,9 +35,9 @@ use pocketmine\world\BlockTransaction; class Carpet extends Flowable{ use ColorInMetadataTrait; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ + public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){ $this->color = DyeColor::WHITE(); - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.1)); + parent::__construct($idInfo, $name, $breakInfo); } public function isSolid() : bool{ diff --git a/src/block/Chest.php b/src/block/Chest.php index c48d3d1fa..46c5eb544 100644 --- a/src/block/Chest.php +++ b/src/block/Chest.php @@ -36,10 +36,6 @@ class Chest extends Transparent{ use FacesOppositePlacingPlayerTrait; use NormalHorizontalFacingInMetadataTrait; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(2.5, BlockToolType::AXE)); - } - /** * @return AxisAlignedBB[] */ diff --git a/src/block/Clay.php b/src/block/Clay.php index 2947a50be..8e86d4925 100644 --- a/src/block/Clay.php +++ b/src/block/Clay.php @@ -28,10 +28,6 @@ use pocketmine\item\VanillaItems; class Clay extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.6, BlockToolType::SHOVEL)); - } - public function getDropsForCompatibleTool(Item $item) : array{ return [ VanillaItems::CLAY()->setCount(4) diff --git a/src/block/Coal.php b/src/block/Coal.php index 27e86bc03..821c422de 100644 --- a/src/block/Coal.php +++ b/src/block/Coal.php @@ -23,14 +23,8 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\item\ToolTier; - class Coal extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(5.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 30.0)); - } - public function getFuelTime() : int{ return 16000; } diff --git a/src/block/CoalOre.php b/src/block/CoalOre.php index 33b514c09..3c87560b1 100644 --- a/src/block/CoalOre.php +++ b/src/block/CoalOre.php @@ -24,16 +24,11 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\item\Item; -use pocketmine\item\ToolTier; use pocketmine\item\VanillaItems; use function mt_rand; class CoalOre extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel())); - } - public function getDropsForCompatibleTool(Item $item) : array{ return [ VanillaItems::COAL() diff --git a/src/block/Cobweb.php b/src/block/Cobweb.php index 1f042ed29..680af1595 100644 --- a/src/block/Cobweb.php +++ b/src/block/Cobweb.php @@ -29,10 +29,6 @@ use pocketmine\item\VanillaItems; class Cobweb extends Flowable{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(4.0, BlockToolType::SWORD | BlockToolType::SHEARS, 1)); - } - public function hasEntityCollision() : bool{ return true; } diff --git a/src/block/CocoaBlock.php b/src/block/CocoaBlock.php index c725f50ca..0ccb57978 100644 --- a/src/block/CocoaBlock.php +++ b/src/block/CocoaBlock.php @@ -43,10 +43,6 @@ class CocoaBlock extends Transparent{ /** @var int */ protected $age = 0; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.2, BlockToolType::AXE, 0, 15.0)); - } - protected function writeStateToMeta() : int{ return BlockDataSerializer::writeLegacyHorizontalFacing(Facing::opposite($this->facing)) | ($this->age << 2); } diff --git a/src/block/Concrete.php b/src/block/Concrete.php index 6735c8dce..9feb5e093 100644 --- a/src/block/Concrete.php +++ b/src/block/Concrete.php @@ -25,13 +25,12 @@ namespace pocketmine\block; use pocketmine\block\utils\ColorInMetadataTrait; use pocketmine\block\utils\DyeColor; -use pocketmine\item\ToolTier; class Concrete extends Opaque{ use ColorInMetadataTrait; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ + public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){ $this->color = DyeColor::WHITE(); - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(1.8, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel())); + parent::__construct($idInfo, $name, $breakInfo); } } diff --git a/src/block/ConcretePowder.php b/src/block/ConcretePowder.php index 826230983..d65d682d2 100644 --- a/src/block/ConcretePowder.php +++ b/src/block/ConcretePowder.php @@ -35,9 +35,9 @@ class ConcretePowder extends Opaque implements Fallable{ onNearbyBlockChange as protected startFalling; } - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ + public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){ $this->color = DyeColor::WHITE(); - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.5, BlockToolType::SHOVEL)); + parent::__construct($idInfo, $name, $breakInfo); } public function onNearbyBlockChange() : void{ diff --git a/src/block/CraftingTable.php b/src/block/CraftingTable.php index d4f0259ed..a3d1dc47f 100644 --- a/src/block/CraftingTable.php +++ b/src/block/CraftingTable.php @@ -30,10 +30,6 @@ use pocketmine\player\Player; class CraftingTable extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(2.5, BlockToolType::AXE)); - } - public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{ if($player instanceof Player){ $player->setCraftingGrid(new CraftingGrid($player, CraftingGrid::SIZE_BIG)); diff --git a/src/block/Crops.php b/src/block/Crops.php index 67f98df95..d931fa371 100644 --- a/src/block/Crops.php +++ b/src/block/Crops.php @@ -37,10 +37,6 @@ abstract class Crops extends Flowable{ /** @var int */ protected $age = 0; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); - } - protected function writeStateToMeta() : int{ return $this->age; } diff --git a/src/block/DaylightSensor.php b/src/block/DaylightSensor.php index 594060bbb..68d5f6cab 100644 --- a/src/block/DaylightSensor.php +++ b/src/block/DaylightSensor.php @@ -44,8 +44,8 @@ class DaylightSensor extends Transparent{ /** @var bool */ protected $inverted = false; - public function __construct(BlockIdentifierFlattened $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.2, BlockToolType::AXE)); + public function __construct(BlockIdentifierFlattened $idInfo, string $name, BlockBreakInfo $breakInfo){ + parent::__construct($idInfo, $name, $breakInfo); } public function getId() : int{ diff --git a/src/block/DeadBush.php b/src/block/DeadBush.php index e4de2c8ab..3f6f4d8a7 100644 --- a/src/block/DeadBush.php +++ b/src/block/DeadBush.php @@ -33,10 +33,6 @@ use function mt_rand; class DeadBush extends Flowable{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant(BlockToolType::SHEARS, 1)); - } - public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{ if(!$this->getSide(Facing::DOWN)->isTransparent()){ return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player); diff --git a/src/block/DiamondOre.php b/src/block/DiamondOre.php index c6d104ba5..2307d30c2 100644 --- a/src/block/DiamondOre.php +++ b/src/block/DiamondOre.php @@ -24,16 +24,11 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\item\Item; -use pocketmine\item\ToolTier; use pocketmine\item\VanillaItems; use function mt_rand; class DiamondOre extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::IRON()->getHarvestLevel())); - } - public function getDropsForCompatibleTool(Item $item) : array{ return [ VanillaItems::DIAMOND() diff --git a/src/block/Dirt.php b/src/block/Dirt.php index 7dab9b009..3bc27aa15 100644 --- a/src/block/Dirt.php +++ b/src/block/Dirt.php @@ -31,10 +31,6 @@ use pocketmine\player\Player; class Dirt extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.5, BlockToolType::SHOVEL)); - } - public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{ if($face === Facing::UP and $item instanceof Hoe){ $item->applyDamage(1); diff --git a/src/block/DoublePlant.php b/src/block/DoublePlant.php index b558ff756..aade01829 100644 --- a/src/block/DoublePlant.php +++ b/src/block/DoublePlant.php @@ -34,10 +34,6 @@ class DoublePlant extends Flowable{ /** @var bool */ protected $top = false; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); - } - protected function writeStateToMeta() : int{ return ($this->top ? BlockLegacyMetadata::DOUBLE_PLANT_FLAG_TOP : 0); } diff --git a/src/block/DoubleTallGrass.php b/src/block/DoubleTallGrass.php index dedf3dc5f..7c6769800 100644 --- a/src/block/DoubleTallGrass.php +++ b/src/block/DoubleTallGrass.php @@ -29,10 +29,6 @@ use function mt_rand; class DoubleTallGrass extends DoublePlant{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant(BlockToolType::SHEARS, 1)); - } - public function canBeReplaced() : bool{ return true; } diff --git a/src/block/DragonEgg.php b/src/block/DragonEgg.php index 5a2afff3f..8f02a740a 100644 --- a/src/block/DragonEgg.php +++ b/src/block/DragonEgg.php @@ -27,7 +27,6 @@ use pocketmine\block\utils\Fallable; use pocketmine\block\utils\FallableTrait; use pocketmine\event\block\BlockTeleportEvent; use pocketmine\item\Item; -use pocketmine\item\ToolTier; use pocketmine\math\Vector3; use pocketmine\player\GameMode; use pocketmine\player\Player; @@ -40,10 +39,6 @@ use function mt_rand; class DragonEgg extends Transparent implements Fallable{ use FallableTrait; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel())); - } - public function getLightLevel() : int{ return 1; } diff --git a/src/block/EmeraldOre.php b/src/block/EmeraldOre.php index ec630c3bb..09d8f3a5a 100644 --- a/src/block/EmeraldOre.php +++ b/src/block/EmeraldOre.php @@ -24,16 +24,11 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\item\Item; -use pocketmine\item\ToolTier; use pocketmine\item\VanillaItems; use function mt_rand; class EmeraldOre extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::IRON()->getHarvestLevel())); - } - public function getDropsForCompatibleTool(Item $item) : array{ return [ VanillaItems::EMERALD() diff --git a/src/block/EnchantingTable.php b/src/block/EnchantingTable.php index d59e258dd..9a402a827 100644 --- a/src/block/EnchantingTable.php +++ b/src/block/EnchantingTable.php @@ -25,7 +25,6 @@ namespace pocketmine\block; use pocketmine\block\inventory\EnchantInventory; use pocketmine\item\Item; -use pocketmine\item\ToolTier; use pocketmine\math\AxisAlignedBB; use pocketmine\math\Facing; use pocketmine\math\Vector3; @@ -33,10 +32,6 @@ use pocketmine\player\Player; class EnchantingTable extends Transparent{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(5.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 6000.0)); - } - /** * @return AxisAlignedBB[] */ diff --git a/src/block/EndPortalFrame.php b/src/block/EndPortalFrame.php index 2a553a2a9..b1ec84fa6 100644 --- a/src/block/EndPortalFrame.php +++ b/src/block/EndPortalFrame.php @@ -36,10 +36,6 @@ class EndPortalFrame extends Opaque{ /** @var bool */ protected $eye = false; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::indestructible()); - } - protected function writeStateToMeta() : int{ return BlockDataSerializer::writeLegacyHorizontalFacing($this->facing) | ($this->eye ? BlockLegacyMetadata::END_PORTAL_FRAME_FLAG_EYE : 0); } diff --git a/src/block/EndRod.php b/src/block/EndRod.php index a943e07c1..39c28a097 100644 --- a/src/block/EndRod.php +++ b/src/block/EndRod.php @@ -36,10 +36,6 @@ use pocketmine\world\BlockTransaction; class EndRod extends Flowable{ use AnyFacingTrait; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); - } - protected function writeStateToMeta() : int{ $result = BlockDataSerializer::writeFacing($this->facing); if(Facing::axis($this->facing) !== Axis::Y){ diff --git a/src/block/EnderChest.php b/src/block/EnderChest.php index be96d4443..f633a12ca 100644 --- a/src/block/EnderChest.php +++ b/src/block/EnderChest.php @@ -28,7 +28,6 @@ use pocketmine\block\tile\EnderChest as TileEnderChest; use pocketmine\block\utils\FacesOppositePlacingPlayerTrait; use pocketmine\block\utils\NormalHorizontalFacingInMetadataTrait; use pocketmine\item\Item; -use pocketmine\item\ToolTier; use pocketmine\math\AxisAlignedBB; use pocketmine\math\Facing; use pocketmine\math\Vector3; @@ -38,10 +37,6 @@ class EnderChest extends Transparent{ use FacesOppositePlacingPlayerTrait; use NormalHorizontalFacingInMetadataTrait; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(22.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 3000.0)); - } - public function getLightLevel() : int{ return 7; } diff --git a/src/block/Farmland.php b/src/block/Farmland.php index 65a0f77b2..fd1aecf07 100644 --- a/src/block/Farmland.php +++ b/src/block/Farmland.php @@ -33,10 +33,6 @@ class Farmland extends Transparent{ /** @var int */ protected $wetness = 0; //"moisture" blockstate property in PC - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.6, BlockToolType::SHOVEL)); - } - protected function writeStateToMeta() : int{ return $this->wetness; } diff --git a/src/block/FenceGate.php b/src/block/FenceGate.php index 2f97c4105..6e1b4defa 100644 --- a/src/block/FenceGate.php +++ b/src/block/FenceGate.php @@ -41,10 +41,6 @@ class FenceGate extends Transparent{ /** @var bool */ protected $inWall = false; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(2.0, BlockToolType::AXE)); - } - protected function writeStateToMeta() : int{ return BlockDataSerializer::writeLegacyHorizontalFacing($this->facing) | ($this->open ? BlockLegacyMetadata::FENCE_GATE_FLAG_OPEN : 0) | diff --git a/src/block/Fire.php b/src/block/Fire.php index 45f3f8f6e..14fc8cd6f 100644 --- a/src/block/Fire.php +++ b/src/block/Fire.php @@ -40,10 +40,6 @@ class Fire extends Flowable{ /** @var int */ protected $age = 0; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); - } - protected function writeStateToMeta() : int{ return $this->age; } diff --git a/src/block/Flower.php b/src/block/Flower.php index 564008585..7ccef8f77 100644 --- a/src/block/Flower.php +++ b/src/block/Flower.php @@ -31,10 +31,6 @@ use pocketmine\world\BlockTransaction; class Flower extends Flowable{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); - } - public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{ $down = $this->getSide(Facing::DOWN); if($down->getId() === BlockLegacyIds::GRASS or $down->getId() === BlockLegacyIds::DIRT or $down->getId() === BlockLegacyIds::FARMLAND){ diff --git a/src/block/FlowerPot.php b/src/block/FlowerPot.php index ce787ae02..b5f7eedff 100644 --- a/src/block/FlowerPot.php +++ b/src/block/FlowerPot.php @@ -43,10 +43,6 @@ class FlowerPot extends Flowable{ /** @var Block|null */ protected $plant = null; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); - } - protected function writeStateToMeta() : int{ return $this->occupied ? BlockLegacyMetadata::FLOWER_POT_FLAG_OCCUPIED : 0; } diff --git a/src/block/FrostedIce.php b/src/block/FrostedIce.php index f98a12d63..0099b71cf 100644 --- a/src/block/FrostedIce.php +++ b/src/block/FrostedIce.php @@ -31,10 +31,6 @@ class FrostedIce extends Ice{ /** @var int */ protected $age = 0; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(2.5, BlockToolType::PICKAXE)); - } - public function readStateFromData(int $id, int $stateMeta) : void{ $this->age = BlockDataSerializer::readBoundedInt("age", $stateMeta, 0, 3); } diff --git a/src/block/Furnace.php b/src/block/Furnace.php index 5977da582..6a01b994c 100644 --- a/src/block/Furnace.php +++ b/src/block/Furnace.php @@ -27,7 +27,6 @@ use pocketmine\block\tile\Furnace as TileFurnace; use pocketmine\block\utils\FacesOppositePlacingPlayerTrait; use pocketmine\block\utils\NormalHorizontalFacingInMetadataTrait; use pocketmine\item\Item; -use pocketmine\item\ToolTier; use pocketmine\math\Vector3; use pocketmine\player\Player; @@ -43,8 +42,8 @@ class Furnace extends Opaque{ /** @var bool */ protected $lit = false; //this is set based on the blockID - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(3.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel())); + public function __construct(BlockIdentifierFlattened $idInfo, string $name, BlockBreakInfo $breakInfo){ + parent::__construct($idInfo, $name, $breakInfo); } public function getId() : int{ diff --git a/src/block/Glass.php b/src/block/Glass.php index 1eb1d3516..dc1e2f9b8 100644 --- a/src/block/Glass.php +++ b/src/block/Glass.php @@ -27,10 +27,6 @@ use pocketmine\item\Item; class Glass extends Transparent{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.3)); - } - public function getDropsForCompatibleTool(Item $item) : array{ return []; } diff --git a/src/block/GlassPane.php b/src/block/GlassPane.php index a549ef4cc..06342541d 100644 --- a/src/block/GlassPane.php +++ b/src/block/GlassPane.php @@ -27,10 +27,6 @@ use pocketmine\item\Item; class GlassPane extends Thin{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.3)); - } - public function getDropsForCompatibleTool(Item $item) : array{ return []; } diff --git a/src/block/GlazedTerracotta.php b/src/block/GlazedTerracotta.php index 5e81b2cc8..6cd41c8f8 100644 --- a/src/block/GlazedTerracotta.php +++ b/src/block/GlazedTerracotta.php @@ -25,13 +25,8 @@ namespace pocketmine\block; use pocketmine\block\utils\FacesOppositePlacingPlayerTrait; use pocketmine\block\utils\NormalHorizontalFacingInMetadataTrait; -use pocketmine\item\ToolTier; class GlazedTerracotta extends Opaque{ use FacesOppositePlacingPlayerTrait; use NormalHorizontalFacingInMetadataTrait; - - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(1.4, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel())); - } } diff --git a/src/block/GlowingObsidian.php b/src/block/GlowingObsidian.php index c3a515595..ff29363f5 100644 --- a/src/block/GlowingObsidian.php +++ b/src/block/GlowingObsidian.php @@ -23,14 +23,8 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\item\ToolTier; - class GlowingObsidian extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(10.0, BlockToolType::PICKAXE, ToolTier::DIAMOND()->getHarvestLevel(), 50.0)); - } - public function getLightLevel() : int{ return 12; } diff --git a/src/block/Glowstone.php b/src/block/Glowstone.php index aa63125af..38886405f 100644 --- a/src/block/Glowstone.php +++ b/src/block/Glowstone.php @@ -29,10 +29,6 @@ use function mt_rand; class Glowstone extends Transparent{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.3, BlockToolType::PICKAXE)); - } - public function getLightLevel() : int{ return 15; } diff --git a/src/block/Grass.php b/src/block/Grass.php index becdf86de..02c097c18 100644 --- a/src/block/Grass.php +++ b/src/block/Grass.php @@ -37,10 +37,6 @@ use function mt_rand; class Grass extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.6, BlockToolType::SHOVEL)); - } - public function getDropsForCompatibleTool(Item $item) : array{ return [ VanillaBlocks::DIRT()->asItem() diff --git a/src/block/GrassPath.php b/src/block/GrassPath.php index f94fcba54..b3b8f1f4c 100644 --- a/src/block/GrassPath.php +++ b/src/block/GrassPath.php @@ -29,10 +29,6 @@ use pocketmine\math\Facing; class GrassPath extends Transparent{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.6, BlockToolType::SHOVEL)); - } - /** * @return AxisAlignedBB[] */ diff --git a/src/block/Gravel.php b/src/block/Gravel.php index a3cf7b07e..9cc7f3fea 100644 --- a/src/block/Gravel.php +++ b/src/block/Gravel.php @@ -32,10 +32,6 @@ use function mt_rand; class Gravel extends Opaque implements Fallable{ use FallableTrait; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.6, BlockToolType::SHOVEL)); - } - public function getDropsForCompatibleTool(Item $item) : array{ if(mt_rand(1, 10) === 1){ return [ diff --git a/src/block/HardenedClay.php b/src/block/HardenedClay.php index 1617a738c..d1bcbd472 100644 --- a/src/block/HardenedClay.php +++ b/src/block/HardenedClay.php @@ -23,11 +23,6 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\item\ToolTier; - class HardenedClay extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(1.25, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 21.0)); - } } diff --git a/src/block/HardenedGlass.php b/src/block/HardenedGlass.php index 39a506696..f9bfdd086 100644 --- a/src/block/HardenedGlass.php +++ b/src/block/HardenedGlass.php @@ -25,7 +25,4 @@ namespace pocketmine\block; class HardenedGlass extends Transparent{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(10.0)); - } } diff --git a/src/block/HardenedGlassPane.php b/src/block/HardenedGlassPane.php index 2d9173e60..da6a60f53 100644 --- a/src/block/HardenedGlassPane.php +++ b/src/block/HardenedGlassPane.php @@ -25,7 +25,4 @@ namespace pocketmine\block; class HardenedGlassPane extends Thin{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(10.0)); - } } diff --git a/src/block/HayBale.php b/src/block/HayBale.php index 6d70a8230..abf25e8a1 100644 --- a/src/block/HayBale.php +++ b/src/block/HayBale.php @@ -28,10 +28,6 @@ use pocketmine\block\utils\PillarRotationInMetadataTrait; class HayBale extends Opaque{ use PillarRotationInMetadataTrait; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.5)); - } - public function getFlameEncouragement() : int{ return 60; } diff --git a/src/block/Ice.php b/src/block/Ice.php index b22278fb0..3c39f97bd 100644 --- a/src/block/Ice.php +++ b/src/block/Ice.php @@ -29,10 +29,6 @@ use pocketmine\player\Player; class Ice extends Transparent{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.5, BlockToolType::PICKAXE)); - } - public function getLightFilter() : int{ return 2; } diff --git a/src/block/InfestedStone.php b/src/block/InfestedStone.php index 00188ff2f..944d0e456 100644 --- a/src/block/InfestedStone.php +++ b/src/block/InfestedStone.php @@ -29,8 +29,8 @@ final class InfestedStone extends Opaque{ private int $imitated; - public function __construct(BlockIdentifier $idInfo, string $name, Block $imitated, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.75)); + public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo, Block $imitated){ + parent::__construct($idInfo, $name, $breakInfo); $this->imitated = $imitated->getFullId(); } diff --git a/src/block/ItemFrame.php b/src/block/ItemFrame.php index 3b8a32eba..673751938 100644 --- a/src/block/ItemFrame.php +++ b/src/block/ItemFrame.php @@ -47,10 +47,6 @@ class ItemFrame extends Flowable{ /** @var float */ protected $itemDropChance = 1.0; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.25)); - } - protected function writeStateToMeta() : int{ return BlockDataSerializer::write5MinusHorizontalFacing($this->facing) | ($this->hasMap ? BlockLegacyMetadata::ITEM_FRAME_FLAG_HAS_MAP : 0); } diff --git a/src/block/Jukebox.php b/src/block/Jukebox.php index 608e9194c..6d192bbe2 100644 --- a/src/block/Jukebox.php +++ b/src/block/Jukebox.php @@ -35,11 +35,6 @@ class Jukebox extends Opaque{ /** @var Record|null */ private $record = null; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - //TODO: in PC the hardness is 2.0, not 0.8, unsure if this is a MCPE bug or not - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.8, BlockToolType::AXE)); - } - public function getFuelTime() : int{ return 300; } diff --git a/src/block/Ladder.php b/src/block/Ladder.php index eb6f43d38..978d29d65 100644 --- a/src/block/Ladder.php +++ b/src/block/Ladder.php @@ -37,10 +37,6 @@ use pocketmine\world\BlockTransaction; class Ladder extends Transparent{ use NormalHorizontalFacingInMetadataTrait; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.4, BlockToolType::AXE)); - } - public function hasEntityCollision() : bool{ return true; } diff --git a/src/block/LapisOre.php b/src/block/LapisOre.php index fc4accccb..7dd434c79 100644 --- a/src/block/LapisOre.php +++ b/src/block/LapisOre.php @@ -24,16 +24,11 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\item\Item; -use pocketmine\item\ToolTier; use pocketmine\item\VanillaItems; use function mt_rand; class LapisOre extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::STONE()->getHarvestLevel())); - } - public function getDropsForCompatibleTool(Item $item) : array{ return [ VanillaItems::LAPIS_LAZULI()->setCount(mt_rand(4, 8)) diff --git a/src/block/Leaves.php b/src/block/Leaves.php index c9408b0c6..5578c6be6 100644 --- a/src/block/Leaves.php +++ b/src/block/Leaves.php @@ -45,8 +45,8 @@ class Leaves extends Transparent{ /** @var bool */ protected $checkDecay = false; - public function __construct(BlockIdentifier $idInfo, string $name, TreeType $treeType, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.2, BlockToolType::SHEARS)); + public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo, TreeType $treeType){ + parent::__construct($idInfo, $name, $breakInfo); $this->treeType = $treeType; } diff --git a/src/block/Lever.php b/src/block/Lever.php index 4dd69b18b..027ea6525 100644 --- a/src/block/Lever.php +++ b/src/block/Lever.php @@ -45,10 +45,6 @@ class Lever extends Flowable{ /** @var bool */ protected $powered = false; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.5)); - } - protected function writeStateToMeta() : int{ if($this->leverPos === self::BOTTOM){ $rotationMeta = Facing::axis($this->facing) === Axis::Z ? 7 : 0; diff --git a/src/block/Liquid.php b/src/block/Liquid.php index bbcebc227..4c7f5230b 100644 --- a/src/block/Liquid.php +++ b/src/block/Liquid.php @@ -62,8 +62,8 @@ abstract class Liquid extends Transparent{ /** @var bool */ protected $still = false; - public function __construct(BlockIdentifierFlattened $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::indestructible(500.0)); + public function __construct(BlockIdentifierFlattened $idInfo, string $name, BlockBreakInfo $breakInfo){ + parent::__construct($idInfo, $name, $breakInfo); } public function getId() : int{ diff --git a/src/block/Magma.php b/src/block/Magma.php index 2993e1e6b..e698a6431 100644 --- a/src/block/Magma.php +++ b/src/block/Magma.php @@ -27,14 +27,9 @@ use pocketmine\entity\Entity; use pocketmine\entity\Living; use pocketmine\event\entity\EntityDamageByBlockEvent; use pocketmine\event\entity\EntityDamageEvent; -use pocketmine\item\ToolTier; class Magma extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel())); - } - public function getLightLevel() : int{ return 3; } diff --git a/src/block/Melon.php b/src/block/Melon.php index 35502475e..9536e5c85 100644 --- a/src/block/Melon.php +++ b/src/block/Melon.php @@ -29,10 +29,6 @@ use function mt_rand; class Melon extends Transparent{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(1.0, BlockToolType::AXE)); - } - public function getDropsForCompatibleTool(Item $item) : array{ return [ VanillaItems::MELON()->setCount(mt_rand(3, 7)) diff --git a/src/block/MonsterSpawner.php b/src/block/MonsterSpawner.php index d2599e134..5ecc202b8 100644 --- a/src/block/MonsterSpawner.php +++ b/src/block/MonsterSpawner.php @@ -24,15 +24,10 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\item\Item; -use pocketmine\item\ToolTier; use function mt_rand; class MonsterSpawner extends Transparent{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(5.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel())); - } - public function getDropsForCompatibleTool(Item $item) : array{ return []; } diff --git a/src/block/Mycelium.php b/src/block/Mycelium.php index 8308875ef..940cb00dc 100644 --- a/src/block/Mycelium.php +++ b/src/block/Mycelium.php @@ -30,10 +30,6 @@ use function mt_rand; class Mycelium extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.6, BlockToolType::SHOVEL)); - } - public function getDropsForCompatibleTool(Item $item) : array{ return [ VanillaBlocks::DIRT()->asItem() diff --git a/src/block/NetherPortal.php b/src/block/NetherPortal.php index 70260994a..d5cc01cd8 100644 --- a/src/block/NetherPortal.php +++ b/src/block/NetherPortal.php @@ -32,10 +32,6 @@ class NetherPortal extends Transparent{ /** @var int */ protected $axis = Axis::X; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::indestructible(0.0)); - } - public function readStateFromData(int $id, int $stateMeta) : void{ $this->axis = $stateMeta === BlockLegacyMetadata::NETHER_PORTAL_AXIS_Z ? Axis::Z : Axis::X; //mojang u dumb } diff --git a/src/block/NetherQuartzOre.php b/src/block/NetherQuartzOre.php index eab0898c4..0eb9365ad 100644 --- a/src/block/NetherQuartzOre.php +++ b/src/block/NetherQuartzOre.php @@ -24,16 +24,11 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\item\Item; -use pocketmine\item\ToolTier; use pocketmine\item\VanillaItems; use function mt_rand; class NetherQuartzOre extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel())); - } - public function getDropsForCompatibleTool(Item $item) : array{ return [ VanillaItems::NETHER_QUARTZ() diff --git a/src/block/NetherReactor.php b/src/block/NetherReactor.php index 632ac3933..f5c4272f6 100644 --- a/src/block/NetherReactor.php +++ b/src/block/NetherReactor.php @@ -25,7 +25,6 @@ namespace pocketmine\block; use pocketmine\block\utils\BlockDataSerializer; use pocketmine\item\Item; -use pocketmine\item\ToolTier; use pocketmine\item\VanillaItems; class NetherReactor extends Opaque{ @@ -33,10 +32,6 @@ class NetherReactor extends Opaque{ /** @var int */ protected $state = BlockLegacyMetadata::NETHER_REACTOR_INACTIVE; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel())); - } - protected function writeStateToMeta() : int{ return $this->state; } diff --git a/src/block/NetherWartPlant.php b/src/block/NetherWartPlant.php index 5f635f3ad..028eba936 100644 --- a/src/block/NetherWartPlant.php +++ b/src/block/NetherWartPlant.php @@ -37,10 +37,6 @@ class NetherWartPlant extends Flowable{ /** @var int */ protected $age = 0; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); - } - protected function writeStateToMeta() : int{ return $this->age; } diff --git a/src/block/Netherrack.php b/src/block/Netherrack.php index 895a07802..e9fb51728 100644 --- a/src/block/Netherrack.php +++ b/src/block/Netherrack.php @@ -23,14 +23,8 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\item\ToolTier; - class Netherrack extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.4, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel())); - } - public function burnsForever() : bool{ return true; } diff --git a/src/block/Note.php b/src/block/Note.php index 846a4dfe5..ee78207e1 100644 --- a/src/block/Note.php +++ b/src/block/Note.php @@ -33,10 +33,6 @@ class Note extends Opaque{ /** @var int */ private $pitch = self::MIN_PITCH; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.8, BlockToolType::AXE)); - } - public function readStateFromWorld() : void{ parent::readStateFromWorld(); $tile = $this->pos->getWorld()->getTile($this->pos); diff --git a/src/block/PackedIce.php b/src/block/PackedIce.php index 0d52af4aa..e6d104f39 100644 --- a/src/block/PackedIce.php +++ b/src/block/PackedIce.php @@ -27,10 +27,6 @@ use pocketmine\item\Item; class PackedIce extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.5, BlockToolType::PICKAXE)); - } - public function getFrictionFactor() : float{ return 0.98; } diff --git a/src/block/Planks.php b/src/block/Planks.php index e7632f87a..b34046cdb 100644 --- a/src/block/Planks.php +++ b/src/block/Planks.php @@ -25,10 +25,6 @@ namespace pocketmine\block; class Planks extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(2.0, BlockToolType::AXE, 0, 15.0)); - } - public function getFuelTime() : int{ return 300; } diff --git a/src/block/Podzol.php b/src/block/Podzol.php index 47e7c1432..8da535c54 100644 --- a/src/block/Podzol.php +++ b/src/block/Podzol.php @@ -25,7 +25,4 @@ namespace pocketmine\block; class Podzol extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.5, BlockToolType::SHOVEL)); - } } diff --git a/src/block/RedMushroom.php b/src/block/RedMushroom.php index 72d3bb5ec..3ca1a0bdb 100644 --- a/src/block/RedMushroom.php +++ b/src/block/RedMushroom.php @@ -31,10 +31,6 @@ use pocketmine\world\BlockTransaction; class RedMushroom extends Flowable{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); - } - public function ticksRandomly() : bool{ return true; } diff --git a/src/block/Redstone.php b/src/block/Redstone.php index 7f06a706c..c149650d7 100644 --- a/src/block/Redstone.php +++ b/src/block/Redstone.php @@ -23,11 +23,6 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\item\ToolTier; - class Redstone extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(5.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 30.0)); - } } diff --git a/src/block/RedstoneComparator.php b/src/block/RedstoneComparator.php index 883a8152e..96abcfde9 100644 --- a/src/block/RedstoneComparator.php +++ b/src/block/RedstoneComparator.php @@ -47,8 +47,8 @@ class RedstoneComparator extends Flowable{ /** @var bool */ protected $isSubtractMode = false; - public function __construct(BlockIdentifierFlattened $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); + public function __construct(BlockIdentifierFlattened $idInfo, string $name, BlockBreakInfo $breakInfo){ + parent::__construct($idInfo, $name, $breakInfo); } public function getId() : int{ diff --git a/src/block/RedstoneLamp.php b/src/block/RedstoneLamp.php index 0d538167d..f9694ee39 100644 --- a/src/block/RedstoneLamp.php +++ b/src/block/RedstoneLamp.php @@ -31,8 +31,8 @@ class RedstoneLamp extends Opaque{ /** @var BlockIdentifierFlattened */ protected $idInfo; - public function __construct(BlockIdentifierFlattened $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.3)); + public function __construct(BlockIdentifierFlattened $idInfo, string $name, BlockBreakInfo $breakInfo){ + parent::__construct($idInfo, $name, $breakInfo); } public function getId() : int{ diff --git a/src/block/RedstoneOre.php b/src/block/RedstoneOre.php index 9cfb07da5..ecbb215c8 100644 --- a/src/block/RedstoneOre.php +++ b/src/block/RedstoneOre.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\item\Item; -use pocketmine\item\ToolTier; use pocketmine\item\VanillaItems; use pocketmine\math\Vector3; use pocketmine\player\Player; @@ -37,8 +36,8 @@ class RedstoneOre extends Opaque{ /** @var bool */ protected $lit = false; - public function __construct(BlockIdentifierFlattened $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::IRON()->getHarvestLevel())); + public function __construct(BlockIdentifierFlattened $idInfo, string $name, BlockBreakInfo $breakInfo){ + parent::__construct($idInfo, $name, $breakInfo); } public function getId() : int{ diff --git a/src/block/RedstoneRepeater.php b/src/block/RedstoneRepeater.php index 374034060..238a5dc42 100644 --- a/src/block/RedstoneRepeater.php +++ b/src/block/RedstoneRepeater.php @@ -43,8 +43,8 @@ class RedstoneRepeater extends Flowable{ /** @var int */ protected $delay = 1; - public function __construct(BlockIdentifierFlattened $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); + public function __construct(BlockIdentifierFlattened $idInfo, string $name, BlockBreakInfo $breakInfo){ + parent::__construct($idInfo, $name, $breakInfo); } public function getId() : int{ diff --git a/src/block/RedstoneTorch.php b/src/block/RedstoneTorch.php index c47765b15..1c5a9332c 100644 --- a/src/block/RedstoneTorch.php +++ b/src/block/RedstoneTorch.php @@ -31,8 +31,8 @@ class RedstoneTorch extends Torch{ /** @var bool */ protected $lit = true; - public function __construct(BlockIdentifierFlattened $idInfo, string $name){ - parent::__construct($idInfo, $name); + public function __construct(BlockIdentifierFlattened $idInfo, string $name, BlockBreakInfo $breakInfo){ + parent::__construct($idInfo, $name, $breakInfo); } public function getId() : int{ diff --git a/src/block/RedstoneWire.php b/src/block/RedstoneWire.php index ebc0c221e..6c2140406 100644 --- a/src/block/RedstoneWire.php +++ b/src/block/RedstoneWire.php @@ -29,10 +29,6 @@ use pocketmine\block\utils\BlockDataSerializer; class RedstoneWire extends Flowable{ use AnalogRedstoneSignalEmitterTrait; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); - } - public function readStateFromData(int $id, int $stateMeta) : void{ $this->signalStrength = BlockDataSerializer::readBoundedInt("signalStrength", $stateMeta, 0, 15); } diff --git a/src/block/Reserved6.php b/src/block/Reserved6.php index 940fbf33e..e2c6922e2 100644 --- a/src/block/Reserved6.php +++ b/src/block/Reserved6.php @@ -25,7 +25,4 @@ namespace pocketmine\block; class Reserved6 extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); - } } diff --git a/src/block/Sand.php b/src/block/Sand.php index 8516fdca9..e64b73d22 100644 --- a/src/block/Sand.php +++ b/src/block/Sand.php @@ -29,10 +29,6 @@ use pocketmine\block\utils\FallableTrait; class Sand extends Opaque implements Fallable{ use FallableTrait; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.5, BlockToolType::SHOVEL)); - } - public function tickFalling() : ?Block{ return null; } diff --git a/src/block/Sapling.php b/src/block/Sapling.php index f9d004de3..64f1f5ad6 100644 --- a/src/block/Sapling.php +++ b/src/block/Sapling.php @@ -41,8 +41,8 @@ class Sapling extends Flowable{ /** @var TreeType */ private $treeType; - public function __construct(BlockIdentifier $idInfo, string $name, TreeType $treeType, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); + public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo, TreeType $treeType){ + parent::__construct($idInfo, $name, $breakInfo); $this->treeType = $treeType; } diff --git a/src/block/SeaLantern.php b/src/block/SeaLantern.php index d222cf052..ffcf8e7aa 100644 --- a/src/block/SeaLantern.php +++ b/src/block/SeaLantern.php @@ -28,10 +28,6 @@ use pocketmine\item\VanillaItems; class SeaLantern extends Transparent{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.3)); - } - public function getLightLevel() : int{ return 15; } diff --git a/src/block/SeaPickle.php b/src/block/SeaPickle.php index e96beb131..22a2b4c21 100644 --- a/src/block/SeaPickle.php +++ b/src/block/SeaPickle.php @@ -35,10 +35,6 @@ class SeaPickle extends Transparent{ /** @var bool */ protected $underwater = false; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); - } - public function readStateFromData(int $id, int $stateMeta) : void{ $this->count = ($stateMeta & 0x03) + 1; $this->underwater = ($stateMeta & BlockLegacyMetadata::SEA_PICKLE_FLAG_NOT_UNDERWATER) === 0; diff --git a/src/block/Skull.php b/src/block/Skull.php index 6b5f13adb..625b0aa0e 100644 --- a/src/block/Skull.php +++ b/src/block/Skull.php @@ -50,9 +50,9 @@ class Skull extends Flowable{ /** @var int */ protected $rotation = 0; //TODO: split this into floor skull and wall skull handling - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ + public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){ $this->skullType = SkullType::SKELETON(); //TODO: this should be a parameter - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(1.0)); + parent::__construct($idInfo, $name, $breakInfo); } protected function writeStateToMeta() : int{ diff --git a/src/block/Snow.php b/src/block/Snow.php index 19077382d..eabe616ce 100644 --- a/src/block/Snow.php +++ b/src/block/Snow.php @@ -24,15 +24,10 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\item\Item; -use pocketmine\item\ToolTier; use pocketmine\item\VanillaItems; class Snow extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.2, BlockToolType::SHOVEL, ToolTier::WOOD()->getHarvestLevel())); - } - public function getDropsForCompatibleTool(Item $item) : array{ return [ VanillaItems::SNOWBALL()->setCount(4) diff --git a/src/block/SnowLayer.php b/src/block/SnowLayer.php index 1781497ae..a3bb8f395 100644 --- a/src/block/SnowLayer.php +++ b/src/block/SnowLayer.php @@ -27,7 +27,6 @@ use pocketmine\block\utils\BlockDataSerializer; use pocketmine\block\utils\Fallable; use pocketmine\block\utils\FallableTrait; use pocketmine\item\Item; -use pocketmine\item\ToolTier; use pocketmine\item\VanillaItems; use pocketmine\math\AxisAlignedBB; use pocketmine\math\Facing; @@ -43,10 +42,6 @@ class SnowLayer extends Flowable implements Fallable{ /** @var int */ protected $layers = 1; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.1, BlockToolType::SHOVEL, ToolTier::WOOD()->getHarvestLevel())); - } - protected function writeStateToMeta() : int{ return $this->layers - 1; } diff --git a/src/block/SoulSand.php b/src/block/SoulSand.php index 465b79784..46ec341c7 100644 --- a/src/block/SoulSand.php +++ b/src/block/SoulSand.php @@ -28,10 +28,6 @@ use pocketmine\math\Facing; class SoulSand extends Opaque{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.5, BlockToolType::SHOVEL)); - } - /** * @return AxisAlignedBB[] */ diff --git a/src/block/Sponge.php b/src/block/Sponge.php index 9d0325b9a..ea53c0d0d 100644 --- a/src/block/Sponge.php +++ b/src/block/Sponge.php @@ -28,10 +28,6 @@ class Sponge extends Opaque{ /** @var bool */ protected $wet = false; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.6, BlockToolType::HOE)); - } - protected function writeStateToMeta() : int{ return $this->wet ? BlockLegacyMetadata::SPONGE_FLAG_WET : 0; } diff --git a/src/block/Stem.php b/src/block/Stem.php index 6ef52f165..a70adfc45 100644 --- a/src/block/Stem.php +++ b/src/block/Stem.php @@ -31,10 +31,6 @@ use function mt_rand; abstract class Stem extends Crops{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); - } - abstract protected function getPlant() : Block; public function onRandomTick() : void{ diff --git a/src/block/StoneButton.php b/src/block/StoneButton.php index d92a3552f..110438b58 100644 --- a/src/block/StoneButton.php +++ b/src/block/StoneButton.php @@ -25,10 +25,6 @@ namespace pocketmine\block; class StoneButton extends Button{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.5, BlockToolType::PICKAXE)); - } - protected function getActivationTime() : int{ return 20; } diff --git a/src/block/StonePressurePlate.php b/src/block/StonePressurePlate.php index 7635d98c6..cd8bed86b 100644 --- a/src/block/StonePressurePlate.php +++ b/src/block/StonePressurePlate.php @@ -23,11 +23,6 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\item\ToolTier; - class StonePressurePlate extends SimplePressurePlate{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel())); - } } diff --git a/src/block/Sugarcane.php b/src/block/Sugarcane.php index 43aa30538..69e11b041 100644 --- a/src/block/Sugarcane.php +++ b/src/block/Sugarcane.php @@ -37,10 +37,6 @@ class Sugarcane extends Flowable{ /** @var int */ protected $age = 0; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); - } - protected function writeStateToMeta() : int{ return $this->age; } diff --git a/src/block/TNT.php b/src/block/TNT.php index d4bce585b..1dc00e1a9 100644 --- a/src/block/TNT.php +++ b/src/block/TNT.php @@ -45,10 +45,6 @@ class TNT extends Opaque{ protected $unstable = false; //TODO: Usage unclear, seems to be a weird hack in vanilla protected bool $worksUnderwater = false; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); - } - public function readStateFromData(int $id, int $stateMeta) : void{ $this->unstable = ($stateMeta & BlockLegacyMetadata::TNT_FLAG_UNSTABLE) !== 0; $this->worksUnderwater = ($stateMeta & BlockLegacyMetadata::TNT_FLAG_UNDERWATER) !== 0; diff --git a/src/block/TallGrass.php b/src/block/TallGrass.php index 88b3ac6ce..fd23ec720 100644 --- a/src/block/TallGrass.php +++ b/src/block/TallGrass.php @@ -33,10 +33,6 @@ use function mt_rand; class TallGrass extends Flowable{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant(BlockToolType::SHEARS, 1)); - } - public function canBeReplaced() : bool{ return true; } diff --git a/src/block/Torch.php b/src/block/Torch.php index 8c8a05d3e..478e989fa 100644 --- a/src/block/Torch.php +++ b/src/block/Torch.php @@ -35,10 +35,6 @@ class Torch extends Flowable{ /** @var int */ protected $facing = Facing::UP; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); - } - protected function writeStateToMeta() : int{ return $this->facing === Facing::UP ? 5 : 6 - BlockDataSerializer::writeHorizontalFacing($this->facing); } diff --git a/src/block/Tripwire.php b/src/block/Tripwire.php index e1d8c431f..bdb0ee8e9 100644 --- a/src/block/Tripwire.php +++ b/src/block/Tripwire.php @@ -34,10 +34,6 @@ class Tripwire extends Flowable{ /** @var bool */ protected $disarmed = false; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); - } - protected function writeStateToMeta() : int{ return ($this->triggered ? BlockLegacyMetadata::TRIPWIRE_FLAG_TRIGGERED : 0) | ($this->suspended ? BlockLegacyMetadata::TRIPWIRE_FLAG_SUSPENDED : 0) | diff --git a/src/block/TripwireHook.php b/src/block/TripwireHook.php index e7c61c5a0..dbdfebe7b 100644 --- a/src/block/TripwireHook.php +++ b/src/block/TripwireHook.php @@ -40,10 +40,6 @@ class TripwireHook extends Flowable{ /** @var bool */ protected $powered = false; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant()); - } - protected function writeStateToMeta() : int{ return BlockDataSerializer::writeLegacyHorizontalFacing($this->facing) | ($this->connected ? BlockLegacyMetadata::TRIPWIRE_HOOK_FLAG_CONNECTED : 0) | diff --git a/src/block/UnknownBlock.php b/src/block/UnknownBlock.php index ee2974b38..b13ecb48b 100644 --- a/src/block/UnknownBlock.php +++ b/src/block/UnknownBlock.php @@ -27,8 +27,8 @@ use pocketmine\item\Item; class UnknownBlock extends Transparent{ - public function __construct(BlockIdentifier $idInfo, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, "Unknown", $breakInfo ?? BlockBreakInfo::instant()); + public function __construct(BlockIdentifier $idInfo, BlockBreakInfo $breakInfo){ + parent::__construct($idInfo, "Unknown", $breakInfo); } public function canBePlaced() : bool{ diff --git a/src/block/Vine.php b/src/block/Vine.php index 6cbe53700..c67353c5a 100644 --- a/src/block/Vine.php +++ b/src/block/Vine.php @@ -38,10 +38,6 @@ class Vine extends Flowable{ /** @var int[] */ protected $faces = []; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.2, BlockToolType::AXE)); - } - protected function writeStateToMeta() : int{ return (isset($this->faces[Facing::SOUTH]) ? BlockLegacyMetadata::VINE_FLAG_SOUTH : 0) | diff --git a/src/block/Wall.php b/src/block/Wall.php index 462835e0b..daa67813a 100644 --- a/src/block/Wall.php +++ b/src/block/Wall.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\item\ToolTier; use pocketmine\math\AxisAlignedBB; use pocketmine\math\Facing; @@ -34,10 +33,6 @@ class Wall extends Transparent{ /** @var bool */ protected $up = false; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(2.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 30.0)); - } - public function readStateFromWorld() : void{ parent::readStateFromWorld(); diff --git a/src/block/WaterLily.php b/src/block/WaterLily.php index e4648d378..6b7f583e8 100644 --- a/src/block/WaterLily.php +++ b/src/block/WaterLily.php @@ -32,10 +32,6 @@ use pocketmine\world\BlockTransaction; class WaterLily extends Flowable{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.6)); - } - /** * @return AxisAlignedBB[] */ diff --git a/src/block/WeightedPressurePlateHeavy.php b/src/block/WeightedPressurePlateHeavy.php index 33b7fe08c..acc8068d9 100644 --- a/src/block/WeightedPressurePlateHeavy.php +++ b/src/block/WeightedPressurePlateHeavy.php @@ -23,11 +23,6 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\item\ToolTier; - class WeightedPressurePlateHeavy extends WeightedPressurePlate{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel())); - } } diff --git a/src/block/WeightedPressurePlateLight.php b/src/block/WeightedPressurePlateLight.php index 15ea238bf..877211f62 100644 --- a/src/block/WeightedPressurePlateLight.php +++ b/src/block/WeightedPressurePlateLight.php @@ -23,11 +23,6 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\item\ToolTier; - class WeightedPressurePlateLight extends WeightedPressurePlate{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel())); - } } diff --git a/src/block/Wood.php b/src/block/Wood.php index 56cab4cad..59aab1683 100644 --- a/src/block/Wood.php +++ b/src/block/Wood.php @@ -35,9 +35,9 @@ class Wood extends Opaque{ private bool $stripped; - public function __construct(BlockIdentifier $idInfo, string $name, TreeType $treeType, bool $stripped, ?BlockBreakInfo $breakInfo = null){ + public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo, TreeType $treeType, bool $stripped){ $this->stripped = $stripped; //TODO: this should be dynamic, but right now legacy shit gets in the way - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(2.0, BlockToolType::AXE)); + parent::__construct($idInfo, $name, $breakInfo); $this->treeType = $treeType; } diff --git a/src/block/WoodenButton.php b/src/block/WoodenButton.php index 9cfdb0dc7..44f4f867b 100644 --- a/src/block/WoodenButton.php +++ b/src/block/WoodenButton.php @@ -25,10 +25,6 @@ namespace pocketmine\block; class WoodenButton extends Button{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.5, BlockToolType::AXE)); - } - protected function getActivationTime() : int{ return 30; } diff --git a/src/block/WoodenDoor.php b/src/block/WoodenDoor.php index 4edd42a41..af6c7b25f 100644 --- a/src/block/WoodenDoor.php +++ b/src/block/WoodenDoor.php @@ -25,7 +25,4 @@ namespace pocketmine\block; class WoodenDoor extends Door{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(3.0, BlockToolType::AXE)); - } } diff --git a/src/block/WoodenFence.php b/src/block/WoodenFence.php index 070c36a1a..b128eca0f 100644 --- a/src/block/WoodenFence.php +++ b/src/block/WoodenFence.php @@ -25,10 +25,6 @@ namespace pocketmine\block; class WoodenFence extends Fence{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(2.0, BlockToolType::AXE, 0, 15.0)); - } - public function getFuelTime() : int{ return 300; } diff --git a/src/block/WoodenPressurePlate.php b/src/block/WoodenPressurePlate.php index 4e624d281..99e48c332 100644 --- a/src/block/WoodenPressurePlate.php +++ b/src/block/WoodenPressurePlate.php @@ -25,10 +25,6 @@ namespace pocketmine\block; class WoodenPressurePlate extends SimplePressurePlate{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.5, BlockToolType::AXE)); - } - public function getFuelTime() : int{ return 300; } diff --git a/src/block/WoodenSlab.php b/src/block/WoodenSlab.php index 9c713c2ac..91ec0f117 100644 --- a/src/block/WoodenSlab.php +++ b/src/block/WoodenSlab.php @@ -25,10 +25,6 @@ namespace pocketmine\block; class WoodenSlab extends Slab{ - public function __construct(BlockIdentifierFlattened $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(2.0, BlockToolType::AXE, 0, 15.0)); - } - public function getFuelTime() : int{ return 300; } diff --git a/src/block/WoodenStairs.php b/src/block/WoodenStairs.php index 2550d91a6..4d9009869 100644 --- a/src/block/WoodenStairs.php +++ b/src/block/WoodenStairs.php @@ -25,10 +25,6 @@ namespace pocketmine\block; class WoodenStairs extends Stair{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(2.0, BlockToolType::AXE, 0, 15.0)); - } - public function getFlameEncouragement() : int{ return 5; } diff --git a/src/block/WoodenTrapdoor.php b/src/block/WoodenTrapdoor.php index 07a73872c..7f0724452 100644 --- a/src/block/WoodenTrapdoor.php +++ b/src/block/WoodenTrapdoor.php @@ -25,10 +25,6 @@ namespace pocketmine\block; class WoodenTrapdoor extends Trapdoor{ - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ - parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(3.0, BlockToolType::AXE, 0, 15.0)); - } - public function getFuelTime() : int{ return 300; } diff --git a/src/block/Wool.php b/src/block/Wool.php index 14345c345..8dd0f28a3 100644 --- a/src/block/Wool.php +++ b/src/block/Wool.php @@ -25,24 +25,13 @@ namespace pocketmine\block; use pocketmine\block\utils\ColorInMetadataTrait; use pocketmine\block\utils\DyeColor; -use pocketmine\item\Item; class Wool extends Opaque{ use ColorInMetadataTrait; - public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){ + public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){ $this->color = DyeColor::WHITE(); - parent::__construct($idInfo, $name, $breakInfo ?? new class(0.8, BlockToolType::SHEARS) extends BlockBreakInfo{ - public function getBreakTime(Item $item) : float{ - $time = parent::getBreakTime($item); - if($item->getBlockToolType() === BlockToolType::SHEARS){ - $time *= 3; //shears break compatible blocks 15x faster, but wool 5x - } - - return $time; - } - } - ); + parent::__construct($idInfo, $name, $breakInfo); } public function getFlameEncouragement() : int{