Added another handful of blocks

clearing out my workspace...
This commit is contained in:
Dylan K. Taylor
2022-07-05 20:42:22 +01:00
parent 3c017af6a0
commit a42bb9626d
7 changed files with 73 additions and 5 deletions

View File

@ -1053,6 +1053,7 @@ final class BlockObjectToBlockStateSerializer implements BlockStateSerializer{
->writeBool(StateNames::DEAD_BIT, !$block->isUnderwater())
->writeInt(StateNames::CLUSTER_COUNT, $block->getCount() - 1);
});
$this->mapSimple(Blocks::SHROOMLIGHT(), Ids::SHROOMLIGHT);
$this->mapSimple(Blocks::SHULKER_BOX(), Ids::UNDYED_SHULKER_BOX);
$this->mapSimple(Blocks::SLIME(), Ids::SLIME);
$this->map(Blocks::SMOKER(), fn(Furnace $block) => Helper::encodeFurnace($block, Ids::SMOKER, Ids::LIT_SMOKER));
@ -1078,7 +1079,16 @@ final class BlockObjectToBlockStateSerializer implements BlockStateSerializer{
return Writer::create(Ids::SOUL_FIRE)
->writeInt(StateNames::AGE, 0); //useless for soul fire, we don't track it
});
$this->map(Blocks::SOUL_LANTERN(), function(Lantern $block) : Writer{
return Writer::create(Ids::SOUL_LANTERN)
->writeBool(StateNames::HANGING, $block->isHanging());
});
$this->mapSimple(Blocks::SOUL_SAND(), Ids::SOUL_SAND);
$this->mapSimple(Blocks::SOUL_SOIL(), Ids::SOUL_SOIL);
$this->map(Blocks::SOUL_TORCH(), function(Torch $block) : Writer{
return Writer::create(Ids::SOUL_TORCH)
->writeTorchFacing($block->getFacing());
});
$this->map(Blocks::SPONGE(), function(Sponge $block) : Writer{
return Writer::create(Ids::SPONGE)
->writeString(StateNames::SPONGE_TYPE, $block->isWet() ? StringValues::SPONGE_TYPE_WET : StringValues::SPONGE_TYPE_DRY);
@ -1168,6 +1178,7 @@ final class BlockObjectToBlockStateSerializer implements BlockStateSerializer{
->writeBool(StateNames::POWERED_BIT, $block->isPowered())
->writeLegacyHorizontalFacing($block->getFacing());
});
$this->mapSimple(Blocks::TUFF(), Ids::TUFF);
$this->map(Blocks::UNDERWATER_TORCH(), function(UnderwaterTorch $block) : Writer{
return Writer::create(Ids::UNDERWATER_TORCH)
->writeTorchFacing($block->getFacing());

View File

@ -971,6 +971,7 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
->setCount($in->readBoundedInt(StateNames::CLUSTER_COUNT, 0, 3) + 1)
->setUnderwater(!$in->readBool(StateNames::DEAD_BIT));
});
$this->map(Ids::SHROOMLIGHT, fn() => Blocks::SHROOMLIGHT());
$this->map(Ids::SHULKER_BOX, function(Reader $in) : Block{
return Blocks::DYED_SHULKER_BOX()
->setColor($in->readColor());
@ -1000,7 +1001,16 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
$in->ignored(StateNames::AGE); //this is useless for soul fire, since it doesn't have the logic associated
return Blocks::SOUL_FIRE();
});
$this->map(Ids::SOUL_LANTERN, function(Reader $in) : Block{
return Blocks::SOUL_LANTERN()
->setHanging($in->readBool(StateNames::HANGING));
});
$this->map(Ids::SOUL_SAND, fn() => Blocks::SOUL_SAND());
$this->map(Ids::SOUL_SOIL, fn() => Blocks::SOUL_SOIL());
$this->map(Ids::SOUL_TORCH, function(Reader $in) : Block{
return Blocks::SOUL_TORCH()
->setFacing($in->readTorchFacing());
});
$this->map(Ids::SPONGE, function(Reader $in) : Block{
return Blocks::SPONGE()->setWet(match($type = $in->readString(StateNames::SPONGE_TYPE)){
StringValues::SPONGE_TYPE_DRY => false,
@ -1120,6 +1130,7 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
->setFacing($in->readLegacyHorizontalFacing())
->setPowered($in->readBool(StateNames::POWERED_BIT));
});
$this->map(Ids::TUFF, fn() => Blocks::TUFF());
$this->map(Ids::UNDERWATER_TORCH, function(Reader $in) : Block{
return Blocks::UNDERWATER_TORCH()
->setFacing($in->readTorchFacing());