22declare(strict_types=1);
24namespace pocketmine\data\bedrock\block\convert;
49use pocketmine\block\utils\CopperOxidation;
50use pocketmine\block\utils\SlabType;
69 ->setFacing($in->readFacingDirection())
76 ->setCount($in->readBoundedInt(StateNames::CANDLES, 0, 3) + 1)
77 ->setLit($in->readBool(StateNames::LIT));
88 return $block->setAge($in->readBoundedInt(
BlockStateNames::GROWTH, 0, 7));
94 ->setFacing($in->readCardinalHorizontalFacing())
106 $block->setOxidation($oxidation);
118 $block->setOxidation($oxidation);
126 ->setOutputSignalStrength($in->readBoundedInt(
BlockStateNames::REDSTONE_SIGNAL, 0, 15));
141 ->setFacing(
Facing::rotateY($in->readCardinalHorizontalFacing(), clockwise: false))
155 ->setFacing($in->readCardinalHorizontalFacing())
163 ->setAxis(match($in->readBoundedInt(
BlockStateNames::CORAL_FAN_DIRECTION, 0, 1)){
173 ->setRotation($in->readBoundedInt(
BlockStateNames::GROUND_SIGN_DIRECTION, 0, 15));
177 $in->todo(StateNames::ITEM_FRAME_PHOTO_BIT);
186 ->setNoDecay($in->readBool(StateNames::PERSISTENT_BIT))
187 ->setCheckDecay($in->readBool(StateNames::UPDATE_BIT));
192 $fluidHeightState = $in->readBoundedInt(
BlockStateNames::LIQUID_DEPTH, 0, 15);
195 ->setFalling(($fluidHeightState & 0x8) !== 0)
200 return self::decodeLiquid($block, $in, false);
203 public static function decodeStillLiquid(Liquid $block, BlockStateReader $in) : Liquid{
204 return self::decodeLiquid($block, $in, true);
210 ->setAxis($in->readPillarAxis())
211 ->setStripped($stripped);
216 switch($type = $in->readBoundedInt(
BlockStateNames::HUGE_MUSHROOM_BITS, 0, 15)){
217 case BlockLegacyMetadata::MUSHROOM_BLOCK_ALL_STEM:
221 $type = MushroomBlockTypeIdMap::getInstance()->fromId($type);
229 ->setFacing($in->readCardinalHorizontalFacing())
230 ->setDelay($in->readBoundedInt(
BlockStateNames::REPEATER_DELAY, 0, 3) + 1);
243 return $block->setPressed($in->readBoundedInt(
BlockStateNames::REDSTONE_SIGNAL, 0, 15) !== 0);
254 return $block->setSlabType($in->readSlabPosition());
265 $in->ignored(StateNames::MC_VERTICAL_HALF);
279 ->setFacing($in->readWeirdoHorizontalFacing());
287 $facing = $in->readFacingWithoutUp();
288 return self::decodeCrops($block, $in)
289 ->setFacing($facing === Facing::DOWN ? Facing::UP : $facing);
301 ->setFacing($in->read5MinusHorizontalFacing())
320 ->setFacing($in->readHorizontalFacing());
325 ->setOutputSignalStrength($in->readBoundedInt(
BlockStateNames::REDSTONE_SIGNAL, 0, 15));
setMushroomBlockType(MushroomBlockType $mushroomBlockType)
setSlabType(SlabType $slabType)
setConnection(int $face, ?WallConnectionType $type)
static decodeRepeater(RedstoneRepeater $block, BlockStateReader $in)
static decodeCrops(Crops $block, BlockStateReader $in)
static decodeCopper(CopperMaterial $block, CopperOxidation $oxidation)
static decodeMushroomBlock(RedMushroomBlock $block, BlockStateReader $in)
static decodeDoublePlant(DoublePlant $block, BlockStateReader $in)
static decodeDoubleSlab(Slab $block, BlockStateReader $in)
static decodeWallSign(WallSign $block, BlockStateReader $in)
static decodeLiquid(Liquid $block, BlockStateReader $in, bool $still)
static decodeLeaves(Leaves $block, BlockStateReader $in)
static decodeStairs(Stair $block, BlockStateReader $in)
static decodeCandle(Candle $block, BlockStateReader $in)
static decodeWall(Wall $block, BlockStateReader $in)
static decodeTrapdoor(Trapdoor $block, BlockStateReader $in)
static decodeStem(Stem $block, BlockStateReader $in)
static decodeFenceGate(FenceGate $block, BlockStateReader $in)
static decodeFloorSign(FloorSign $block, BlockStateReader $in)
static decodeLog(Wood $block, bool $stripped, BlockStateReader $in)
static decodeSapling(Sapling $block, BlockStateReader $in)
static decodeDaylightSensor(DaylightSensor $block, BlockStateReader $in)
static decodeWaxedCopper(CopperMaterial $block, CopperOxidation $oxidation)
static decodeDoor(Door $block, BlockStateReader $in)
static decodeSingleSlab(Slab $block, BlockStateReader $in)
static decodeFloorCoralFan(FloorCoralFan $block, BlockStateReader $in)
static decodeSimplePressurePlate(SimplePressurePlate $block, BlockStateReader $in)
static decodeComparator(RedstoneComparator $block, BlockStateReader $in)
static decodeButton(Button $block, BlockStateReader $in)
readWallConnectionType(string $name)