142 return match($raw = $this->readString(
BlockStateNames::MC_BLOCK_FACE)){
143 StringValues::MC_BLOCK_FACE_DOWN => Facing::DOWN,
144 StringValues::MC_BLOCK_FACE_UP => Facing::UP,
145 StringValues::MC_BLOCK_FACE_NORTH => Facing::NORTH,
146 StringValues::MC_BLOCK_FACE_SOUTH => Facing::SOUTH,
147 StringValues::MC_BLOCK_FACE_WEST => Facing::WEST,
148 StringValues::MC_BLOCK_FACE_EAST => Facing::EAST,
149 default =>
throw $this->badValueException(BlockStateNames::MC_BLOCK_FACE, $raw)
159 $flags = $this->readBoundedInt(BlockStateNames::MULTI_FACE_DIRECTION_BITS, 0, 63);
161 BlockLegacyMetadata::MULTI_FACE_DIRECTION_FLAG_DOWN => Facing::DOWN,
162 BlockLegacyMetadata::MULTI_FACE_DIRECTION_FLAG_UP => Facing::UP,
163 BlockLegacyMetadata::MULTI_FACE_DIRECTION_FLAG_NORTH => Facing::NORTH,
164 BlockLegacyMetadata::MULTI_FACE_DIRECTION_FLAG_SOUTH => Facing::SOUTH,
165 BlockLegacyMetadata::MULTI_FACE_DIRECTION_FLAG_WEST => Facing::WEST,
166 BlockLegacyMetadata::MULTI_FACE_DIRECTION_FLAG_EAST => Facing::EAST
167 ] as $flag => $facing){
168 if(($flags & $flag) !== 0){
169 $result[$facing] = $facing;
232 return match($raw = $this->readString(
BlockStateNames::MC_CARDINAL_DIRECTION)){
233 StringValues::MC_CARDINAL_DIRECTION_NORTH => Facing::NORTH,
234 StringValues::MC_CARDINAL_DIRECTION_SOUTH => Facing::SOUTH,
235 StringValues::MC_CARDINAL_DIRECTION_WEST => Facing::WEST,
236 StringValues::MC_CARDINAL_DIRECTION_EAST => Facing::EAST,
237 default =>
throw $this->badValueException(BlockStateNames::MC_CARDINAL_DIRECTION, $raw)
275 StringValues::PILLAR_AXIS_X => Axis::X,
276 StringValues::PILLAR_AXIS_Y => Axis::Y,
277 StringValues::PILLAR_AXIS_Z => Axis::Z
278 ][$rawValue] ??
null;
280 throw $this->badValueException(BlockStateNames::PILLAR_AXIS, $rawValue,
"Invalid axis value");
287 return match($rawValue = $this->readString(
BlockStateNames::MC_VERTICAL_HALF)){
288 StringValues::MC_VERTICAL_HALF_BOTTOM => SlabType::BOTTOM,
289 StringValues::MC_VERTICAL_HALF_TOP => SlabType::TOP,
290 default =>
throw $this->badValueException(BlockStateNames::MC_VERTICAL_HALF, $rawValue,
"Invalid slab position"),
300 return match($rawValue = $this->readString(
BlockStateNames::TORCH_FACING_DIRECTION)){
301 StringValues::TORCH_FACING_DIRECTION_EAST => Facing::WEST,
302 StringValues::TORCH_FACING_DIRECTION_NORTH => Facing::SOUTH,
303 StringValues::TORCH_FACING_DIRECTION_SOUTH => Facing::NORTH,
304 StringValues::TORCH_FACING_DIRECTION_TOP => Facing::UP,
305 StringValues::TORCH_FACING_DIRECTION_UNKNOWN => Facing::UP,
306 StringValues::TORCH_FACING_DIRECTION_WEST => Facing::EAST,
307 default =>
throw $this->badValueException(BlockStateNames::TORCH_FACING_DIRECTION, $rawValue,
"Invalid torch facing"),
314 StringValues::ATTACHMENT_HANGING => BellAttachmentType::CEILING,
315 StringValues::ATTACHMENT_STANDING => BellAttachmentType::FLOOR,
316 StringValues::ATTACHMENT_SIDE => BellAttachmentType::ONE_WALL,
317 StringValues::ATTACHMENT_MULTIPLE => BellAttachmentType::TWO_WALLS,
318 default =>
throw $this->badValueException(BlockStateNames::ATTACHMENT, $type),
324 return match($type = $this->readString($name)){
328 StringValues::WALL_CONNECTION_TYPE_EAST_NONE =>
null,
329 StringValues::WALL_CONNECTION_TYPE_EAST_SHORT => WallConnectionType::SHORT,
330 StringValues::WALL_CONNECTION_TYPE_EAST_TALL => WallConnectionType::TALL,
331 default =>
throw $this->badValueException($name, $type),