mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
Implemented Light blocks
This commit is contained in:
@ -77,6 +77,7 @@ use pocketmine\block\Lava;
|
||||
use pocketmine\block\Leaves;
|
||||
use pocketmine\block\Lectern;
|
||||
use pocketmine\block\Lever;
|
||||
use pocketmine\block\Light;
|
||||
use pocketmine\block\LitPumpkin;
|
||||
use pocketmine\block\Log;
|
||||
use pocketmine\block\Loom;
|
||||
@ -791,6 +792,10 @@ final class BlockObjectToBlockStateSerializer implements BlockStateSerializer{
|
||||
default => throw new BlockStateSerializeException("Invalid Lever facing " . $block->getFacing()->name()),
|
||||
});
|
||||
});
|
||||
$this->map(Blocks::LIGHT(), function(Light $block) : Writer{
|
||||
return Writer::create(Ids::LIGHT_BLOCK)
|
||||
->writeInt(StateNames::BLOCK_LIGHT_LEVEL, $block->getLightLevel());
|
||||
});
|
||||
$this->map(Blocks::LILAC(), fn(DoublePlant $block) => Helper::encodeDoublePlant($block, StringValues::DOUBLE_PLANT_TYPE_SYRINGA, Writer::create(Ids::DOUBLE_PLANT)));
|
||||
$this->map(Blocks::LILY_OF_THE_VALLEY(), fn() => Helper::encodeRedFlower(StringValues::FLOWER_TYPE_LILY_OF_THE_VALLEY));
|
||||
$this->mapSimple(Blocks::LILY_PAD(), Ids::WATERLILY);
|
||||
|
@ -25,6 +25,7 @@ namespace pocketmine\data\bedrock\block\convert;
|
||||
|
||||
use pocketmine\block\Bamboo;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\Light;
|
||||
use pocketmine\block\Slab;
|
||||
use pocketmine\block\Stair;
|
||||
use pocketmine\block\SweetBerryBush;
|
||||
@ -640,6 +641,10 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
|
||||
default => throw $in->badValueException(StateNames::LEVER_DIRECTION, $value),
|
||||
});
|
||||
});
|
||||
$this->map(Ids::LIGHT_BLOCK, function(Reader $in) : Block{
|
||||
return Blocks::LIGHT()
|
||||
->setLightLevel($in->readBoundedInt(StateNames::BLOCK_LIGHT_LEVEL, Light::MIN_LIGHT_LEVEL, Light::MAX_LIGHT_LEVEL));
|
||||
});
|
||||
$this->map(Ids::LIGHT_BLUE_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::LIGHT_BLUE(), $in));
|
||||
$this->map(Ids::LIGHT_WEIGHTED_PRESSURE_PLATE, fn(Reader $in) => Helper::decodeWeightedPressurePlate(Blocks::WEIGHTED_PRESSURE_PLATE_LIGHT(), $in));
|
||||
$this->map(Ids::LIME_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::LIME(), $in));
|
||||
|
Reference in New Issue
Block a user