Added serialize/deserialize support for stonecutter

This commit is contained in:
Dylan K. Taylor 2022-05-24 14:31:40 +01:00
parent 567bd8e330
commit 901a51a9dd
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
2 changed files with 7 additions and 6 deletions

View File

@ -108,6 +108,7 @@ use pocketmine\block\StainedHardenedGlass;
use pocketmine\block\StainedHardenedGlassPane;
use pocketmine\block\Stair;
use pocketmine\block\StoneButton;
use pocketmine\block\Stonecutter;
use pocketmine\block\StonePressurePlate;
use pocketmine\block\Sugarcane;
use pocketmine\block\SweetBerryBush;
@ -994,6 +995,8 @@ final class BlockObjectToBlockStateSerializer implements BlockStateSerializer{
->writeColor($block->getColor());
});
$this->map(Blocks::STONE(), fn() => Helper::encodeStone(StringValues::STONE_TYPE_STONE));
$this->map(Blocks::STONECUTTER(), fn(Stonecutter $block) => Writer::create(Ids::STONECUTTER_BLOCK)
->writeHorizontalFacing($block->getFacing()));
$this->map(Blocks::STONE_BRICKS(), fn() => Helper::encodeStoneBricks(StringValues::STONE_BRICK_TYPE_DEFAULT));
$this->map(Blocks::STONE_BRICK_SLAB(), fn(Slab $block) => Helper::encodeStoneSlab1($block, StringValues::STONE_SLAB_TYPE_STONE_BRICK));
$this->map(Blocks::STONE_BRICK_STAIRS(), fn(Stair $block) => Helper::encodeStairs($block, new Writer(Ids::STONE_BRICK_STAIRS)));

View File

@ -932,6 +932,10 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
};
});
$this->map(Ids::STONECUTTER, fn() => Blocks::LEGACY_STONECUTTER());
$this->map(Ids::STONECUTTER_BLOCK, function(Reader $in) : Block{
return Blocks::STONECUTTER()
->setFacing($in->readHorizontalFacing());
});
$this->map(Ids::STRIPPED_ACACIA_LOG, function(Reader $in) : Block{
return Blocks::STRIPPED_ACACIA_LOG()
->setAxis($in->readPillarAxis());
@ -2181,12 +2185,6 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
* facing_direction (IntTag) = 0, 1, 2, 3, 4, 5
*/
//});
//$this->map(Ids::STONECUTTER_BLOCK, function(Reader $in) : Block{
/*
* TODO: Un-implemented block
* facing_direction (IntTag) = 0, 1, 2, 3, 4, 5
*/
//});
//$this->map(Ids::STRIPPED_CRIMSON_HYPHAE, function(Reader $in) : Block{
/*
* TODO: Un-implemented block