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);
107 $block->setWaxed(
false);
118 $block->setOxidation($oxidation);
119 $block->setWaxed(
true);
126 ->setOutputSignalStrength($in->readBoundedInt(
BlockStateNames::REDSTONE_SIGNAL, 0, 15));
134 ->setFacing(
Facing::rotateY($in->readLegacyHorizontalFacing(), false))
148 ->setFacing($in->readLegacyHorizontalFacing())
156 ->setAxis(match($in->readBoundedInt(
BlockStateNames::CORAL_FAN_DIRECTION, 0, 1)){
166 ->setRotation($in->readBoundedInt(
BlockStateNames::GROUND_SIGN_DIRECTION, 0, 15));
170 $in->todo(StateNames::ITEM_FRAME_PHOTO_BIT);
179 ->setNoDecay($in->readBool(StateNames::PERSISTENT_BIT))
180 ->setCheckDecay($in->readBool(StateNames::UPDATE_BIT));
185 $fluidHeightState = $in->readBoundedInt(
BlockStateNames::LIQUID_DEPTH, 0, 15);
188 ->setFalling(($fluidHeightState & 0x8) !== 0)
193 return self::decodeLiquid($block, $in, false);
196 public static function decodeStillLiquid(Liquid $block, BlockStateReader $in) : Liquid{
197 return self::decodeLiquid($block, $in, true);
203 ->setAxis($in->readPillarAxis())
204 ->setStripped($stripped);
209 switch($type = $in->readBoundedInt(
BlockStateNames::HUGE_MUSHROOM_BITS, 0, 15)){
210 case BlockLegacyMetadata::MUSHROOM_BLOCK_ALL_STEM:
214 $type = MushroomBlockTypeIdMap::getInstance()->fromId($type);
222 ->setFacing($in->readCardinalHorizontalFacing())
223 ->setDelay($in->readBoundedInt(
BlockStateNames::REPEATER_DELAY, 0, 3) + 1);
236 return $block->setPressed($in->readBoundedInt(
BlockStateNames::REDSTONE_SIGNAL, 0, 15) !== 0);
241 return $block->setSlabType($in->readSlabPosition());
246 $in->ignored(StateNames::MC_VERTICAL_HALF);
254 ->setFacing($in->readWeirdoHorizontalFacing());
262 $facing = $in->readFacingWithoutUp();
263 return self::decodeCrops($block, $in)
264 ->setFacing($facing === Facing::DOWN ? Facing::UP : $facing);
270 ->setFacing($in->read5MinusHorizontalFacing())
289 ->setFacing($in->readHorizontalFacing());
294 ->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)