Added mud bricks and related blocks

This commit is contained in:
Dylan K. Taylor 2022-07-06 00:02:51 +01:00
parent ebe6782295
commit fe93609c8d
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
7 changed files with 38 additions and 2 deletions

View File

@ -567,6 +567,7 @@ class BlockFactory{
$this->registerBlocksR14();
$this->registerBlocksR16();
$this->registerBlocksR17();
$this->registerMudBlocks();
$this->registerOres();
}
@ -829,6 +830,15 @@ class BlockFactory{
$this->register(new Wall(new BID(Ids::POLISHED_DEEPSLATE_WALL), "Polished Deepslate Wall", $polishedDeepslateBreakInfo));
}
private function registerMudBlocks() : void{
$mudBricksBreakInfo = new BreakInfo(2.0, ToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 30.0);
$this->register(new Opaque(new BID(Ids::MUD_BRICKS), "Mud Bricks", $mudBricksBreakInfo));
$this->register(new Slab(new BID(Ids::MUD_BRICK_SLAB), "Mud Brick", $mudBricksBreakInfo));
$this->register(new Stair(new BID(Ids::MUD_BRICK_STAIRS), "Mud Brick Stairs", $mudBricksBreakInfo));
$this->register(new Wall(new BID(Ids::MUD_BRICK_WALL), "Mud Brick Wall", $mudBricksBreakInfo));
}
/**
* Maps a block type to its corresponding type ID. This is necessary for the block to be recognized when loading
* from disk, and also when being read at runtime.

View File

@ -670,6 +670,12 @@ final class BlockTypeIds{
public const DEEPSLATE_COPPER_ORE = 10643;
public const COPPER_ORE = 10644;
public const NETHER_GOLD_ORE = 10645;
public const MUD = 10646;
public const MUD_BRICKS = 10647;
public const MUD_BRICK_SLAB = 10648;
public const MUD_BRICK_STAIRS = 10649;
public const MUD_BRICK_WALL = 10650;
public const PACKED_MUD = 10651;
public const FIRST_UNUSED_BLOCK_ID = 10646;
public const FIRST_UNUSED_BLOCK_ID = 10652;
}

View File

@ -446,6 +446,10 @@ use pocketmine\utils\CloningRegistryTrait;
* @method static Slab MOSSY_STONE_BRICK_SLAB()
* @method static Stair MOSSY_STONE_BRICK_STAIRS()
* @method static Wall MOSSY_STONE_BRICK_WALL()
* @method static Opaque MUD_BRICKS()
* @method static Slab MUD_BRICK_SLAB()
* @method static Stair MUD_BRICK_STAIRS()
* @method static Wall MUD_BRICK_WALL()
* @method static MushroomStem MUSHROOM_STEM()
* @method static Mycelium MYCELIUM()
* @method static Netherrack NETHERRACK()
@ -1087,6 +1091,10 @@ final class VanillaBlocks{
self::register("mossy_stone_brick_stairs", $factory->fromTypeId(Ids::MOSSY_STONE_BRICK_STAIRS));
self::register("mossy_stone_brick_wall", $factory->fromTypeId(Ids::MOSSY_STONE_BRICK_WALL));
self::register("mossy_stone_bricks", $factory->fromTypeId(Ids::MOSSY_STONE_BRICKS));
self::register("mud_brick_slab", $factory->fromTypeId(Ids::MUD_BRICK_SLAB));
self::register("mud_brick_stairs", $factory->fromTypeId(Ids::MUD_BRICK_STAIRS));
self::register("mud_brick_wall", $factory->fromTypeId(Ids::MUD_BRICK_WALL));
self::register("mud_bricks", $factory->fromTypeId(Ids::MUD_BRICKS));
self::register("mushroom_stem", $factory->fromTypeId(Ids::MUSHROOM_STEM));
self::register("mycelium", $factory->fromTypeId(Ids::MYCELIUM));
self::register("nether_brick_fence", $factory->fromTypeId(Ids::NETHER_BRICK_FENCE));

View File

@ -891,6 +891,10 @@ final class BlockObjectToBlockStateSerializer implements BlockStateSerializer{
$this->map(Blocks::MOSSY_STONE_BRICK_SLAB(), fn(Slab $block) => Helper::encodeStoneSlab4($block, StringValues::STONE_SLAB_TYPE_4_MOSSY_STONE_BRICK));
$this->mapStairs(Blocks::MOSSY_STONE_BRICK_STAIRS(), Ids::MOSSY_STONE_BRICK_STAIRS);
$this->map(Blocks::MOSSY_STONE_BRICK_WALL(), fn(Wall $block) => Helper::encodeLegacyWall($block, StringValues::WALL_BLOCK_TYPE_MOSSY_STONE_BRICK));
$this->mapSimple(Blocks::MUD_BRICKS(), Ids::MUD_BRICKS);
$this->mapSlab(Blocks::MUD_BRICK_SLAB(), Ids::MUD_BRICK_SLAB, Ids::MUD_BRICK_DOUBLE_SLAB);
$this->mapStairs(Blocks::MUD_BRICK_STAIRS(), Ids::MUD_BRICK_STAIRS);
$this->map(Blocks::MUD_BRICK_WALL(), fn(Wall $block) => Helper::encodeWall($block, new Writer(Ids::MUD_BRICK_WALL)));
$this->map(Blocks::MUSHROOM_STEM(), fn() => Writer::create(Ids::BROWN_MUSHROOM_BLOCK)
->writeInt(StateNames::HUGE_MUSHROOM_BITS, BlockLegacyMetadata::MUSHROOM_BLOCK_STEM));
$this->mapSimple(Blocks::MYCELIUM(), Ids::MYCELIUM);

View File

@ -772,6 +772,10 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
$this->map(Ids::MOSSY_COBBLESTONE, fn() => Blocks::MOSSY_COBBLESTONE());
$this->mapStairs(Ids::MOSSY_COBBLESTONE_STAIRS, fn() => Blocks::MOSSY_COBBLESTONE_STAIRS());
$this->mapStairs(Ids::MOSSY_STONE_BRICK_STAIRS, fn() => Blocks::MOSSY_STONE_BRICK_STAIRS());
$this->map(Ids::MUD_BRICKS, fn() => Blocks::MUD_BRICKS());
$this->mapSlab(Ids::MUD_BRICK_SLAB, Ids::MUD_BRICK_DOUBLE_SLAB, fn() => Blocks::MUD_BRICK_SLAB());
$this->mapStairs(Ids::MUD_BRICK_STAIRS, fn() => Blocks::MUD_BRICK_STAIRS());
$this->map(Ids::MUD_BRICK_WALL, fn(Reader $in) => Helper::decodeWall(Blocks::MUD_BRICK_WALL(), $in));
$this->map(Ids::MYCELIUM, fn() => Blocks::MYCELIUM());
$this->map(Ids::NETHER_BRICK, fn() => Blocks::NETHER_BRICKS());
$this->map(Ids::NETHER_BRICK_FENCE, fn() => Blocks::NETHER_BRICK_FENCE());

View File

@ -738,6 +738,10 @@ final class StringToItemParser extends StringToTParser{
$result->registerBlock("mossy_stone_brick_stairs", fn() => Blocks::MOSSY_STONE_BRICK_STAIRS());
$result->registerBlock("mossy_stone_brick_wall", fn() => Blocks::MOSSY_STONE_BRICK_WALL());
$result->registerBlock("mossy_stone_bricks", fn() => Blocks::MOSSY_STONE_BRICKS());
$result->registerBlock("mud_bricks", fn() => Blocks::MUD_BRICKS());
$result->registerBlock("mud_brick_slab", fn() => Blocks::MUD_BRICK_SLAB());
$result->registerBlock("mud_brick_stairs", fn() => Blocks::MUD_BRICK_STAIRS());
$result->registerBlock("mud_brick_wall", fn() => Blocks::MUD_BRICK_WALL());
$result->registerBlock("mushroom_stem", fn() => Blocks::MUSHROOM_STEM());
$result->registerBlock("mycelium", fn() => Blocks::MYCELIUM());
$result->registerBlock("nether_brick_block", fn() => Blocks::NETHER_BRICKS());

File diff suppressed because one or more lines are too long