Accept BlockTypeInfo in Block constructor, instead of BlockBreakInfo

this will allow more stuff to be passed via the constructor without having to change dozens of classes to do it.
This commit is contained in:
Dylan K. Taylor 2022-07-23 20:42:54 +01:00
parent 89b784734e
commit 6a2315a63d
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
41 changed files with 342 additions and 306 deletions

View File

@ -48,9 +48,9 @@ abstract class BaseBanner extends Transparent{
*/
protected array $patterns = [];
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->color = DyeColor::BLACK();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
public function readStateFromWorld() : Block{

View File

@ -31,8 +31,8 @@ use pocketmine\item\Item;
abstract class BaseCoral extends Transparent{
use CoralTypeTrait;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
parent::__construct($idInfo, $name, $breakInfo);
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
parent::__construct($idInfo, $name, $typeInfo);
$this->coralType = CoralType::TUBE();
}

View File

@ -51,9 +51,9 @@ abstract class BaseSign extends Transparent{
/**
* @param \Closure() : Item $asItemCallback
*/
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo, WoodType $woodType, \Closure $asItemCallback){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo, WoodType $woodType, \Closure $asItemCallback){
$this->woodType = $woodType;
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
$this->text = new SignText();
$this->asItemCallback = $asItemCallback;
}

View File

@ -49,9 +49,9 @@ class Bed extends Transparent{
protected bool $occupied = false;
protected bool $head = false;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->color = DyeColor::RED();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
public function getRequiredStateDataBits() : int{ return 4; }

View File

@ -42,9 +42,9 @@ final class Bell extends Transparent{
private BellAttachmentType $attachmentType;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->attachmentType = BellAttachmentType::FLOOR();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
public function getRequiredStateDataBits() : int{ return 4; }

View File

@ -65,10 +65,10 @@ class Block{
/**
* @param string $name English name of the block type (TODO: implement translations)
*/
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->idInfo = $idInfo;
$this->fallbackName = $name;
$this->breakInfo = $breakInfo;
$this->breakInfo = $typeInfo->getBreakInfo();
$this->position = new Position(0, 0, 0, null);
}

View File

@ -157,7 +157,7 @@ class BlockFactory{
}else{
$typeId = $stateId >> Block::INTERNAL_STATE_DATA_BITS;
$stateData = $stateId & Block::INTERNAL_STATE_DATA_MASK;
$block = new UnknownBlock(new BID($typeId), BreakInfo::instant(), $stateData);
$block = new UnknownBlock(new BID($typeId), new BlockTypeInfo(BreakInfo::instant()), $stateData);
}
return $block;

View File

@ -0,0 +1,33 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
final class BlockTypeInfo{
public function __construct(
private BlockBreakInfo $breakInfo,
){}
public function getBreakInfo() : BlockBreakInfo{ return $this->breakInfo; }
}

View File

@ -29,9 +29,9 @@ use pocketmine\block\utils\DyeColor;
class CakeWithDyedCandle extends CakeWithCandle{
use ColoredTrait;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->color = DyeColor::WHITE();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
public function getCandle() : Candle{

View File

@ -35,9 +35,9 @@ use pocketmine\world\BlockTransaction;
class Carpet extends Flowable{
use ColoredTrait;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->color = DyeColor::WHITE();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
public function isSolid() : bool{

View File

@ -29,8 +29,8 @@ use pocketmine\block\utils\DyeColor;
class Concrete extends Opaque{
use ColoredTrait;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->color = DyeColor::WHITE();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
}

View File

@ -36,9 +36,9 @@ class ConcretePowder extends Opaque implements Fallable{
onNearbyBlockChange as protected startFalling;
}
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->color = DyeColor::WHITE();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
public function onNearbyBlockChange() : void{

View File

@ -29,8 +29,8 @@ use pocketmine\block\utils\CopperTrait;
class CopperStairs extends Stair{
use CopperTrait;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->oxidation = CopperOxidation::NONE();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
}

View File

@ -31,9 +31,9 @@ use function mt_rand;
final class CoralBlock extends Opaque{
use CoralTypeTrait;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->coralType = CoralType::TUBE();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
public function onNearbyBlockChange() : void{

View File

@ -41,9 +41,9 @@ use pocketmine\world\sound\WaterSplashSound;
class Dirt extends Opaque{
protected DirtType $dirtType;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->dirtType = DirtType::NORMAL();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
public function getRequiredTypeDataBits() : int{ return 2; }

View File

@ -29,9 +29,9 @@ use pocketmine\block\utils\DyeColor;
class DyedCandle extends Candle{
use ColoredTrait;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->color = DyeColor::WHITE();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
protected function getCandleIfCompatibleType(Block $block) : ?Candle{

View File

@ -29,8 +29,8 @@ use pocketmine\block\utils\DyeColor;
final class DyedShulkerBox extends ShulkerBox{
use ColoredTrait;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->color = DyeColor::WHITE();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
}

View File

@ -27,12 +27,12 @@ class Element extends Opaque{
public function __construct(
BlockIdentifier $idInfo,
string $name,
BlockBreakInfo $breakInfo,
BlockTypeInfo $typeInfo,
private string $symbol,
private int $atomicWeight,
private int $group
){
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
public function getAtomicWeight() : int{

View File

@ -31,9 +31,9 @@ final class Froglight extends SimplePillar{
private FroglightType $froglightType;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->froglightType = FroglightType::OCHRE();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
public function getRequiredTypeDataBits() : int{ return 2; }

View File

@ -33,8 +33,8 @@ class GlazedTerracotta extends Opaque{
use FacesOppositePlacingPlayerTrait;
use HorizontalFacingTrait;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->color = DyeColor::BLACK();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
}

View File

@ -29,8 +29,8 @@ final class InfestedStone extends Opaque{
private int $imitated;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo, Block $imitated){
parent::__construct($idInfo, $name, $breakInfo);
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo, Block $imitated){
parent::__construct($idInfo, $name, $typeInfo);
$this->imitated = $imitated->getStateId();
}

View File

@ -39,9 +39,9 @@ class Lantern extends Transparent{
protected bool $hanging = false;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo, int $lightLevel){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo, int $lightLevel){
$this->lightLevel = $lightLevel;
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
public function getRequiredStateDataBits() : int{ return 1; }

View File

@ -43,8 +43,8 @@ class Leaves extends Transparent{
protected bool $noDecay = false;
protected bool $checkDecay = false;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo, TreeType $treeType){
parent::__construct($idInfo, $name, $breakInfo);
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo, TreeType $treeType){
parent::__construct($idInfo, $name, $typeInfo);
$this->treeType = $treeType;
}

View File

@ -40,9 +40,9 @@ class Lever extends Flowable{
protected LeverFacing $facing;
protected bool $activated = false;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->facing = LeverFacing::UP_AXIS_X();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
public function getRequiredStateDataBits() : int{ return 4; }

View File

@ -39,8 +39,8 @@ final class PotionCauldron extends FillableCauldron{
private ?Item $potionItem = null;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
parent::__construct($idInfo, $name, $breakInfo);
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
parent::__construct($idInfo, $name, $typeInfo);
}
public function readStateFromWorld() : Block{

View File

@ -32,9 +32,9 @@ use function mt_rand;
class RedMushroomBlock extends Opaque{
protected MushroomBlockType $mushroomBlockType;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->mushroomBlockType = MushroomBlockType::PORES();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
public function getRequiredStateDataBits() : int{ return 4; }

View File

@ -42,8 +42,8 @@ class Sapling extends Flowable{
private TreeType $treeType;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo, TreeType $treeType){
parent::__construct($idInfo, $name, $breakInfo);
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo, TreeType $treeType){
parent::__construct($idInfo, $name, $typeInfo);
$this->treeType = $treeType;
}

View File

@ -45,9 +45,9 @@ class Skull extends Flowable{
protected int $facing = Facing::NORTH;
protected int $rotation = self::MIN_ROTATION; //TODO: split this into floor skull and wall skull handling
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->skullType = SkullType::SKELETON(); //TODO: this should be a parameter
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
public function getRequiredTypeDataBits() : int{ return 3; }

View File

@ -37,8 +37,8 @@ use pocketmine\world\BlockTransaction;
class Slab extends Transparent{
protected SlabType $slabType;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
parent::__construct($idInfo, $name . " Slab", $breakInfo);
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
parent::__construct($idInfo, $name . " Slab", $typeInfo);
$this->slabType = SlabType::BOTTOM();
}

View File

@ -29,8 +29,8 @@ use pocketmine\block\utils\DyeColor;
final class StainedGlass extends Glass{
use ColoredTrait;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->color = DyeColor::WHITE();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
}

View File

@ -29,8 +29,8 @@ use pocketmine\block\utils\DyeColor;
final class StainedGlassPane extends GlassPane{
use ColoredTrait;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->color = DyeColor::WHITE();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
}

View File

@ -29,8 +29,8 @@ use pocketmine\block\utils\DyeColor;
final class StainedHardenedClay extends HardenedClay{
use ColoredTrait;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->color = DyeColor::WHITE();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
}

View File

@ -29,8 +29,8 @@ use pocketmine\block\utils\DyeColor;
final class StainedHardenedGlass extends HardenedGlass{
use ColoredTrait;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->color = DyeColor::WHITE();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
}

View File

@ -29,8 +29,8 @@ use pocketmine\block\utils\DyeColor;
final class StainedHardenedGlassPane extends HardenedGlassPane{
use ColoredTrait;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->color = DyeColor::WHITE();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
}

View File

@ -42,9 +42,9 @@ class Stair extends Transparent{
protected bool $upsideDown = false;
protected StairShape $shape;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->shape = StairShape::STRAIGHT();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
public function getRequiredStateDataBits() : int{ return 3; }

View File

@ -31,8 +31,8 @@ class UnknownBlock extends Transparent{
private int $stateData;
public function __construct(BlockIdentifier $idInfo, BlockBreakInfo $breakInfo, int $stateData){
parent::__construct($idInfo, "Unknown", $breakInfo);
public function __construct(BlockIdentifier $idInfo, BlockTypeInfo $typeInfo, int $stateData){
parent::__construct($idInfo, "Unknown", $typeInfo);
$this->stateData = $stateData;
}

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\BlockTypeInfo as Info;
use pocketmine\block\BlockBreakInfo as BreakInfo;
use pocketmine\block\BlockIdentifier as BID;
use pocketmine\block\BlockToolType as ToolType;
@ -738,159 +739,159 @@ final class VanillaBlocks{
}
protected static function setup() : void{
$railBreakInfo = new BlockBreakInfo(0.7);
$railBreakInfo = new Info(new BlockBreakInfo(0.7));
self::register("activator_rail", new ActivatorRail(new BID(Ids::ACTIVATOR_RAIL), "Activator Rail", $railBreakInfo));
self::register("air", new Air(new BID(Ids::AIR), "Air", BreakInfo::indestructible(-1.0)));
self::register("anvil", new Anvil(new BID(Ids::ANVIL), "Anvil", BreakInfo::pickaxe(5.0, ToolTier::WOOD(), 6000.0)));
self::register("bamboo", new Bamboo(new BID(Ids::BAMBOO), "Bamboo", new class(2.0 /* 1.0 in PC */, ToolType::AXE) extends BreakInfo{
self::register("air", new Air(new BID(Ids::AIR), "Air", new Info(BreakInfo::indestructible(-1.0))));
self::register("anvil", new Anvil(new BID(Ids::ANVIL), "Anvil", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD(), 6000.0))));
self::register("bamboo", new Bamboo(new BID(Ids::BAMBOO), "Bamboo", new Info(new class(2.0 /* 1.0 in PC */, ToolType::AXE) extends BreakInfo{
public function getBreakTime(Item $item) : float{
if($item->getBlockToolType() === ToolType::SWORD){
return 0.0;
}
return parent::getBreakTime($item);
}
}));
self::register("bamboo_sapling", new BambooSapling(new BID(Ids::BAMBOO_SAPLING), "Bamboo Sapling", BreakInfo::instant()));
})));
self::register("bamboo_sapling", new BambooSapling(new BID(Ids::BAMBOO_SAPLING), "Bamboo Sapling", new Info(BreakInfo::instant())));
$bannerBreakInfo = BreakInfo::axe(1.0);
$bannerBreakInfo = new Info(BreakInfo::axe(1.0));
self::register("banner", new FloorBanner(new BID(Ids::BANNER, TileBanner::class), "Banner", $bannerBreakInfo));
self::register("wall_banner", new WallBanner(new BID(Ids::WALL_BANNER, TileBanner::class), "Wall Banner", $bannerBreakInfo));
self::register("barrel", new Barrel(new BID(Ids::BARREL, TileBarrel::class), "Barrel", BreakInfo::axe(2.5)));
self::register("barrier", new Transparent(new BID(Ids::BARRIER), "Barrier", BreakInfo::indestructible()));
self::register("beacon", new Beacon(new BID(Ids::BEACON, TileBeacon::class), "Beacon", new BreakInfo(3.0)));
self::register("bed", new Bed(new BID(Ids::BED, TileBed::class), "Bed Block", new BreakInfo(0.2)));
self::register("bedrock", new Bedrock(new BID(Ids::BEDROCK), "Bedrock", BreakInfo::indestructible()));
self::register("barrel", new Barrel(new BID(Ids::BARREL, TileBarrel::class), "Barrel", new Info(BreakInfo::axe(2.5))));
self::register("barrier", new Transparent(new BID(Ids::BARRIER), "Barrier", new Info(BreakInfo::indestructible())));
self::register("beacon", new Beacon(new BID(Ids::BEACON, TileBeacon::class), "Beacon", new Info(new BreakInfo(3.0))));
self::register("bed", new Bed(new BID(Ids::BED, TileBed::class), "Bed Block", new Info(new BreakInfo(0.2))));
self::register("bedrock", new Bedrock(new BID(Ids::BEDROCK), "Bedrock", new Info(BreakInfo::indestructible())));
self::register("beetroots", new Beetroot(new BID(Ids::BEETROOTS), "Beetroot Block", BreakInfo::instant()));
self::register("bell", new Bell(new BID(Ids::BELL, TileBell::class), "Bell", BreakInfo::pickaxe(5.0, ToolTier::WOOD())));
self::register("blue_ice", new BlueIce(new BID(Ids::BLUE_ICE), "Blue Ice", BreakInfo::pickaxe(2.8)));
self::register("bone_block", new BoneBlock(new BID(Ids::BONE_BLOCK), "Bone Block", BreakInfo::pickaxe(2.0, ToolTier::WOOD())));
self::register("bookshelf", new Bookshelf(new BID(Ids::BOOKSHELF), "Bookshelf", BreakInfo::axe(1.5)));
self::register("brewing_stand", new BrewingStand(new BID(Ids::BREWING_STAND, TileBrewingStand::class), "Brewing Stand", BreakInfo::pickaxe(0.5, ToolTier::WOOD())));
self::register("beetroots", new Beetroot(new BID(Ids::BEETROOTS), "Beetroot Block", new Info(BreakInfo::instant())));
self::register("bell", new Bell(new BID(Ids::BELL, TileBell::class), "Bell", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD()))));
self::register("blue_ice", new BlueIce(new BID(Ids::BLUE_ICE), "Blue Ice", new Info(BreakInfo::pickaxe(2.8))));
self::register("bone_block", new BoneBlock(new BID(Ids::BONE_BLOCK), "Bone Block", new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD()))));
self::register("bookshelf", new Bookshelf(new BID(Ids::BOOKSHELF), "Bookshelf", new Info(BreakInfo::axe(1.5))));
self::register("brewing_stand", new BrewingStand(new BID(Ids::BREWING_STAND, TileBrewingStand::class), "Brewing Stand", new Info(BreakInfo::pickaxe(0.5, ToolTier::WOOD()))));
$bricksBreakInfo = BreakInfo::pickaxe(2.0, ToolTier::WOOD(), 30.0);
$bricksBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD(), 30.0));
self::register("brick_stairs", new Stair(new BID(Ids::BRICK_STAIRS), "Brick Stairs", $bricksBreakInfo));
self::register("bricks", new Opaque(new BID(Ids::BRICKS), "Bricks", $bricksBreakInfo));
self::register("brown_mushroom", new BrownMushroom(new BID(Ids::BROWN_MUSHROOM), "Brown Mushroom", BreakInfo::instant()));
self::register("cactus", new Cactus(new BID(Ids::CACTUS), "Cactus", new BreakInfo(0.4)));
self::register("cake", new Cake(new BID(Ids::CAKE), "Cake", new BreakInfo(0.5)));
self::register("carrots", new Carrot(new BID(Ids::CARROTS), "Carrot Block", BreakInfo::instant()));
self::register("brown_mushroom", new BrownMushroom(new BID(Ids::BROWN_MUSHROOM), "Brown Mushroom", new Info(BreakInfo::instant())));
self::register("cactus", new Cactus(new BID(Ids::CACTUS), "Cactus", new Info(new BreakInfo(0.4))));
self::register("cake", new Cake(new BID(Ids::CAKE), "Cake", new Info(new BreakInfo(0.5))));
self::register("carrots", new Carrot(new BID(Ids::CARROTS), "Carrot Block", new Info(BreakInfo::instant())));
$chestBreakInfo = BreakInfo::axe(2.5);
$chestBreakInfo = new Info(BreakInfo::axe(2.5));
self::register("chest", new Chest(new BID(Ids::CHEST, TileChest::class), "Chest", $chestBreakInfo));
self::register("clay", new Clay(new BID(Ids::CLAY), "Clay Block", BreakInfo::shovel(0.6)));
self::register("coal", new Coal(new BID(Ids::COAL), "Coal Block", BreakInfo::pickaxe(5.0, ToolTier::WOOD(), 30.0)));
self::register("clay", new Clay(new BID(Ids::CLAY), "Clay Block", new Info(BreakInfo::shovel(0.6))));
self::register("coal", new Coal(new BID(Ids::COAL), "Coal Block", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD(), 30.0))));
$cobblestoneBreakInfo = BreakInfo::pickaxe(2.0, ToolTier::WOOD(), 30.0);
$cobblestoneBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD(), 30.0));
self::register("cobblestone", $cobblestone = new Opaque(new BID(Ids::COBBLESTONE), "Cobblestone", $cobblestoneBreakInfo));
self::register("mossy_cobblestone", new Opaque(new BID(Ids::MOSSY_COBBLESTONE), "Mossy Cobblestone", $cobblestoneBreakInfo));
self::register("cobblestone_stairs", new Stair(new BID(Ids::COBBLESTONE_STAIRS), "Cobblestone Stairs", $cobblestoneBreakInfo));
self::register("mossy_cobblestone_stairs", new Stair(new BID(Ids::MOSSY_COBBLESTONE_STAIRS), "Mossy Cobblestone Stairs", $cobblestoneBreakInfo));
self::register("cobweb", new Cobweb(new BID(Ids::COBWEB), "Cobweb", new BreakInfo(4.0, ToolType::SWORD | ToolType::SHEARS, 1)));
self::register("cocoa_pod", new CocoaBlock(new BID(Ids::COCOA_POD), "Cocoa Block", BreakInfo::axe(0.2, null, 15.0)));
self::register("coral_block", new CoralBlock(new BID(Ids::CORAL_BLOCK), "Coral Block", BreakInfo::pickaxe(7.0, ToolTier::WOOD())));
self::register("crafting_table", new CraftingTable(new BID(Ids::CRAFTING_TABLE), "Crafting Table", BreakInfo::axe(2.5)));
self::register("daylight_sensor", new DaylightSensor(new BID(Ids::DAYLIGHT_SENSOR, TileDaylightSensor::class), "Daylight Sensor", BreakInfo::axe(0.2)));
self::register("dead_bush", new DeadBush(new BID(Ids::DEAD_BUSH), "Dead Bush", BreakInfo::instant(ToolType::SHEARS, 1)));
self::register("cobweb", new Cobweb(new BID(Ids::COBWEB), "Cobweb", new Info(new BreakInfo(4.0, ToolType::SWORD | ToolType::SHEARS, 1))));
self::register("cocoa_pod", new CocoaBlock(new BID(Ids::COCOA_POD), "Cocoa Block", new Info(BreakInfo::axe(0.2, null, 15.0))));
self::register("coral_block", new CoralBlock(new BID(Ids::CORAL_BLOCK), "Coral Block", new Info(BreakInfo::pickaxe(7.0, ToolTier::WOOD()))));
self::register("crafting_table", new CraftingTable(new BID(Ids::CRAFTING_TABLE), "Crafting Table", new Info(BreakInfo::axe(2.5))));
self::register("daylight_sensor", new DaylightSensor(new BID(Ids::DAYLIGHT_SENSOR, TileDaylightSensor::class), "Daylight Sensor", new Info(BreakInfo::axe(0.2))));
self::register("dead_bush", new DeadBush(new BID(Ids::DEAD_BUSH), "Dead Bush", new Info(BreakInfo::instant(ToolType::SHEARS, 1))));
self::register("detector_rail", new DetectorRail(new BID(Ids::DETECTOR_RAIL), "Detector Rail", $railBreakInfo));
self::register("diamond", new Opaque(new BID(Ids::DIAMOND), "Diamond Block", BreakInfo::pickaxe(5.0, ToolTier::IRON(), 30.0)));
self::register("dirt", new Dirt(new BID(Ids::DIRT), "Dirt", BreakInfo::shovel(0.5)));
self::register("sunflower", new DoublePlant(new BID(Ids::SUNFLOWER), "Sunflower", BreakInfo::instant()));
self::register("lilac", new DoublePlant(new BID(Ids::LILAC), "Lilac", BreakInfo::instant()));
self::register("rose_bush", new DoublePlant(new BID(Ids::ROSE_BUSH), "Rose Bush", BreakInfo::instant()));
self::register("peony", new DoublePlant(new BID(Ids::PEONY), "Peony", BreakInfo::instant()));
self::register("double_tallgrass", new DoubleTallGrass(new BID(Ids::DOUBLE_TALLGRASS), "Double Tallgrass", BreakInfo::instant(ToolType::SHEARS, 1)));
self::register("large_fern", new DoubleTallGrass(new BID(Ids::LARGE_FERN), "Large Fern", BreakInfo::instant(ToolType::SHEARS, 1)));
self::register("dragon_egg", new DragonEgg(new BID(Ids::DRAGON_EGG), "Dragon Egg", BreakInfo::pickaxe(3.0, ToolTier::WOOD())));
self::register("dried_kelp", new DriedKelp(new BID(Ids::DRIED_KELP), "Dried Kelp Block", new BreakInfo(0.5, ToolType::NONE, 0, 12.5)));
self::register("emerald", new Opaque(new BID(Ids::EMERALD), "Emerald Block", BreakInfo::pickaxe(5.0, ToolTier::IRON(), 30.0)));
self::register("enchanting_table", new EnchantingTable(new BID(Ids::ENCHANTING_TABLE, TileEnchantingTable::class), "Enchanting Table", BreakInfo::pickaxe(5.0, ToolTier::WOOD(), 6000.0)));
self::register("end_portal_frame", new EndPortalFrame(new BID(Ids::END_PORTAL_FRAME), "End Portal Frame", BreakInfo::indestructible()));
self::register("end_rod", new EndRod(new BID(Ids::END_ROD), "End Rod", BreakInfo::instant()));
self::register("end_stone", new Opaque(new BID(Ids::END_STONE), "End Stone", BreakInfo::pickaxe(3.0, ToolTier::WOOD(), 45.0)));
self::register("diamond", new Opaque(new BID(Ids::DIAMOND), "Diamond Block", new Info(BreakInfo::pickaxe(5.0, ToolTier::IRON(), 30.0))));
self::register("dirt", new Dirt(new BID(Ids::DIRT), "Dirt", new Info(BreakInfo::shovel(0.5))));
self::register("sunflower", new DoublePlant(new BID(Ids::SUNFLOWER), "Sunflower", new Info(BreakInfo::instant())));
self::register("lilac", new DoublePlant(new BID(Ids::LILAC), "Lilac", new Info(BreakInfo::instant())));
self::register("rose_bush", new DoublePlant(new BID(Ids::ROSE_BUSH), "Rose Bush", new Info(BreakInfo::instant())));
self::register("peony", new DoublePlant(new BID(Ids::PEONY), "Peony", new Info(BreakInfo::instant())));
self::register("double_tallgrass", new DoubleTallGrass(new BID(Ids::DOUBLE_TALLGRASS), "Double Tallgrass", new Info(BreakInfo::instant(ToolType::SHEARS, 1))));
self::register("large_fern", new DoubleTallGrass(new BID(Ids::LARGE_FERN), "Large Fern", new Info(BreakInfo::instant(ToolType::SHEARS, 1))));
self::register("dragon_egg", new DragonEgg(new BID(Ids::DRAGON_EGG), "Dragon Egg", new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD()))));
self::register("dried_kelp", new DriedKelp(new BID(Ids::DRIED_KELP), "Dried Kelp Block", new Info(new BreakInfo(0.5, ToolType::NONE, 0, 12.5))));
self::register("emerald", new Opaque(new BID(Ids::EMERALD), "Emerald Block", new Info(BreakInfo::pickaxe(5.0, ToolTier::IRON(), 30.0))));
self::register("enchanting_table", new EnchantingTable(new BID(Ids::ENCHANTING_TABLE, TileEnchantingTable::class), "Enchanting Table", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD(), 6000.0))));
self::register("end_portal_frame", new EndPortalFrame(new BID(Ids::END_PORTAL_FRAME), "End Portal Frame", new Info(BreakInfo::indestructible())));
self::register("end_rod", new EndRod(new BID(Ids::END_ROD), "End Rod", new Info(BreakInfo::instant())));
self::register("end_stone", new Opaque(new BID(Ids::END_STONE), "End Stone", new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD(), 45.0))));
$endBrickBreakInfo = BreakInfo::pickaxe(0.8, ToolTier::WOOD(), 4.0);
$endBrickBreakInfo = new Info(BreakInfo::pickaxe(0.8, ToolTier::WOOD(), 4.0));
self::register("end_stone_bricks", new Opaque(new BID(Ids::END_STONE_BRICKS), "End Stone Bricks", $endBrickBreakInfo));
self::register("end_stone_brick_stairs", new Stair(new BID(Ids::END_STONE_BRICK_STAIRS), "End Stone Brick Stairs", $endBrickBreakInfo));
self::register("ender_chest", new EnderChest(new BID(Ids::ENDER_CHEST, TileEnderChest::class), "Ender Chest", BreakInfo::pickaxe(22.5, ToolTier::WOOD(), 3000.0)));
self::register("farmland", new Farmland(new BID(Ids::FARMLAND), "Farmland", BreakInfo::shovel(0.6)));
self::register("fire", new Fire(new BID(Ids::FIRE), "Fire Block", BreakInfo::instant()));
self::register("fletching_table", new FletchingTable(new BID(Ids::FLETCHING_TABLE), "Fletching Table", BreakInfo::axe(2.5, null, 2.5)));
self::register("dandelion", new Flower(new BID(Ids::DANDELION), "Dandelion", BreakInfo::instant()));
self::register("poppy", new Flower(new BID(Ids::POPPY), "Poppy", BreakInfo::instant()));
self::register("allium", new Flower(new BID(Ids::ALLIUM), "Allium", BreakInfo::instant()));
self::register("azure_bluet", new Flower(new BID(Ids::AZURE_BLUET), "Azure Bluet", BreakInfo::instant()));
self::register("blue_orchid", new Flower(new BID(Ids::BLUE_ORCHID), "Blue Orchid", BreakInfo::instant()));
self::register("cornflower", new Flower(new BID(Ids::CORNFLOWER), "Cornflower", BreakInfo::instant()));
self::register("lily_of_the_valley", new Flower(new BID(Ids::LILY_OF_THE_VALLEY), "Lily of the Valley", BreakInfo::instant()));
self::register("orange_tulip", new Flower(new BID(Ids::ORANGE_TULIP), "Orange Tulip", BreakInfo::instant()));
self::register("oxeye_daisy", new Flower(new BID(Ids::OXEYE_DAISY), "Oxeye Daisy", BreakInfo::instant()));
self::register("pink_tulip", new Flower(new BID(Ids::PINK_TULIP), "Pink Tulip", BreakInfo::instant()));
self::register("red_tulip", new Flower(new BID(Ids::RED_TULIP), "Red Tulip", BreakInfo::instant()));
self::register("white_tulip", new Flower(new BID(Ids::WHITE_TULIP), "White Tulip", BreakInfo::instant()));
self::register("flower_pot", new FlowerPot(new BID(Ids::FLOWER_POT, TileFlowerPot::class), "Flower Pot", BreakInfo::instant()));
self::register("frosted_ice", new FrostedIce(new BID(Ids::FROSTED_ICE), "Frosted Ice", BreakInfo::pickaxe(2.5)));
self::register("furnace", new Furnace(new BID(Ids::FURNACE, TileNormalFurnace::class), "Furnace", BreakInfo::pickaxe(3.5, ToolTier::WOOD())));
self::register("blast_furnace", new Furnace(new BID(Ids::BLAST_FURNACE, TileBlastFurnace::class), "Blast Furnace", BreakInfo::pickaxe(3.5, ToolTier::WOOD())));
self::register("smoker", new Furnace(new BID(Ids::SMOKER, TileSmoker::class), "Smoker", BreakInfo::pickaxe(3.5, ToolTier::WOOD())));
self::register("ender_chest", new EnderChest(new BID(Ids::ENDER_CHEST, TileEnderChest::class), "Ender Chest", new Info(BreakInfo::pickaxe(22.5, ToolTier::WOOD(), 3000.0))));
self::register("farmland", new Farmland(new BID(Ids::FARMLAND), "Farmland", new Info(BreakInfo::shovel(0.6))));
self::register("fire", new Fire(new BID(Ids::FIRE), "Fire Block", new Info(BreakInfo::instant())));
self::register("fletching_table", new FletchingTable(new BID(Ids::FLETCHING_TABLE), "Fletching Table", new Info(BreakInfo::axe(2.5, null, 2.5))));
self::register("dandelion", new Flower(new BID(Ids::DANDELION), "Dandelion", new Info(BreakInfo::instant())));
self::register("poppy", new Flower(new BID(Ids::POPPY), "Poppy", new Info(BreakInfo::instant())));
self::register("allium", new Flower(new BID(Ids::ALLIUM), "Allium", new Info(BreakInfo::instant())));
self::register("azure_bluet", new Flower(new BID(Ids::AZURE_BLUET), "Azure Bluet", new Info(BreakInfo::instant())));
self::register("blue_orchid", new Flower(new BID(Ids::BLUE_ORCHID), "Blue Orchid", new Info(BreakInfo::instant())));
self::register("cornflower", new Flower(new BID(Ids::CORNFLOWER), "Cornflower", new Info(BreakInfo::instant())));
self::register("lily_of_the_valley", new Flower(new BID(Ids::LILY_OF_THE_VALLEY), "Lily of the Valley", new Info(BreakInfo::instant())));
self::register("orange_tulip", new Flower(new BID(Ids::ORANGE_TULIP), "Orange Tulip", new Info(BreakInfo::instant())));
self::register("oxeye_daisy", new Flower(new BID(Ids::OXEYE_DAISY), "Oxeye Daisy", new Info(BreakInfo::instant())));
self::register("pink_tulip", new Flower(new BID(Ids::PINK_TULIP), "Pink Tulip", new Info(BreakInfo::instant())));
self::register("red_tulip", new Flower(new BID(Ids::RED_TULIP), "Red Tulip", new Info(BreakInfo::instant())));
self::register("white_tulip", new Flower(new BID(Ids::WHITE_TULIP), "White Tulip", new Info(BreakInfo::instant())));
self::register("flower_pot", new FlowerPot(new BID(Ids::FLOWER_POT, TileFlowerPot::class), "Flower Pot", new Info(BreakInfo::instant())));
self::register("frosted_ice", new FrostedIce(new BID(Ids::FROSTED_ICE), "Frosted Ice", new Info(BreakInfo::pickaxe(2.5))));
self::register("furnace", new Furnace(new BID(Ids::FURNACE, TileNormalFurnace::class), "Furnace", new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD()))));
self::register("blast_furnace", new Furnace(new BID(Ids::BLAST_FURNACE, TileBlastFurnace::class), "Blast Furnace", new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD()))));
self::register("smoker", new Furnace(new BID(Ids::SMOKER, TileSmoker::class), "Smoker", new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD()))));
$glassBreakInfo = new BreakInfo(0.3);
$glassBreakInfo = new Info(new BreakInfo(0.3));
self::register("glass", new Glass(new BID(Ids::GLASS), "Glass", $glassBreakInfo));
self::register("glass_pane", new GlassPane(new BID(Ids::GLASS_PANE), "Glass Pane", $glassBreakInfo));
self::register("glowing_obsidian", new GlowingObsidian(new BID(Ids::GLOWING_OBSIDIAN), "Glowing Obsidian", BreakInfo::pickaxe(10.0, ToolTier::DIAMOND(), 50.0)));
self::register("glowstone", new Glowstone(new BID(Ids::GLOWSTONE), "Glowstone", BreakInfo::pickaxe(0.3)));
self::register("gold", new Opaque(new BID(Ids::GOLD), "Gold Block", BreakInfo::pickaxe(3.0, ToolTier::IRON(), 30.0)));
self::register("glowing_obsidian", new GlowingObsidian(new BID(Ids::GLOWING_OBSIDIAN), "Glowing Obsidian", new Info(BreakInfo::pickaxe(10.0, ToolTier::DIAMOND(), 50.0))));
self::register("glowstone", new Glowstone(new BID(Ids::GLOWSTONE), "Glowstone", new Info(BreakInfo::pickaxe(0.3))));
self::register("gold", new Opaque(new BID(Ids::GOLD), "Gold Block", new Info(BreakInfo::pickaxe(3.0, ToolTier::IRON(), 30.0))));
$grassBreakInfo = BreakInfo::shovel(0.6);
$grassBreakInfo = new Info(BreakInfo::shovel(0.6));
self::register("grass", new Grass(new BID(Ids::GRASS), "Grass", $grassBreakInfo));
self::register("grass_path", new GrassPath(new BID(Ids::GRASS_PATH), "Grass Path", $grassBreakInfo));
self::register("gravel", new Gravel(new BID(Ids::GRAVEL), "Gravel", BreakInfo::shovel(0.6)));
self::register("gravel", new Gravel(new BID(Ids::GRAVEL), "Gravel", new Info(BreakInfo::shovel(0.6))));
$hardenedClayBreakInfo = BreakInfo::pickaxe(1.25, ToolTier::WOOD(), 21.0);
$hardenedClayBreakInfo = new Info(BreakInfo::pickaxe(1.25, ToolTier::WOOD(), 21.0));
self::register("hardened_clay", new HardenedClay(new BID(Ids::HARDENED_CLAY), "Hardened Clay", $hardenedClayBreakInfo));
$hardenedGlassBreakInfo = new BreakInfo(10.0);
$hardenedGlassBreakInfo = new Info(new BreakInfo(10.0));
self::register("hardened_glass", new HardenedGlass(new BID(Ids::HARDENED_GLASS), "Hardened Glass", $hardenedGlassBreakInfo));
self::register("hardened_glass_pane", new HardenedGlassPane(new BID(Ids::HARDENED_GLASS_PANE), "Hardened Glass Pane", $hardenedGlassBreakInfo));
self::register("hay_bale", new HayBale(new BID(Ids::HAY_BALE), "Hay Bale", new BreakInfo(0.5)));
self::register("hopper", new Hopper(new BID(Ids::HOPPER, TileHopper::class), "Hopper", BreakInfo::pickaxe(3.0, ToolTier::WOOD(), 15.0)));
self::register("ice", new Ice(new BID(Ids::ICE), "Ice", BreakInfo::pickaxe(0.5)));
self::register("hay_bale", new HayBale(new BID(Ids::HAY_BALE), "Hay Bale", new Info(new BreakInfo(0.5))));
self::register("hopper", new Hopper(new BID(Ids::HOPPER, TileHopper::class), "Hopper", new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD(), 15.0))));
self::register("ice", new Ice(new BID(Ids::ICE), "Ice", new Info(BreakInfo::pickaxe(0.5))));
$updateBlockBreakInfo = new BreakInfo(1.0);
$updateBlockBreakInfo = new Info(new BreakInfo(1.0));
self::register("info_update", new Opaque(new BID(Ids::INFO_UPDATE), "update!", $updateBlockBreakInfo));
self::register("info_update2", new Opaque(new BID(Ids::INFO_UPDATE2), "ate!upd", $updateBlockBreakInfo));
self::register("invisible_bedrock", new Transparent(new BID(Ids::INVISIBLE_BEDROCK), "Invisible Bedrock", BreakInfo::indestructible()));
self::register("invisible_bedrock", new Transparent(new BID(Ids::INVISIBLE_BEDROCK), "Invisible Bedrock", new Info(BreakInfo::indestructible())));
$ironBreakInfo = BreakInfo::pickaxe(5.0, ToolTier::STONE(), 30.0);
$ironBreakInfo = new Info(BreakInfo::pickaxe(5.0, ToolTier::STONE(), 30.0));
self::register("iron", new Opaque(new BID(Ids::IRON), "Iron Block", $ironBreakInfo));
self::register("iron_bars", new Thin(new BID(Ids::IRON_BARS), "Iron Bars", $ironBreakInfo));
$ironDoorBreakInfo = BreakInfo::pickaxe(5.0, ToolTier::WOOD(), 25.0);
$ironDoorBreakInfo = new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD(), 25.0));
self::register("iron_door", new Door(new BID(Ids::IRON_DOOR), "Iron Door", $ironDoorBreakInfo));
self::register("iron_trapdoor", new Trapdoor(new BID(Ids::IRON_TRAPDOOR), "Iron Trapdoor", $ironDoorBreakInfo));
self::register("item_frame", new ItemFrame(new BID(Ids::ITEM_FRAME, TileItemFrame::class), "Item Frame", new BreakInfo(0.25)));
self::register("jukebox", new Jukebox(new BID(Ids::JUKEBOX, TileJukebox::class), "Jukebox", BreakInfo::axe(0.8))); //TODO: in PC the hardness is 2.0, not 0.8, unsure if this is a MCPE bug or not
self::register("ladder", new Ladder(new BID(Ids::LADDER), "Ladder", BreakInfo::axe(0.4)));
self::register("item_frame", new ItemFrame(new BID(Ids::ITEM_FRAME, TileItemFrame::class), "Item Frame", new Info(new BreakInfo(0.25))));
self::register("jukebox", new Jukebox(new BID(Ids::JUKEBOX, TileJukebox::class), "Jukebox", new Info(BreakInfo::axe(0.8)))); //TODO: in PC the hardness is 2.0, not 0.8, unsure if this is a MCPE bug or not
self::register("ladder", new Ladder(new BID(Ids::LADDER), "Ladder", new Info(BreakInfo::axe(0.4))));
$lanternBreakInfo = BreakInfo::pickaxe(5.0, ToolTier::WOOD());
$lanternBreakInfo = new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD()));
self::register("lantern", new Lantern(new BID(Ids::LANTERN), "Lantern", $lanternBreakInfo, 15));
self::register("soul_lantern", new Lantern(new BID(Ids::SOUL_LANTERN), "Soul Lantern", $lanternBreakInfo, 10));
self::register("lapis_lazuli", new Opaque(new BID(Ids::LAPIS_LAZULI), "Lapis Lazuli Block", BreakInfo::pickaxe(3.0, ToolTier::STONE())));
self::register("lava", new Lava(new BID(Ids::LAVA), "Lava", BreakInfo::indestructible(500.0)));
self::register("lectern", new Lectern(new BID(Ids::LECTERN, TileLectern::class), "Lectern", BreakInfo::axe(2.0)));
self::register("lever", new Lever(new BID(Ids::LEVER), "Lever", new BreakInfo(0.5)));
self::register("loom", new Loom(new BID(Ids::LOOM), "Loom", BreakInfo::axe(2.5)));
self::register("magma", new Magma(new BID(Ids::MAGMA), "Magma Block", BreakInfo::pickaxe(0.5, ToolTier::WOOD())));
self::register("melon", new Melon(new BID(Ids::MELON), "Melon Block", BreakInfo::axe(1.0)));
self::register("melon_stem", new MelonStem(new BID(Ids::MELON_STEM), "Melon Stem", BreakInfo::instant()));
self::register("monster_spawner", new MonsterSpawner(new BID(Ids::MONSTER_SPAWNER, TileMonsterSpawner::class), "Monster Spawner", BreakInfo::pickaxe(5.0, ToolTier::WOOD())));
self::register("mycelium", new Mycelium(new BID(Ids::MYCELIUM), "Mycelium", BreakInfo::shovel(0.6)));
self::register("lapis_lazuli", new Opaque(new BID(Ids::LAPIS_LAZULI), "Lapis Lazuli Block", new Info(BreakInfo::pickaxe(3.0, ToolTier::STONE()))));
self::register("lava", new Lava(new BID(Ids::LAVA), "Lava", new Info(BreakInfo::indestructible(500.0))));
self::register("lectern", new Lectern(new BID(Ids::LECTERN, TileLectern::class), "Lectern", new Info(BreakInfo::axe(2.0))));
self::register("lever", new Lever(new BID(Ids::LEVER), "Lever", new Info(new BreakInfo(0.5))));
self::register("loom", new Loom(new BID(Ids::LOOM), "Loom", new Info(BreakInfo::axe(2.5))));
self::register("magma", new Magma(new BID(Ids::MAGMA), "Magma Block", new Info(BreakInfo::pickaxe(0.5, ToolTier::WOOD()))));
self::register("melon", new Melon(new BID(Ids::MELON), "Melon Block", new Info(BreakInfo::axe(1.0))));
self::register("melon_stem", new MelonStem(new BID(Ids::MELON_STEM), "Melon Stem", new Info(BreakInfo::instant())));
self::register("monster_spawner", new MonsterSpawner(new BID(Ids::MONSTER_SPAWNER, TileMonsterSpawner::class), "Monster Spawner", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD()))));
self::register("mycelium", new Mycelium(new BID(Ids::MYCELIUM), "Mycelium", new Info(BreakInfo::shovel(0.6))));
$netherBrickBreakInfo = BreakInfo::pickaxe(2.0, ToolTier::WOOD(), 30.0);
$netherBrickBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD(), 30.0));
self::register("nether_bricks", new Opaque(new BID(Ids::NETHER_BRICKS), "Nether Bricks", $netherBrickBreakInfo));
self::register("red_nether_bricks", new Opaque(new BID(Ids::RED_NETHER_BRICKS), "Red Nether Bricks", $netherBrickBreakInfo));
self::register("nether_brick_fence", new Fence(new BID(Ids::NETHER_BRICK_FENCE), "Nether Brick Fence", $netherBrickBreakInfo));
@ -899,19 +900,19 @@ final class VanillaBlocks{
self::register("chiseled_nether_bricks", new Opaque(new BID(Ids::CHISELED_NETHER_BRICKS), "Chiseled Nether Bricks", $netherBrickBreakInfo));
self::register("cracked_nether_bricks", new Opaque(new BID(Ids::CRACKED_NETHER_BRICKS), "Cracked Nether Bricks", $netherBrickBreakInfo));
self::register("nether_portal", new NetherPortal(new BID(Ids::NETHER_PORTAL), "Nether Portal", BreakInfo::indestructible(0.0)));
self::register("nether_reactor_core", new NetherReactor(new BID(Ids::NETHER_REACTOR_CORE), "Nether Reactor Core", BreakInfo::pickaxe(3.0, ToolTier::WOOD())));
self::register("nether_wart_block", new Opaque(new BID(Ids::NETHER_WART_BLOCK), "Nether Wart Block", new BreakInfo(1.0, ToolType::HOE)));
self::register("nether_wart", new NetherWartPlant(new BID(Ids::NETHER_WART), "Nether Wart", BreakInfo::instant()));
self::register("netherrack", new Netherrack(new BID(Ids::NETHERRACK), "Netherrack", BreakInfo::pickaxe(0.4, ToolTier::WOOD())));
self::register("note_block", new Note(new BID(Ids::NOTE_BLOCK, TileNote::class), "Note Block", BreakInfo::axe(0.8)));
self::register("obsidian", new Opaque(new BID(Ids::OBSIDIAN), "Obsidian", BreakInfo::pickaxe(35.0 /* 50 in PC */, ToolTier::DIAMOND(), 6000.0)));
self::register("packed_ice", new PackedIce(new BID(Ids::PACKED_ICE), "Packed Ice", BreakInfo::pickaxe(0.5)));
self::register("podzol", new Podzol(new BID(Ids::PODZOL), "Podzol", BreakInfo::shovel(0.5)));
self::register("potatoes", new Potato(new BID(Ids::POTATOES), "Potato Block", BreakInfo::instant()));
self::register("nether_portal", new NetherPortal(new BID(Ids::NETHER_PORTAL), "Nether Portal", new Info(BreakInfo::indestructible(0.0))));
self::register("nether_reactor_core", new NetherReactor(new BID(Ids::NETHER_REACTOR_CORE), "Nether Reactor Core", new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD()))));
self::register("nether_wart_block", new Opaque(new BID(Ids::NETHER_WART_BLOCK), "Nether Wart Block", new Info(new BreakInfo(1.0, ToolType::HOE))));
self::register("nether_wart", new NetherWartPlant(new BID(Ids::NETHER_WART), "Nether Wart", new Info(BreakInfo::instant())));
self::register("netherrack", new Netherrack(new BID(Ids::NETHERRACK), "Netherrack", new Info(BreakInfo::pickaxe(0.4, ToolTier::WOOD()))));
self::register("note_block", new Note(new BID(Ids::NOTE_BLOCK, TileNote::class), "Note Block", new Info(BreakInfo::axe(0.8))));
self::register("obsidian", new Opaque(new BID(Ids::OBSIDIAN), "Obsidian", new Info(BreakInfo::pickaxe(35.0 /* 50 in PC */, ToolTier::DIAMOND(), 6000.0))));
self::register("packed_ice", new PackedIce(new BID(Ids::PACKED_ICE), "Packed Ice", new Info(BreakInfo::pickaxe(0.5))));
self::register("podzol", new Podzol(new BID(Ids::PODZOL), "Podzol", new Info(BreakInfo::shovel(0.5))));
self::register("potatoes", new Potato(new BID(Ids::POTATOES), "Potato Block", new Info(BreakInfo::instant())));
self::register("powered_rail", new PoweredRail(new BID(Ids::POWERED_RAIL), "Powered Rail", $railBreakInfo));
$prismarineBreakInfo = BreakInfo::pickaxe(1.5, ToolTier::WOOD(), 30.0);
$prismarineBreakInfo = new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD(), 30.0));
self::register("prismarine", new Opaque(new BID(Ids::PRISMARINE), "Prismarine", $prismarineBreakInfo));
self::register("dark_prismarine", new Opaque(new BID(Ids::DARK_PRISMARINE), "Dark Prismarine", $prismarineBreakInfo));
self::register("prismarine_bricks", new Opaque(new BID(Ids::PRISMARINE_BRICKS), "Prismarine Bricks", $prismarineBreakInfo));
@ -919,19 +920,19 @@ final class VanillaBlocks{
self::register("dark_prismarine_stairs", new Stair(new BID(Ids::DARK_PRISMARINE_STAIRS), "Dark Prismarine Stairs", $prismarineBreakInfo));
self::register("prismarine_stairs", new Stair(new BID(Ids::PRISMARINE_STAIRS), "Prismarine Stairs", $prismarineBreakInfo));
$pumpkinBreakInfo = BreakInfo::axe(1.0);
$pumpkinBreakInfo = new Info(BreakInfo::axe(1.0));
self::register("pumpkin", new Pumpkin(new BID(Ids::PUMPKIN), "Pumpkin", $pumpkinBreakInfo));
self::register("carved_pumpkin", new CarvedPumpkin(new BID(Ids::CARVED_PUMPKIN), "Carved Pumpkin", $pumpkinBreakInfo));
self::register("lit_pumpkin", new LitPumpkin(new BID(Ids::LIT_PUMPKIN), "Jack o'Lantern", $pumpkinBreakInfo));
self::register("pumpkin_stem", new PumpkinStem(new BID(Ids::PUMPKIN_STEM), "Pumpkin Stem", BreakInfo::instant()));
self::register("pumpkin_stem", new PumpkinStem(new BID(Ids::PUMPKIN_STEM), "Pumpkin Stem", new Info(BreakInfo::instant())));
$purpurBreakInfo = BreakInfo::pickaxe(1.5, ToolTier::WOOD(), 30.0);
$purpurBreakInfo = new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD(), 30.0));
self::register("purpur", new Opaque(new BID(Ids::PURPUR), "Purpur Block", $purpurBreakInfo));
self::register("purpur_pillar", new SimplePillar(new BID(Ids::PURPUR_PILLAR), "Purpur Pillar", $purpurBreakInfo));
self::register("purpur_stairs", new Stair(new BID(Ids::PURPUR_STAIRS), "Purpur Stairs", $purpurBreakInfo));
$quartzBreakInfo = BreakInfo::pickaxe(0.8, ToolTier::WOOD());
$quartzBreakInfo = new Info(BreakInfo::pickaxe(0.8, ToolTier::WOOD()));
self::register("quartz", new Opaque(new BID(Ids::QUARTZ), "Quartz Block", $quartzBreakInfo));
self::register("chiseled_quartz", new SimplePillar(new BID(Ids::CHISELED_QUARTZ), "Chiseled Quartz Block", $quartzBreakInfo));
self::register("quartz_pillar", new SimplePillar(new BID(Ids::QUARTZ_PILLAR), "Quartz Pillar", $quartzBreakInfo));
@ -942,31 +943,31 @@ final class VanillaBlocks{
self::register("smooth_quartz_stairs", new Stair(new BID(Ids::SMOOTH_QUARTZ_STAIRS), "Smooth Quartz Stairs", $quartzBreakInfo));
self::register("rail", new Rail(new BID(Ids::RAIL), "Rail", $railBreakInfo));
self::register("red_mushroom", new RedMushroom(new BID(Ids::RED_MUSHROOM), "Red Mushroom", BreakInfo::instant()));
self::register("redstone", new Redstone(new BID(Ids::REDSTONE), "Redstone Block", BreakInfo::pickaxe(5.0, ToolTier::WOOD(), 30.0)));
self::register("redstone_comparator", new RedstoneComparator(new BID(Ids::REDSTONE_COMPARATOR, TileComparator::class), "Redstone Comparator", BreakInfo::instant()));
self::register("redstone_lamp", new RedstoneLamp(new BID(Ids::REDSTONE_LAMP), "Redstone Lamp", new BreakInfo(0.3)));
self::register("redstone_repeater", new RedstoneRepeater(new BID(Ids::REDSTONE_REPEATER), "Redstone Repeater", BreakInfo::instant()));
self::register("redstone_torch", new RedstoneTorch(new BID(Ids::REDSTONE_TORCH), "Redstone Torch", BreakInfo::instant()));
self::register("redstone_wire", new RedstoneWire(new BID(Ids::REDSTONE_WIRE), "Redstone", BreakInfo::instant()));
self::register("reserved6", new Reserved6(new BID(Ids::RESERVED6), "reserved6", BreakInfo::instant()));
self::register("red_mushroom", new RedMushroom(new BID(Ids::RED_MUSHROOM), "Red Mushroom", new Info(BreakInfo::instant())));
self::register("redstone", new Redstone(new BID(Ids::REDSTONE), "Redstone Block", new Info(BreakInfo::pickaxe(5.0, ToolTier::WOOD(), 30.0))));
self::register("redstone_comparator", new RedstoneComparator(new BID(Ids::REDSTONE_COMPARATOR, TileComparator::class), "Redstone Comparator", new Info(BreakInfo::instant())));
self::register("redstone_lamp", new RedstoneLamp(new BID(Ids::REDSTONE_LAMP), "Redstone Lamp", new Info(new BreakInfo(0.3))));
self::register("redstone_repeater", new RedstoneRepeater(new BID(Ids::REDSTONE_REPEATER), "Redstone Repeater", new Info(BreakInfo::instant())));
self::register("redstone_torch", new RedstoneTorch(new BID(Ids::REDSTONE_TORCH), "Redstone Torch", new Info(BreakInfo::instant())));
self::register("redstone_wire", new RedstoneWire(new BID(Ids::REDSTONE_WIRE), "Redstone", new Info(BreakInfo::instant())));
self::register("reserved6", new Reserved6(new BID(Ids::RESERVED6), "reserved6", new Info(BreakInfo::instant())));
$sandBreakInfo = BreakInfo::shovel(0.5);
$sandBreakInfo = new Info(BreakInfo::shovel(0.5));
self::register("sand", new Sand(new BID(Ids::SAND), "Sand", $sandBreakInfo));
self::register("red_sand", new Sand(new BID(Ids::RED_SAND), "Red Sand", $sandBreakInfo));
self::register("sea_lantern", new SeaLantern(new BID(Ids::SEA_LANTERN), "Sea Lantern", new BreakInfo(0.3)));
self::register("sea_pickle", new SeaPickle(new BID(Ids::SEA_PICKLE), "Sea Pickle", BreakInfo::instant()));
self::register("mob_head", new Skull(new BID(Ids::MOB_HEAD, TileSkull::class), "Mob Head", new BreakInfo(1.0)));
self::register("slime", new Slime(new BID(Ids::SLIME), "Slime Block", BreakInfo::instant()));
self::register("snow", new Snow(new BID(Ids::SNOW), "Snow Block", BreakInfo::shovel(0.2, ToolTier::WOOD())));
self::register("snow_layer", new SnowLayer(new BID(Ids::SNOW_LAYER), "Snow Layer", BreakInfo::shovel(0.1, ToolTier::WOOD())));
self::register("soul_sand", new SoulSand(new BID(Ids::SOUL_SAND), "Soul Sand", BreakInfo::shovel(0.5)));
self::register("sponge", new Sponge(new BID(Ids::SPONGE), "Sponge", new BreakInfo(0.6, ToolType::HOE)));
$shulkerBoxBreakInfo = BreakInfo::pickaxe(2);
self::register("sea_lantern", new SeaLantern(new BID(Ids::SEA_LANTERN), "Sea Lantern", new Info(new BreakInfo(0.3))));
self::register("sea_pickle", new SeaPickle(new BID(Ids::SEA_PICKLE), "Sea Pickle", new Info(BreakInfo::instant())));
self::register("mob_head", new Skull(new BID(Ids::MOB_HEAD, TileSkull::class), "Mob Head", new Info(new BreakInfo(1.0))));
self::register("slime", new Slime(new BID(Ids::SLIME), "Slime Block", new Info(BreakInfo::instant())));
self::register("snow", new Snow(new BID(Ids::SNOW), "Snow Block", new Info(BreakInfo::shovel(0.2, ToolTier::WOOD()))));
self::register("snow_layer", new SnowLayer(new BID(Ids::SNOW_LAYER), "Snow Layer", new Info(BreakInfo::shovel(0.1, ToolTier::WOOD()))));
self::register("soul_sand", new SoulSand(new BID(Ids::SOUL_SAND), "Soul Sand", new Info(BreakInfo::shovel(0.5))));
self::register("sponge", new Sponge(new BID(Ids::SPONGE), "Sponge", new Info(new BreakInfo(0.6, ToolType::HOE))));
$shulkerBoxBreakInfo = new Info(BreakInfo::pickaxe(2));
self::register("shulker_box", new ShulkerBox(new BID(Ids::SHULKER_BOX, TileShulkerBox::class), "Shulker Box", $shulkerBoxBreakInfo));
$stoneBreakInfo = BreakInfo::pickaxe(1.5, ToolTier::WOOD(), 30.0);
$stoneBreakInfo = new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD(), 30.0));
self::register(
"stone",
$stone = new class(new BID(Ids::STONE), "Stone", $stoneBreakInfo) extends Opaque{
@ -991,7 +992,7 @@ final class VanillaBlocks{
self::register("cracked_stone_bricks", $crackedStoneBrick = new Opaque(new BID(Ids::CRACKED_STONE_BRICKS), "Cracked Stone Bricks", $stoneBreakInfo));
self::register("chiseled_stone_bricks", $chiseledStoneBrick = new Opaque(new BID(Ids::CHISELED_STONE_BRICKS), "Chiseled Stone Bricks", $stoneBreakInfo));
$infestedStoneBreakInfo = BreakInfo::pickaxe(0.75);
$infestedStoneBreakInfo = new Info(BreakInfo::pickaxe(0.75));
self::register("infested_stone", new InfestedStone(new BID(Ids::INFESTED_STONE), "Infested Stone", $infestedStoneBreakInfo, $stone));
self::register("infested_stone_brick", new InfestedStone(new BID(Ids::INFESTED_STONE_BRICK), "Infested Stone Brick", $infestedStoneBreakInfo, $stoneBrick));
self::register("infested_cobblestone", new InfestedStone(new BID(Ids::INFESTED_COBBLESTONE), "Infested Cobblestone", $infestedStoneBreakInfo, $cobblestone));
@ -1009,12 +1010,12 @@ final class VanillaBlocks{
self::register("polished_granite_stairs", new Stair(new BID(Ids::POLISHED_GRANITE_STAIRS), "Polished Granite Stairs", $stoneBreakInfo));
self::register("stone_brick_stairs", new Stair(new BID(Ids::STONE_BRICK_STAIRS), "Stone Brick Stairs", $stoneBreakInfo));
self::register("mossy_stone_brick_stairs", new Stair(new BID(Ids::MOSSY_STONE_BRICK_STAIRS), "Mossy Stone Brick Stairs", $stoneBreakInfo));
self::register("stone_button", new StoneButton(new BID(Ids::STONE_BUTTON), "Stone Button", BreakInfo::pickaxe(0.5)));
self::register("stonecutter", new Stonecutter(new BID(Ids::STONECUTTER), "Stonecutter", BreakInfo::pickaxe(3.5)));
self::register("stone_pressure_plate", new StonePressurePlate(new BID(Ids::STONE_PRESSURE_PLATE), "Stone Pressure Plate", BreakInfo::pickaxe(0.5, ToolTier::WOOD())));
self::register("stone_button", new StoneButton(new BID(Ids::STONE_BUTTON), "Stone Button", new Info(BreakInfo::pickaxe(0.5))));
self::register("stonecutter", new Stonecutter(new BID(Ids::STONECUTTER), "Stonecutter", new Info(BreakInfo::pickaxe(3.5))));
self::register("stone_pressure_plate", new StonePressurePlate(new BID(Ids::STONE_PRESSURE_PLATE), "Stone Pressure Plate", new Info(BreakInfo::pickaxe(0.5, ToolTier::WOOD()))));
//TODO: in the future this won't be the same for all the types
$stoneSlabBreakInfo = BreakInfo::pickaxe(2.0, ToolTier::WOOD(), 30.0);
$stoneSlabBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD(), 30.0));
self::register("brick_slab", new Slab(new BID(Ids::BRICK_SLAB), "Brick", $stoneSlabBreakInfo));
self::register("cobblestone_slab", new Slab(new BID(Ids::COBBLESTONE_SLAB), "Cobblestone", $stoneSlabBreakInfo));
@ -1046,48 +1047,48 @@ final class VanillaBlocks{
self::register("smooth_quartz_slab", new Slab(new BID(Ids::SMOOTH_QUARTZ_SLAB), "Smooth Quartz", $stoneSlabBreakInfo));
self::register("stone_slab", new Slab(new BID(Ids::STONE_SLAB), "Stone", $stoneSlabBreakInfo));
self::register("legacy_stonecutter", new Opaque(new BID(Ids::LEGACY_STONECUTTER), "Legacy Stonecutter", BreakInfo::pickaxe(3.5, ToolTier::WOOD())));
self::register("sugarcane", new Sugarcane(new BID(Ids::SUGARCANE), "Sugarcane", BreakInfo::instant()));
self::register("sweet_berry_bush", new SweetBerryBush(new BID(Ids::SWEET_BERRY_BUSH), "Sweet Berry Bush", BreakInfo::instant()));
self::register("tnt", new TNT(new BID(Ids::TNT), "TNT", BreakInfo::instant()));
self::register("fern", new TallGrass(new BID(Ids::FERN), "Fern", BreakInfo::instant(ToolType::SHEARS, 1)));
self::register("tall_grass", new TallGrass(new BID(Ids::TALL_GRASS), "Tall Grass", BreakInfo::instant(ToolType::SHEARS, 1)));
self::register("legacy_stonecutter", new Opaque(new BID(Ids::LEGACY_STONECUTTER), "Legacy Stonecutter", new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD()))));
self::register("sugarcane", new Sugarcane(new BID(Ids::SUGARCANE), "Sugarcane", new Info(BreakInfo::instant())));
self::register("sweet_berry_bush", new SweetBerryBush(new BID(Ids::SWEET_BERRY_BUSH), "Sweet Berry Bush", new Info(BreakInfo::instant())));
self::register("tnt", new TNT(new BID(Ids::TNT), "TNT", new Info(BreakInfo::instant())));
self::register("fern", new TallGrass(new BID(Ids::FERN), "Fern", new Info(BreakInfo::instant(ToolType::SHEARS, 1))));
self::register("tall_grass", new TallGrass(new BID(Ids::TALL_GRASS), "Tall Grass", new Info(BreakInfo::instant(ToolType::SHEARS, 1))));
self::register("blue_torch", new Torch(new BID(Ids::BLUE_TORCH), "Blue Torch", BreakInfo::instant()));
self::register("purple_torch", new Torch(new BID(Ids::PURPLE_TORCH), "Purple Torch", BreakInfo::instant()));
self::register("red_torch", new Torch(new BID(Ids::RED_TORCH), "Red Torch", BreakInfo::instant()));
self::register("green_torch", new Torch(new BID(Ids::GREEN_TORCH), "Green Torch", BreakInfo::instant()));
self::register("torch", new Torch(new BID(Ids::TORCH), "Torch", BreakInfo::instant()));
self::register("blue_torch", new Torch(new BID(Ids::BLUE_TORCH), "Blue Torch", new Info(BreakInfo::instant())));
self::register("purple_torch", new Torch(new BID(Ids::PURPLE_TORCH), "Purple Torch", new Info(BreakInfo::instant())));
self::register("red_torch", new Torch(new BID(Ids::RED_TORCH), "Red Torch", new Info(BreakInfo::instant())));
self::register("green_torch", new Torch(new BID(Ids::GREEN_TORCH), "Green Torch", new Info(BreakInfo::instant())));
self::register("torch", new Torch(new BID(Ids::TORCH), "Torch", new Info(BreakInfo::instant())));
self::register("trapped_chest", new TrappedChest(new BID(Ids::TRAPPED_CHEST, TileChest::class), "Trapped Chest", $chestBreakInfo));
self::register("tripwire", new Tripwire(new BID(Ids::TRIPWIRE), "Tripwire", BreakInfo::instant()));
self::register("tripwire_hook", new TripwireHook(new BID(Ids::TRIPWIRE_HOOK), "Tripwire Hook", BreakInfo::instant()));
self::register("underwater_torch", new UnderwaterTorch(new BID(Ids::UNDERWATER_TORCH), "Underwater Torch", BreakInfo::instant()));
self::register("vines", new Vine(new BID(Ids::VINES), "Vines", BreakInfo::axe(0.2)));
self::register("water", new Water(new BID(Ids::WATER), "Water", BreakInfo::indestructible(500.0)));
self::register("lily_pad", new WaterLily(new BID(Ids::LILY_PAD), "Lily Pad", BreakInfo::instant()));
self::register("tripwire", new Tripwire(new BID(Ids::TRIPWIRE), "Tripwire", new Info(BreakInfo::instant())));
self::register("tripwire_hook", new TripwireHook(new BID(Ids::TRIPWIRE_HOOK), "Tripwire Hook", new Info(BreakInfo::instant())));
self::register("underwater_torch", new UnderwaterTorch(new BID(Ids::UNDERWATER_TORCH), "Underwater Torch", new Info(BreakInfo::instant())));
self::register("vines", new Vine(new BID(Ids::VINES), "Vines", new Info(BreakInfo::axe(0.2))));
self::register("water", new Water(new BID(Ids::WATER), "Water", new Info(BreakInfo::indestructible(500.0))));
self::register("lily_pad", new WaterLily(new BID(Ids::LILY_PAD), "Lily Pad", new Info(BreakInfo::instant())));
$weightedPressurePlateBreakInfo = BreakInfo::pickaxe(0.5, ToolTier::WOOD());
$weightedPressurePlateBreakInfo = new Info(BreakInfo::pickaxe(0.5, ToolTier::WOOD()));
self::register("weighted_pressure_plate_heavy", new WeightedPressurePlateHeavy(new BID(Ids::WEIGHTED_PRESSURE_PLATE_HEAVY), "Weighted Pressure Plate Heavy", $weightedPressurePlateBreakInfo));
self::register("weighted_pressure_plate_light", new WeightedPressurePlateLight(new BID(Ids::WEIGHTED_PRESSURE_PLATE_LIGHT), "Weighted Pressure Plate Light", $weightedPressurePlateBreakInfo));
self::register("wheat", new Wheat(new BID(Ids::WHEAT), "Wheat Block", BreakInfo::instant()));
self::register("wheat", new Wheat(new BID(Ids::WHEAT), "Wheat Block", new Info(BreakInfo::instant())));
$leavesBreakInfo = new class(0.2, ToolType::HOE) extends BreakInfo{
$leavesBreakInfo = new Info(new class(0.2, ToolType::HOE) extends BreakInfo{
public function getBreakTime(Item $item) : float{
if($item->getBlockToolType() === ToolType::SHEARS){
return 0.0;
}
return parent::getBreakTime($item);
}
};
});
foreach(TreeType::getAll() as $treeType){
$name = $treeType->getDisplayName();
self::register($treeType->name() . "_sapling", new Sapling(BlockLegacyIdHelper::getSaplingIdentifier($treeType), $name . " Sapling", BreakInfo::instant(), $treeType));
self::register($treeType->name() . "_sapling", new Sapling(BlockLegacyIdHelper::getSaplingIdentifier($treeType), $name . " Sapling", new Info(BreakInfo::instant()), $treeType));
self::register($treeType->name() . "_leaves", new Leaves(BlockLegacyIdHelper::getLeavesIdentifier($treeType), $name . " Leaves", $leavesBreakInfo, $treeType));
}
$sandstoneBreakInfo = BreakInfo::pickaxe(0.8, ToolTier::WOOD());
$sandstoneBreakInfo = new Info(BreakInfo::pickaxe(0.8, ToolTier::WOOD()));
self::register("red_sandstone_stairs", new Stair(new BID(Ids::RED_SANDSTONE_STAIRS), "Red Sandstone Stairs", $sandstoneBreakInfo));
self::register("smooth_red_sandstone_stairs", new Stair(new BID(Ids::SMOOTH_RED_SANDSTONE_STAIRS), "Smooth Red Sandstone Stairs", $sandstoneBreakInfo));
self::register("red_sandstone", new Opaque(new BID(Ids::RED_SANDSTONE), "Red Sandstone", $sandstoneBreakInfo));
@ -1102,17 +1103,17 @@ final class VanillaBlocks{
self::register("cut_sandstone", new Opaque(new BID(Ids::CUT_SANDSTONE), "Cut Sandstone", $sandstoneBreakInfo));
self::register("smooth_sandstone", new Opaque(new BID(Ids::SMOOTH_SANDSTONE), "Smooth Sandstone", $sandstoneBreakInfo));
self::register("glazed_terracotta", new GlazedTerracotta(new BID(Ids::GLAZED_TERRACOTTA), "Glazed Terracotta", BreakInfo::pickaxe(1.4, ToolTier::WOOD())));
self::register("glazed_terracotta", new GlazedTerracotta(new BID(Ids::GLAZED_TERRACOTTA), "Glazed Terracotta", new Info(BreakInfo::pickaxe(1.4, ToolTier::WOOD()))));
self::register("dyed_shulker_box", new DyedShulkerBox(new BID(Ids::DYED_SHULKER_BOX, TileShulkerBox::class), "Dyed Shulker Box", $shulkerBoxBreakInfo));
self::register("stained_glass", new StainedGlass(new BID(Ids::STAINED_GLASS), "Stained Glass", $glassBreakInfo));
self::register("stained_glass_pane", new StainedGlassPane(new BID(Ids::STAINED_GLASS_PANE), "Stained Glass Pane", $glassBreakInfo));
self::register("stained_clay", new StainedHardenedClay(new BID(Ids::STAINED_CLAY), "Stained Clay", $hardenedClayBreakInfo));
self::register("stained_hardened_glass", new StainedHardenedGlass(new BID(Ids::STAINED_HARDENED_GLASS), "Stained Hardened Glass", $hardenedGlassBreakInfo));
self::register("stained_hardened_glass_pane", new StainedHardenedGlassPane(new BID(Ids::STAINED_HARDENED_GLASS_PANE), "Stained Hardened Glass Pane", $hardenedGlassBreakInfo));
self::register("carpet", new Carpet(new BID(Ids::CARPET), "Carpet", new BreakInfo(0.1)));
self::register("concrete", new Concrete(new BID(Ids::CONCRETE), "Concrete", BreakInfo::pickaxe(1.8, ToolTier::WOOD())));
self::register("concrete_powder", new ConcretePowder(new BID(Ids::CONCRETE_POWDER), "Concrete Powder", BreakInfo::shovel(0.5)));
self::register("wool", new Wool(new BID(Ids::WOOL), "Wool", new class(0.8, ToolType::SHEARS) extends BreakInfo{
self::register("carpet", new Carpet(new BID(Ids::CARPET), "Carpet", new Info(new BreakInfo(0.1))));
self::register("concrete", new Concrete(new BID(Ids::CONCRETE), "Concrete", new Info(BreakInfo::pickaxe(1.8, ToolTier::WOOD()))));
self::register("concrete_powder", new ConcretePowder(new BID(Ids::CONCRETE_POWDER), "Concrete Powder", new Info(BreakInfo::shovel(0.5))));
self::register("wool", new Wool(new BID(Ids::WOOL), "Wool", new Info(new class(0.8, ToolType::SHEARS) extends BreakInfo{
public function getBreakTime(Item $item) : float{
$time = parent::getBreakTime($item);
if($item->getBlockToolType() === ToolType::SHEARS){
@ -1121,10 +1122,10 @@ final class VanillaBlocks{
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 = BreakInfo::pickaxe(2.0, ToolTier::WOOD(), 30.0);
$wallBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD(), 30.0));
self::register("cobblestone_wall", new Wall(new BID(Ids::COBBLESTONE_WALL), "Cobblestone Wall", $wallBreakInfo));
self::register("andesite_wall", new Wall(new BID(Ids::ANDESITE_WALL), "Andesite Wall", $wallBreakInfo));
self::register("brick_wall", new Wall(new BID(Ids::BRICK_WALL), "Brick Wall", $wallBreakInfo));
@ -1142,7 +1143,7 @@ final class VanillaBlocks{
self::registerElements();
$chemistryTableBreakInfo = BreakInfo::pickaxe(2.5, ToolTier::WOOD());
$chemistryTableBreakInfo = new Info(BreakInfo::pickaxe(2.5, ToolTier::WOOD()));
self::register("compound_creator", new ChemistryTable(new BID(Ids::COMPOUND_CREATOR), "Compound Creator", $chemistryTableBreakInfo));
self::register("element_constructor", new ChemistryTable(new BID(Ids::ELEMENT_CONSTRUCTOR), "Element Constructor", $chemistryTableBreakInfo));
self::register("lab_table", new ChemistryTable(new BID(Ids::LAB_TABLE), "Lab Table", $chemistryTableBreakInfo));
@ -1155,23 +1156,23 @@ final class VanillaBlocks{
self::register("coral", new Coral(
new BID(Ids::CORAL),
"Coral",
BreakInfo::instant(),
new Info(BreakInfo::instant()),
));
self::register("coral_fan", new FloorCoralFan(
new BID(Ids::CORAL_FAN),
"Coral Fan",
BreakInfo::instant(),
new Info(BreakInfo::instant()),
));
self::register("wall_coral_fan", new WallCoralFan(
new BID(Ids::WALL_CORAL_FAN),
"Wall Coral Fan",
BreakInfo::instant(),
new Info(BreakInfo::instant()),
));
self::register("mangrove_roots", new MangroveRoots(new BID(Ids::MANGROVE_ROOTS), "Mangrove Roots", BreakInfo::axe(0.7)));
self::register("mangrove_roots", new MangroveRoots(new BID(Ids::MANGROVE_ROOTS), "Mangrove Roots", new Info(BreakInfo::axe(0.7))));
//TODO: muddy mangrove roots are supposed to be axis-rotatable (Bedrock parity issue https://bugs.mojang.com/browse/MCPE-153721)
self::register("muddy_mangrove_roots", new Transparent(new BID(Ids::MUDDY_MANGROVE_ROOTS), "Muddy Mangrove Roots", BreakInfo::shovel(0.7)));
self::register("froglight", new Froglight(new BID(Ids::FROGLIGHT), "Froglight", new BreakInfo(0.3)));
self::register("muddy_mangrove_roots", new Transparent(new BID(Ids::MUDDY_MANGROVE_ROOTS), "Muddy Mangrove Roots", new Info(BreakInfo::shovel(0.7))));
self::register("froglight", new Froglight(new BID(Ids::FROGLIGHT), "Froglight", new Info(new BreakInfo(0.3))));
self::registerBlocksR13();
self::registerBlocksR14();
@ -1188,12 +1189,12 @@ final class VanillaBlocks{
}
private static function registerWoodenBlocks() : void{
$planksBreakInfo = BreakInfo::axe(2.0, null, 15.0);
$signBreakInfo = BreakInfo::axe(1.0);
$logBreakInfo = BreakInfo::axe(2.0);
$woodenDoorBreakInfo = BreakInfo::axe(3.0, null, 15.0);
$woodenButtonBreakInfo = BreakInfo::axe(0.5);
$woodenPressurePlateBreakInfo = BreakInfo::axe(0.5);
$planksBreakInfo = new Info(BreakInfo::axe(2.0, null, 15.0));
$signBreakInfo = new Info(BreakInfo::axe(1.0));
$logBreakInfo = new Info(BreakInfo::axe(2.0));
$woodenDoorBreakInfo = new Info(BreakInfo::axe(3.0, null, 15.0));
$woodenButtonBreakInfo = new Info(BreakInfo::axe(0.5));
$woodenPressurePlateBreakInfo = new Info(BreakInfo::axe(0.5));
foreach(WoodType::getAll() as $woodType){
$name = $woodType->getDisplayName();
@ -1221,7 +1222,7 @@ final class VanillaBlocks{
}
private static function registerMushroomBlocks() : void{
$mushroomBlockBreakInfo = BreakInfo::axe(0.2);
$mushroomBlockBreakInfo = new Info(BreakInfo::axe(0.2));
self::register("brown_mushroom_block", new BrownMushroomBlock(new BID(Ids::BROWN_MUSHROOM_BLOCK), "Brown Mushroom Block", $mushroomBlockBreakInfo));
self::register("red_mushroom_block", new RedMushroomBlock(new BID(Ids::RED_MUSHROOM_BLOCK), "Red Mushroom Block", $mushroomBlockBreakInfo));
@ -1232,7 +1233,7 @@ final class VanillaBlocks{
}
private static function registerElements() : void{
$instaBreak = BreakInfo::instant();
$instaBreak = new Info(BreakInfo::instant());
self::register("element_zero", new Opaque(new BID(Ids::ELEMENT_ZERO), "???", $instaBreak));
self::register("element_hydrogen", new Element(new BID(Ids::ELEMENT_HYDROGEN), "Hydrogen", $instaBreak, "h", 1, 5));
@ -1356,7 +1357,7 @@ final class VanillaBlocks{
}
private static function registerOres() : void{
$stoneOreBreakInfo = fn(ToolTier $toolTier) => BreakInfo::pickaxe(3.0, $toolTier);
$stoneOreBreakInfo = fn(ToolTier $toolTier) => new Info(BreakInfo::pickaxe(3.0, $toolTier));
self::register("coal_ore", new CoalOre(new BID(Ids::COAL_ORE), "Coal Ore", $stoneOreBreakInfo(ToolTier::WOOD())));
self::register("copper_ore", new CopperOre(new BID(Ids::COPPER_ORE), "Copper Ore", $stoneOreBreakInfo(ToolTier::STONE())));
self::register("diamond_ore", new DiamondOre(new BID(Ids::DIAMOND_ORE), "Diamond Ore", $stoneOreBreakInfo(ToolTier::IRON())));
@ -1366,7 +1367,7 @@ final class VanillaBlocks{
self::register("lapis_lazuli_ore", new LapisOre(new BID(Ids::LAPIS_LAZULI_ORE), "Lapis Lazuli Ore", $stoneOreBreakInfo(ToolTier::STONE())));
self::register("redstone_ore", new RedstoneOre(new BID(Ids::REDSTONE_ORE), "Redstone Ore", $stoneOreBreakInfo(ToolTier::IRON())));
$deepslateOreBreakInfo = fn(ToolTier $toolTier) => BreakInfo::pickaxe(4.5, $toolTier);
$deepslateOreBreakInfo = fn(ToolTier $toolTier) => new Info(BreakInfo::pickaxe(4.5, $toolTier));
self::register("deepslate_coal_ore", new CoalOre(new BID(Ids::DEEPSLATE_COAL_ORE), "Deepslate Coal Ore", $deepslateOreBreakInfo(ToolTier::WOOD())));
self::register("deepslate_copper_ore", new CopperOre(new BID(Ids::DEEPSLATE_COPPER_ORE), "Deepslate Copper Ore", $deepslateOreBreakInfo(ToolTier::STONE())));
self::register("deepslate_diamond_ore", new DiamondOre(new BID(Ids::DEEPSLATE_DIAMOND_ORE), "Deepslate Diamond Ore", $deepslateOreBreakInfo(ToolTier::IRON())));
@ -1376,49 +1377,49 @@ final class VanillaBlocks{
self::register("deepslate_lapis_lazuli_ore", new LapisOre(new BID(Ids::DEEPSLATE_LAPIS_LAZULI_ORE), "Deepslate Lapis Lazuli Ore", $deepslateOreBreakInfo(ToolTier::STONE())));
self::register("deepslate_redstone_ore", new RedstoneOre(new BID(Ids::DEEPSLATE_REDSTONE_ORE), "Deepslate Redstone Ore", $deepslateOreBreakInfo(ToolTier::IRON())));
$netherrackOreBreakInfo = BreakInfo::pickaxe(3.0, ToolTier::WOOD());
$netherrackOreBreakInfo = new Info(BreakInfo::pickaxe(3.0, ToolTier::WOOD()));
self::register("nether_quartz_ore", new NetherQuartzOre(new BID(Ids::NETHER_QUARTZ_ORE), "Nether Quartz Ore", $netherrackOreBreakInfo));
self::register("nether_gold_ore", new NetherGoldOre(new BID(Ids::NETHER_GOLD_ORE), "Nether Gold Ore", $netherrackOreBreakInfo));
}
private static function registerCraftingTables() : void{
//TODO: this is the same for all wooden crafting blocks
$craftingBlockBreakInfo = BreakInfo::axe(2.5);
$craftingBlockBreakInfo = new Info(BreakInfo::axe(2.5));
self::register("cartography_table", new CartographyTable(new BID(Ids::CARTOGRAPHY_TABLE), "Cartography Table", $craftingBlockBreakInfo));
self::register("smithing_table", new SmithingTable(new BID(Ids::SMITHING_TABLE), "Smithing Table", $craftingBlockBreakInfo));
}
private static function registerChorusBlocks() : void{
$chorusBlockBreakInfo = BreakInfo::axe(0.4);
$chorusBlockBreakInfo = new Info(BreakInfo::axe(0.4));
self::register("chorus_plant", new ChorusPlant(new BID(Ids::CHORUS_PLANT), "Chorus Plant", $chorusBlockBreakInfo));
self::register("chorus_flower", new ChorusFlower(new BID(Ids::CHORUS_FLOWER), "Chorus Flower", $chorusBlockBreakInfo));
}
private static function registerBlocksR13() : void{
self::register("light", new Light(new BID(Ids::LIGHT), "Light Block", BreakInfo::indestructible()));
self::register("wither_rose", new WitherRose(new BID(Ids::WITHER_ROSE), "Wither Rose", BreakInfo::instant()));
self::register("light", new Light(new BID(Ids::LIGHT), "Light Block", new Info(BreakInfo::indestructible())));
self::register("wither_rose", new WitherRose(new BID(Ids::WITHER_ROSE), "Wither Rose", new Info(BreakInfo::instant())));
}
private static function registerBlocksR14() : void{
self::register("honeycomb", new Opaque(new BID(Ids::HONEYCOMB), "Honeycomb Block", new BreakInfo(0.6)));
self::register("honeycomb", new Opaque(new BID(Ids::HONEYCOMB), "Honeycomb Block", new Info(new BreakInfo(0.6))));
}
private static function registerBlocksR16() : void{
//for some reason, slabs have weird hardness like the legacy ones
$slabBreakInfo = BreakInfo::pickaxe(2.0, ToolTier::WOOD(), 30.0);
$slabBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD(), 30.0));
self::register("ancient_debris", new Opaque(new BID(Ids::ANCIENT_DEBRIS), "Ancient Debris", BreakInfo::pickaxe(30, ToolTier::DIAMOND(), 3600.0)));
$netheriteBreakInfo = BreakInfo::pickaxe(50, ToolTier::DIAMOND(), 3600.0);
self::register("ancient_debris", new Opaque(new BID(Ids::ANCIENT_DEBRIS), "Ancient Debris", new Info(BreakInfo::pickaxe(30, ToolTier::DIAMOND(), 3600.0))));
$netheriteBreakInfo = new Info(BreakInfo::pickaxe(50, ToolTier::DIAMOND(), 3600.0));
self::register("netherite", new class(new BID(Ids::NETHERITE), "Netherite Block", $netheriteBreakInfo) extends Opaque{
public function isFireProofAsItem() : bool{ return true; }
});
$basaltBreakInfo = BreakInfo::pickaxe(1.25, ToolTier::WOOD(), 21.0);
$basaltBreakInfo = new Info(BreakInfo::pickaxe(1.25, ToolTier::WOOD(), 21.0));
self::register("basalt", new SimplePillar(new BID(Ids::BASALT), "Basalt", $basaltBreakInfo));
self::register("polished_basalt", new SimplePillar(new BID(Ids::POLISHED_BASALT), "Polished Basalt", $basaltBreakInfo));
self::register("smooth_basalt", new Opaque(new BID(Ids::SMOOTH_BASALT), "Smooth Basalt", $basaltBreakInfo));
$blackstoneBreakInfo = BreakInfo::pickaxe(1.5, ToolTier::WOOD(), 30.0);
$blackstoneBreakInfo = new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD(), 30.0));
self::register("blackstone", new Opaque(new BID(Ids::BLACKSTONE), "Blackstone", $blackstoneBreakInfo));
self::register("blackstone_slab", new Slab(new BID(Ids::BLACKSTONE_SLAB), "Blackstone", $slabBreakInfo));
self::register("blackstone_stairs", new Stair(new BID(Ids::BLACKSTONE_STAIRS), "Blackstone Stairs", $blackstoneBreakInfo));
@ -1429,8 +1430,8 @@ final class VanillaBlocks{
//TODO: polished blackstone ought to have 2.0 hardness (as per java) but it's 1.5 in Bedrock (probably parity bug)
$prefix = fn(string $thing) => "Polished Blackstone" . ($thing !== "" ? " $thing" : "");
self::register("polished_blackstone", new Opaque(new BID(Ids::POLISHED_BLACKSTONE), $prefix(""), $blackstoneBreakInfo));
self::register("polished_blackstone_button", new StoneButton(new BID(Ids::POLISHED_BLACKSTONE_BUTTON), $prefix("Button"), BreakInfo::pickaxe(0.5)));
self::register("polished_blackstone_pressure_plate", new StonePressurePlate(new BID(Ids::POLISHED_BLACKSTONE_PRESSURE_PLATE), $prefix("Pressure Plate"), BreakInfo::pickaxe(0.5, ToolTier::WOOD())));
self::register("polished_blackstone_button", new StoneButton(new BID(Ids::POLISHED_BLACKSTONE_BUTTON), $prefix("Button"), new Info(BreakInfo::pickaxe(0.5))));
self::register("polished_blackstone_pressure_plate", new StonePressurePlate(new BID(Ids::POLISHED_BLACKSTONE_PRESSURE_PLATE), $prefix("Pressure Plate"), new Info(BreakInfo::pickaxe(0.5, ToolTier::WOOD()))));
self::register("polished_blackstone_slab", new Slab(new BID(Ids::POLISHED_BLACKSTONE_SLAB), $prefix(""), $slabBreakInfo));
self::register("polished_blackstone_stairs", new Stair(new BID(Ids::POLISHED_BLACKSTONE_STAIRS), $prefix("Stairs"), $blackstoneBreakInfo));
self::register("polished_blackstone_wall", new Wall(new BID(Ids::POLISHED_BLACKSTONE_WALL), $prefix("Wall"), $blackstoneBreakInfo));
@ -1443,69 +1444,69 @@ final class VanillaBlocks{
self::register("polished_blackstone_brick_wall", new Wall(new BID(Ids::POLISHED_BLACKSTONE_BRICK_WALL), $prefix("Wall"), $blackstoneBreakInfo));
self::register("cracked_polished_blackstone_bricks", new Opaque(new BID(Ids::CRACKED_POLISHED_BLACKSTONE_BRICKS), "Cracked Polished Blackstone Bricks", $blackstoneBreakInfo));
self::register("soul_torch", new Torch(new BID(Ids::SOUL_TORCH), "Soul Torch", BreakInfo::instant()));
self::register("soul_fire", new SoulFire(new BID(Ids::SOUL_FIRE), "Soul Fire", BreakInfo::instant()));
self::register("soul_torch", new Torch(new BID(Ids::SOUL_TORCH), "Soul Torch", new Info(BreakInfo::instant())));
self::register("soul_fire", new SoulFire(new BID(Ids::SOUL_FIRE), "Soul Fire", new Info(BreakInfo::instant())));
//TODO: soul soul ought to have 0.5 hardness (as per java) but it's 1.0 in Bedrock (probably parity bug)
self::register("soul_soil", new Opaque(new BID(Ids::SOUL_SOIL), "Soul Soil", BreakInfo::shovel(1.0)));
self::register("soul_soil", new Opaque(new BID(Ids::SOUL_SOIL), "Soul Soil", new Info(BreakInfo::shovel(1.0))));
self::register("shroomlight", new class(new BID(Ids::SHROOMLIGHT), "Shroomlight", new BreakInfo(1.0, ToolType::HOE)) extends Opaque{
self::register("shroomlight", new class(new BID(Ids::SHROOMLIGHT), "Shroomlight", new Info(new BreakInfo(1.0, ToolType::HOE))) extends Opaque{
public function getLightLevel() : int{ return 15; }
});
self::register("warped_wart_block", new Opaque(new BID(Ids::WARPED_WART_BLOCK), "Warped Wart Block", new BreakInfo(1.0, ToolType::HOE)));
self::register("crying_obsidian", new class(new BID(Ids::CRYING_OBSIDIAN), "Crying Obsidian", BreakInfo::pickaxe(35.0 /* 50 in Java */, ToolTier::DIAMOND(), 6000.0)) extends Opaque{
self::register("warped_wart_block", new Opaque(new BID(Ids::WARPED_WART_BLOCK), "Warped Wart Block", new Info(new BreakInfo(1.0, ToolType::HOE))));
self::register("crying_obsidian", new class(new BID(Ids::CRYING_OBSIDIAN), "Crying Obsidian", new Info(BreakInfo::pickaxe(35.0 /* 50 in Java */, ToolTier::DIAMOND(), 6000.0))) extends Opaque{
public function getLightLevel() : int{ return 10;}
});
}
private static function registerBlocksR17() : void{
//in java this can be acquired using any tool - seems to be a parity issue in bedrock
self::register("amethyst", new Opaque(new BID(Ids::AMETHYST), "Amethyst", BreakInfo::pickaxe(1.5, ToolTier::WOOD())));
self::register("amethyst", new Opaque(new BID(Ids::AMETHYST), "Amethyst", new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD()))));
self::register("calcite", new Opaque(new BID(Ids::CALCITE), "Calcite", BreakInfo::pickaxe(0.75, ToolTier::WOOD())));
self::register("tuff", new Opaque(new BID(Ids::TUFF), "Tuff", BreakInfo::pickaxe(1.5, ToolTier::WOOD(), 30.0)));
self::register("calcite", new Opaque(new BID(Ids::CALCITE), "Calcite", new Info(BreakInfo::pickaxe(0.75, ToolTier::WOOD()))));
self::register("tuff", new Opaque(new BID(Ids::TUFF), "Tuff", new Info(BreakInfo::pickaxe(1.5, ToolTier::WOOD(), 30.0))));
self::register("raw_copper", new Opaque(new BID(Ids::RAW_COPPER), "Raw Copper Block", BreakInfo::pickaxe(5, ToolTier::STONE(), 30.0)));
self::register("raw_gold", new Opaque(new BID(Ids::RAW_GOLD), "Raw Gold Block", BreakInfo::pickaxe(5, ToolTier::IRON(), 30.0)));
self::register("raw_iron", new Opaque(new BID(Ids::RAW_IRON), "Raw Iron Block", BreakInfo::pickaxe(5, ToolTier::STONE(), 30.0)));
self::register("raw_copper", new Opaque(new BID(Ids::RAW_COPPER), "Raw Copper Block", new Info(BreakInfo::pickaxe(5, ToolTier::STONE(), 30.0))));
self::register("raw_gold", new Opaque(new BID(Ids::RAW_GOLD), "Raw Gold Block", new Info(BreakInfo::pickaxe(5, ToolTier::IRON(), 30.0))));
self::register("raw_iron", new Opaque(new BID(Ids::RAW_IRON), "Raw Iron Block", new Info(BreakInfo::pickaxe(5, ToolTier::STONE(), 30.0))));
$deepslateBreakInfo = BreakInfo::pickaxe(3, ToolTier::WOOD(), 18.0);
$deepslateBreakInfo = new Info(BreakInfo::pickaxe(3, ToolTier::WOOD(), 18.0));
self::register("deepslate", new SimplePillar(new BID(Ids::DEEPSLATE), "Deepslate", $deepslateBreakInfo));
//TODO: parity issue here - in Java this has a hardness of 3.0, but in bedrock it's 3.5
self::register("chiseled_deepslate", new Opaque(new BID(Ids::CHISELED_DEEPSLATE), "Chiseled Deepslate", BreakInfo::pickaxe(3.5, ToolTier::WOOD(), 18.0)));
self::register("chiseled_deepslate", new Opaque(new BID(Ids::CHISELED_DEEPSLATE), "Chiseled Deepslate", new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD(), 18.0))));
$deepslateBrickBreakInfo = BreakInfo::pickaxe(3.5, ToolTier::WOOD(), 18.0);
$deepslateBrickBreakInfo = new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD(), 18.0));
self::register("deepslate_bricks", new Opaque(new BID(Ids::DEEPSLATE_BRICKS), "Deepslate Bricks", $deepslateBrickBreakInfo));
self::register("deepslate_brick_slab", new Slab(new BID(Ids::DEEPSLATE_BRICK_SLAB), "Deepslate Brick", $deepslateBrickBreakInfo));
self::register("deepslate_brick_stairs", new Stair(new BID(Ids::DEEPSLATE_BRICK_STAIRS), "Deepslate Brick Stairs", $deepslateBrickBreakInfo));
self::register("deepslate_brick_wall", new Wall(new BID(Ids::DEEPSLATE_BRICK_WALL), "Deepslate Brick Wall", $deepslateBrickBreakInfo));
self::register("cracked_deepslate_bricks", new Opaque(new BID(Ids::CRACKED_DEEPSLATE_BRICKS), "Cracked Deepslate Bricks", $deepslateBrickBreakInfo));
$deepslateTilesBreakInfo = BreakInfo::pickaxe(3.5, ToolTier::WOOD(), 18.0);
$deepslateTilesBreakInfo = new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD(), 18.0));
self::register("deepslate_tiles", new Opaque(new BID(Ids::DEEPSLATE_TILES), "Deepslate Tiles", $deepslateTilesBreakInfo));
self::register("deepslate_tile_slab", new Slab(new BID(Ids::DEEPSLATE_TILE_SLAB), "Deepslate Tile", $deepslateTilesBreakInfo));
self::register("deepslate_tile_stairs", new Stair(new BID(Ids::DEEPSLATE_TILE_STAIRS), "Deepslate Tile Stairs", $deepslateTilesBreakInfo));
self::register("deepslate_tile_wall", new Wall(new BID(Ids::DEEPSLATE_TILE_WALL), "Deepslate Tile Wall", $deepslateTilesBreakInfo));
self::register("cracked_deepslate_tiles", new Opaque(new BID(Ids::CRACKED_DEEPSLATE_TILES), "Cracked Deepslate Tiles", $deepslateTilesBreakInfo));
$cobbledDeepslateBreakInfo = BreakInfo::pickaxe(3.5, ToolTier::WOOD(), 18.0);
$cobbledDeepslateBreakInfo = new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD(), 18.0));
self::register("cobbled_deepslate", new Opaque(new BID(Ids::COBBLED_DEEPSLATE), "Cobbled Deepslate", $cobbledDeepslateBreakInfo));
self::register("cobbled_deepslate_slab", new Slab(new BID(Ids::COBBLED_DEEPSLATE_SLAB), "Cobbled Deepslate", $cobbledDeepslateBreakInfo));
self::register("cobbled_deepslate_stairs", new Stair(new BID(Ids::COBBLED_DEEPSLATE_STAIRS), "Cobbled Deepslate Stairs", $cobbledDeepslateBreakInfo));
self::register("cobbled_deepslate_wall", new Wall(new BID(Ids::COBBLED_DEEPSLATE_WALL), "Cobbled Deepslate Wall", $cobbledDeepslateBreakInfo));
$polishedDeepslateBreakInfo = BreakInfo::pickaxe(3.5, ToolTier::WOOD(), 18.0);
$polishedDeepslateBreakInfo = new Info(BreakInfo::pickaxe(3.5, ToolTier::WOOD(), 18.0));
self::register("polished_deepslate", new Opaque(new BID(Ids::POLISHED_DEEPSLATE), "Polished Deepslate", $polishedDeepslateBreakInfo));
self::register("polished_deepslate_slab", new Slab(new BID(Ids::POLISHED_DEEPSLATE_SLAB), "Polished Deepslate", $polishedDeepslateBreakInfo));
self::register("polished_deepslate_stairs", new Stair(new BID(Ids::POLISHED_DEEPSLATE_STAIRS), "Polished Deepslate Stairs", $polishedDeepslateBreakInfo));
self::register("polished_deepslate_wall", new Wall(new BID(Ids::POLISHED_DEEPSLATE_WALL), "Polished Deepslate Wall", $polishedDeepslateBreakInfo));
self::register("tinted_glass", new TintedGlass(new BID(Ids::TINTED_GLASS), "Tinted Glass", new BreakInfo(0.3)));
self::register("tinted_glass", new TintedGlass(new BID(Ids::TINTED_GLASS), "Tinted Glass", new Info(new BreakInfo(0.3))));
//blast resistance should be 30 if we were matched with java :(
$copperBreakInfo = BreakInfo::pickaxe(3.0, ToolTier::STONE(), 18.0);
$copperBreakInfo = new Info(BreakInfo::pickaxe(3.0, ToolTier::STONE(), 18.0));
self::register("lightning_rod", new LightningRod(new BID(Ids::LIGHTNING_ROD), "Lightning Rod", $copperBreakInfo));
self::register("copper", new Copper(new BID(Ids::COPPER), "Copper Block", $copperBreakInfo));
@ -1513,27 +1514,27 @@ final class VanillaBlocks{
self::register("cut_copper_slab", new CopperSlab(new BID(Ids::CUT_COPPER_SLAB), "Cut Copper Slab", $copperBreakInfo));
self::register("cut_copper_stairs", new CopperStairs(new BID(Ids::CUT_COPPER_STAIRS), "Cut Copper Stairs", $copperBreakInfo));
$candleBreakInfo = new BreakInfo(0.1);
$candleBreakInfo = new Info(new BreakInfo(0.1));
self::register("candle", new Candle(new BID(Ids::CANDLE), "Candle", $candleBreakInfo));
self::register("dyed_candle", new DyedCandle(new BID(Ids::DYED_CANDLE), "Dyed Candle", $candleBreakInfo));
//TODO: duplicated break info :(
$cakeBreakInfo = new BreakInfo(0.5);
$cakeBreakInfo = new Info(new BreakInfo(0.5));
self::register("cake_with_candle", new CakeWithCandle(new BID(Ids::CAKE_WITH_CANDLE), "Cake With Candle", $cakeBreakInfo));
self::register("cake_with_dyed_candle", new CakeWithDyedCandle(new BID(Ids::CAKE_WITH_DYED_CANDLE), "Cake With Dyed Candle", $cakeBreakInfo));
self::register("hanging_roots", new HangingRoots(new BID(Ids::HANGING_ROOTS), "Hanging Roots", BreakInfo::instant(ToolType::SHEARS, 1)));
self::register("hanging_roots", new HangingRoots(new BID(Ids::HANGING_ROOTS), "Hanging Roots", new Info(BreakInfo::instant(ToolType::SHEARS, 1))));
}
private static function registerBlocksR18() : void{
self::register("spore_blossom", new SporeBlossom(new BID(Ids::SPORE_BLOSSOM), "Spore Blossom", BreakInfo::instant()));
self::register("spore_blossom", new SporeBlossom(new BID(Ids::SPORE_BLOSSOM), "Spore Blossom", new Info(BreakInfo::instant())));
}
private static function registerMudBlocks() : void{
self::register("mud", new Opaque(new BID(Ids::MUD), "Mud", BreakInfo::shovel(0.5)));
self::register("packed_mud", new Opaque(new BID(Ids::PACKED_MUD), "Packed Mud", BreakInfo::pickaxe(1.0, null, 15.0)));
self::register("mud", new Opaque(new BID(Ids::MUD), "Mud", new Info(BreakInfo::shovel(0.5))));
self::register("packed_mud", new Opaque(new BID(Ids::PACKED_MUD), "Packed Mud", new Info(BreakInfo::pickaxe(1.0, null, 15.0))));
$mudBricksBreakInfo = BreakInfo::pickaxe(2.0, ToolTier::WOOD(), 30.0);
$mudBricksBreakInfo = new Info(BreakInfo::pickaxe(2.0, ToolTier::WOOD(), 30.0));
self::register("mud_bricks", new Opaque(new BID(Ids::MUD_BRICKS), "Mud Bricks", $mudBricksBreakInfo));
self::register("mud_brick_slab", new Slab(new BID(Ids::MUD_BRICK_SLAB), "Mud Brick", $mudBricksBreakInfo));
@ -1542,7 +1543,7 @@ final class VanillaBlocks{
}
private static function registerCauldronBlocks() : void{
$cauldronBreakInfo = BreakInfo::pickaxe(2, ToolTier::WOOD());
$cauldronBreakInfo = new Info(BreakInfo::pickaxe(2, ToolTier::WOOD()));
self::register("cauldron", new Cauldron(new BID(Ids::CAULDRON, TileCauldron::class), "Cauldron", $cauldronBreakInfo));
self::register("water_cauldron", new WaterCauldron(new BID(Ids::WATER_CAULDRON, TileCauldron::class), "Water Cauldron", $cauldronBreakInfo));

View File

@ -29,9 +29,9 @@ use pocketmine\block\utils\DyeColor;
class Wool extends Opaque{
use ColoredTrait;
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->color = DyeColor::WHITE();
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
public function getFlameEncouragement() : int{

View File

@ -25,6 +25,7 @@ namespace pocketmine\block\utils;
use pocketmine\block\BlockBreakInfo;
use pocketmine\block\BlockIdentifier;
use pocketmine\block\BlockTypeInfo;
use pocketmine\data\runtime\RuntimeDataReader;
use pocketmine\data\runtime\RuntimeDataWriter;
use pocketmine\item\Axe;
@ -40,9 +41,9 @@ trait CopperTrait{
private CopperOxidation $oxidation;
private bool $waxed = false;
public function __construct(BlockIdentifier $identifier, string $name, BlockBreakInfo $breakInfo){
public function __construct(BlockIdentifier $identifier, string $name, BlockTypeInfo $typeInfo){
$this->oxidation = CopperOxidation::NONE();
parent::__construct($identifier, $name, $breakInfo);
parent::__construct($identifier, $name, $typeInfo);
}
public function getRequiredTypeDataBits() : int{ return 3; }

View File

@ -25,13 +25,14 @@ namespace pocketmine\block\utils;
use pocketmine\block\BlockBreakInfo;
use pocketmine\block\BlockIdentifier;
use pocketmine\block\BlockTypeInfo;
trait WoodTypeTrait{
private WoodType $woodType; //immutable for now
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo, WoodType $woodType){
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo, WoodType $woodType){
$this->woodType = $woodType;
parent::__construct($idInfo, $name, $breakInfo);
parent::__construct($idInfo, $name, $typeInfo);
}
public function getWoodType() : WoodType{

View File

@ -43,7 +43,7 @@ class BlockTest extends TestCase{
* Test registering a block which would overwrite another block, without forcing it
*/
public function testAccidentalOverrideBlock() : void{
$block = new MyCustomBlock(new BlockIdentifier(BlockTypeIds::COBBLESTONE), "Cobblestone", BlockBreakInfo::instant());
$block = new MyCustomBlock(new BlockIdentifier(BlockTypeIds::COBBLESTONE), "Cobblestone", new BlockTypeInfo(BlockBreakInfo::instant()));
$this->expectException(\InvalidArgumentException::class);
$this->blockFactory->register($block);
}
@ -52,7 +52,7 @@ class BlockTest extends TestCase{
* Test registering a block deliberately overwriting another block works as expected
*/
public function testDeliberateOverrideBlock() : void{
$block = new MyCustomBlock(new BlockIdentifier(BlockTypeIds::COBBLESTONE), "Cobblestone", BlockBreakInfo::instant());
$block = new MyCustomBlock(new BlockIdentifier(BlockTypeIds::COBBLESTONE), "Cobblestone", new BlockTypeInfo(BlockBreakInfo::instant()));
$this->blockFactory->register($block, true);
self::assertInstanceOf(MyCustomBlock::class, $this->blockFactory->fromStateId($block->getStateId()));
}
@ -63,7 +63,7 @@ class BlockTest extends TestCase{
public function testRegisterNewBlock() : void{
for($i = BlockTypeIds::FIRST_UNUSED_BLOCK_ID; $i < BlockTypeIds::FIRST_UNUSED_BLOCK_ID + 256; ++$i){
if(!$this->blockFactory->isRegistered($i)){
$b = new StrangeNewBlock(new BlockIdentifier($i), "Strange New Block", BlockBreakInfo::instant());
$b = new StrangeNewBlock(new BlockIdentifier($i), "Strange New Block", new BlockTypeInfo(BlockBreakInfo::instant()));
$this->blockFactory->register($b);
self::assertInstanceOf(StrangeNewBlock::class, $this->blockFactory->fromStateId($b->getStateId()));
return;
@ -78,7 +78,7 @@ class BlockTest extends TestCase{
*/
public function testRegisterIdTooSmall() : void{
self::expectException(\InvalidArgumentException::class);
$this->blockFactory->register(new OutOfBoundsBlock(new BlockIdentifier(-1), "Out Of Bounds Block", BlockBreakInfo::instant()));
$this->blockFactory->register(new OutOfBoundsBlock(new BlockIdentifier(-1), "Out Of Bounds Block", new BlockTypeInfo(BlockBreakInfo::instant())));
}
/**