Implemented chain (#5454)

This commit is contained in:
ipad54
2022-12-22 18:22:04 +03:00
committed by GitHub
parent 044d35956e
commit b3473960b4
8 changed files with 65 additions and 2 deletions

View File

@ -45,6 +45,7 @@ use pocketmine\block\Candle;
use pocketmine\block\Carpet;
use pocketmine\block\Carrot;
use pocketmine\block\CarvedPumpkin;
use pocketmine\block\Chain;
use pocketmine\block\ChemistryTable;
use pocketmine\block\Chest;
use pocketmine\block\ChorusFlower;
@ -712,6 +713,10 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{
return Writer::create(Ids::CARVED_PUMPKIN)
->writeLegacyHorizontalFacing($block->getFacing());
});
$this->map(Blocks::CHAIN(), function(Chain $block) : Writer{
return Writer::create(Ids::CHAIN)
->writePillarAxis($block->getAxis());
});
$this->map(Blocks::CHEST(), function(Chest $block) : Writer{
return Writer::create(Ids::CHEST)
->writeHorizontalFacing($block->getFacing());

View File

@ -549,6 +549,10 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{
return Blocks::CARVED_PUMPKIN()
->setFacing($in->readLegacyHorizontalFacing());
});
$this->map(Ids::CHAIN, function(Reader $in) : Block{
return Blocks::CHAIN()
->setAxis($in->readPillarAxis());
});
$this->map(Ids::CHEMISTRY_TABLE, function(Reader $in) : Block{
return (match($type = $in->readString(StateNames::CHEMISTRY_TABLE_TYPE)){
StringValues::CHEMISTRY_TABLE_TYPE_COMPOUND_CREATOR => Blocks::COMPOUND_CREATOR(),

View File

@ -134,6 +134,7 @@ final class ItemSerializerDeserializerRegistrar{
$this->map1to1Block(Ids::BREWING_STAND, Blocks::BREWING_STAND());
$this->map1to1Block(Ids::CAKE, Blocks::CAKE());
$this->map1to1Block(Ids::CAULDRON, Blocks::CAULDRON());
$this->map1to1Block(Ids::CHAIN, Blocks::CHAIN());
$this->map1to1Block(Ids::COMPARATOR, Blocks::REDSTONE_COMPARATOR());
$this->map1to1Block(Ids::CRIMSON_DOOR, Blocks::CRIMSON_DOOR());
$this->map1to1Block(Ids::DARK_OAK_DOOR, Blocks::DARK_OAK_DOOR());