198 private array $serializers = [];
204 private array $cache = [];
206 public function __construct(){
207 $this->registerCandleSerializers();
208 $this->registerFlatColorBlockSerializers();
209 $this->registerFlatCoralSerializers();
210 $this->registerCauldronSerializers();
211 $this->registerFlatWoodBlockSerializers();
212 $this->registerLeavesSerializers();
213 $this->registerSaplingSerializers();
214 $this->registerMobHeadSerializers();
215 $this->registerSimpleSerializers();
216 $this->registerSerializers();
230 public function map(
Block $block, \Closure $serializer) : void{
231 if(isset($this->serializers[$block->getTypeId()])){
232 throw new \InvalidArgumentException(
"Block type ID " . $block->
getTypeId() .
" already has a serializer registered");
234 $this->serializers[$block->getTypeId()] = $serializer;
237 public function mapSimple(Block $block,
string $id) : void{
238 $this->map($block, fn() => Writer::create($id));
241 public function mapSlab(Slab $block,
string $singleId,
string $doubleId) : void{
242 $this->map($block, fn(Slab $block) => Helper::encodeSlab($block, $singleId, $doubleId));
245 public function mapStairs(Stair $block,
string $id) : void{
246 $this->map($block, fn(Stair $block) => Helper::encodeStairs($block, Writer::create($id)));
249 public function mapLog(Wood $block,
string $unstrippedId,
string $strippedId) : void{
250 $this->map($block, fn(Wood $block) => Helper::encodeLog($block, $unstrippedId, $strippedId));
260 $typeId = $blockState->getTypeId();
262 $locatedSerializer = $this->serializers[$typeId] ??
null;
263 if($locatedSerializer ===
null){
275 $serializer = $locatedSerializer;
278 $writer = $serializer($blockState);
279 return $writer->getBlockStateData();
282 private function registerCandleSerializers() : void{
283 $this->map(Blocks::CANDLE(), fn(Candle $block) => Helper::encodeCandle($block, new Writer(Ids::CANDLE)));
284 $this->map(Blocks::DYED_CANDLE(), fn(DyedCandle $block) => Helper::encodeCandle($block,
new Writer(match($block->getColor()){
285 DyeColor::BLACK => Ids::BLACK_CANDLE,
286 DyeColor::BLUE => Ids::BLUE_CANDLE,
287 DyeColor::BROWN => Ids::BROWN_CANDLE,
288 DyeColor::CYAN => Ids::CYAN_CANDLE,
289 DyeColor::GRAY => Ids::GRAY_CANDLE,
290 DyeColor::GREEN => Ids::GREEN_CANDLE,
291 DyeColor::LIGHT_BLUE => Ids::LIGHT_BLUE_CANDLE,
292 DyeColor::LIGHT_GRAY => Ids::LIGHT_GRAY_CANDLE,
293 DyeColor::LIME => Ids::LIME_CANDLE,
294 DyeColor::MAGENTA => Ids::MAGENTA_CANDLE,
295 DyeColor::ORANGE => Ids::ORANGE_CANDLE,
296 DyeColor::PINK => Ids::PINK_CANDLE,
297 DyeColor::PURPLE => Ids::PURPLE_CANDLE,
298 DyeColor::RED => Ids::RED_CANDLE,
299 DyeColor::WHITE => Ids::WHITE_CANDLE,
300 DyeColor::YELLOW => Ids::YELLOW_CANDLE,
302 $this->map(Blocks::CAKE_WITH_CANDLE(), fn(CakeWithCandle $block) => Writer::create(Ids::CANDLE_CAKE)
303 ->writeBool(StateNames::LIT, $block->isLit()));
304 $this->map(Blocks::CAKE_WITH_DYED_CANDLE(), fn(CakeWithDyedCandle $block) => Writer::create(match($block->getColor()){
305 DyeColor::BLACK => Ids::BLACK_CANDLE_CAKE,
306 DyeColor::BLUE => Ids::BLUE_CANDLE_CAKE,
307 DyeColor::BROWN => Ids::BROWN_CANDLE_CAKE,
308 DyeColor::CYAN => Ids::CYAN_CANDLE_CAKE,
309 DyeColor::GRAY => Ids::GRAY_CANDLE_CAKE,
310 DyeColor::GREEN => Ids::GREEN_CANDLE_CAKE,
311 DyeColor::LIGHT_BLUE => Ids::LIGHT_BLUE_CANDLE_CAKE,
312 DyeColor::LIGHT_GRAY => Ids::LIGHT_GRAY_CANDLE_CAKE,
313 DyeColor::LIME => Ids::LIME_CANDLE_CAKE,
314 DyeColor::MAGENTA => Ids::MAGENTA_CANDLE_CAKE,
315 DyeColor::ORANGE => Ids::ORANGE_CANDLE_CAKE,
316 DyeColor::PINK => Ids::PINK_CANDLE_CAKE,
317 DyeColor::PURPLE => Ids::PURPLE_CANDLE_CAKE,
318 DyeColor::RED => Ids::RED_CANDLE_CAKE,
319 DyeColor::WHITE => Ids::WHITE_CANDLE_CAKE,
320 DyeColor::YELLOW => Ids::YELLOW_CANDLE_CAKE,
321 })->writeBool(StateNames::LIT, $block->isLit()));
324 public function registerFlatColorBlockSerializers() : void{
325 $this->map(Blocks::STAINED_HARDENED_GLASS(), fn(StainedHardenedGlass $block) => Writer::create(match($block->getColor()){
326 DyeColor::BLACK => Ids::HARD_BLACK_STAINED_GLASS,
327 DyeColor::BLUE => Ids::HARD_BLUE_STAINED_GLASS,
328 DyeColor::BROWN => Ids::HARD_BROWN_STAINED_GLASS,
329 DyeColor::CYAN => Ids::HARD_CYAN_STAINED_GLASS,
330 DyeColor::GRAY => Ids::HARD_GRAY_STAINED_GLASS,
331 DyeColor::GREEN => Ids::HARD_GREEN_STAINED_GLASS,
332 DyeColor::LIGHT_BLUE => Ids::HARD_LIGHT_BLUE_STAINED_GLASS,
333 DyeColor::LIGHT_GRAY => Ids::HARD_LIGHT_GRAY_STAINED_GLASS,
334 DyeColor::LIME => Ids::HARD_LIME_STAINED_GLASS,
335 DyeColor::MAGENTA => Ids::HARD_MAGENTA_STAINED_GLASS,
336 DyeColor::ORANGE => Ids::HARD_ORANGE_STAINED_GLASS,
337 DyeColor::PINK => Ids::HARD_PINK_STAINED_GLASS,
338 DyeColor::PURPLE => Ids::HARD_PURPLE_STAINED_GLASS,
339 DyeColor::RED => Ids::HARD_RED_STAINED_GLASS,
340 DyeColor::WHITE => Ids::HARD_WHITE_STAINED_GLASS,
341 DyeColor::YELLOW => Ids::HARD_YELLOW_STAINED_GLASS,
344 $this->map(Blocks::STAINED_HARDENED_GLASS_PANE(), fn(StainedHardenedGlassPane $block) => Writer::create(match($block->getColor()){
345 DyeColor::BLACK => Ids::HARD_BLACK_STAINED_GLASS_PANE,
346 DyeColor::BLUE => Ids::HARD_BLUE_STAINED_GLASS_PANE,
347 DyeColor::BROWN => Ids::HARD_BROWN_STAINED_GLASS_PANE,
348 DyeColor::CYAN => Ids::HARD_CYAN_STAINED_GLASS_PANE,
349 DyeColor::GRAY => Ids::HARD_GRAY_STAINED_GLASS_PANE,
350 DyeColor::GREEN => Ids::HARD_GREEN_STAINED_GLASS_PANE,
351 DyeColor::LIGHT_BLUE => Ids::HARD_LIGHT_BLUE_STAINED_GLASS_PANE,
352 DyeColor::LIGHT_GRAY => Ids::HARD_LIGHT_GRAY_STAINED_GLASS_PANE,
353 DyeColor::LIME => Ids::HARD_LIME_STAINED_GLASS_PANE,
354 DyeColor::MAGENTA => Ids::HARD_MAGENTA_STAINED_GLASS_PANE,
355 DyeColor::ORANGE => Ids::HARD_ORANGE_STAINED_GLASS_PANE,
356 DyeColor::PINK => Ids::HARD_PINK_STAINED_GLASS_PANE,
357 DyeColor::PURPLE => Ids::HARD_PURPLE_STAINED_GLASS_PANE,
358 DyeColor::RED => Ids::HARD_RED_STAINED_GLASS_PANE,
359 DyeColor::WHITE => Ids::HARD_WHITE_STAINED_GLASS_PANE,
360 DyeColor::YELLOW => Ids::HARD_YELLOW_STAINED_GLASS_PANE,
363 $this->map(Blocks::GLAZED_TERRACOTTA(),
function(GlazedTerracotta $block) : Writer{
364 return Writer::create(match($block->getColor()){
365 DyeColor::BLACK => Ids::BLACK_GLAZED_TERRACOTTA,
366 DyeColor::BLUE => Ids::BLUE_GLAZED_TERRACOTTA,
367 DyeColor::BROWN => Ids::BROWN_GLAZED_TERRACOTTA,
368 DyeColor::CYAN => Ids::CYAN_GLAZED_TERRACOTTA,
369 DyeColor::GRAY => Ids::GRAY_GLAZED_TERRACOTTA,
370 DyeColor::GREEN => Ids::GREEN_GLAZED_TERRACOTTA,
371 DyeColor::LIGHT_BLUE => Ids::LIGHT_BLUE_GLAZED_TERRACOTTA,
372 DyeColor::LIGHT_GRAY => Ids::SILVER_GLAZED_TERRACOTTA,
373 DyeColor::LIME => Ids::LIME_GLAZED_TERRACOTTA,
374 DyeColor::MAGENTA => Ids::MAGENTA_GLAZED_TERRACOTTA,
375 DyeColor::ORANGE => Ids::ORANGE_GLAZED_TERRACOTTA,
376 DyeColor::PINK => Ids::PINK_GLAZED_TERRACOTTA,
377 DyeColor::PURPLE => Ids::PURPLE_GLAZED_TERRACOTTA,
378 DyeColor::RED => Ids::RED_GLAZED_TERRACOTTA,
379 DyeColor::WHITE => Ids::WHITE_GLAZED_TERRACOTTA,
380 DyeColor::YELLOW => Ids::YELLOW_GLAZED_TERRACOTTA,
382 ->writeHorizontalFacing($block->getFacing());
385 $this->map(Blocks::WOOL(), fn(Wool $block) => Writer::create(match($block->getColor()){
386 DyeColor::BLACK => Ids::BLACK_WOOL,
387 DyeColor::BLUE => Ids::BLUE_WOOL,
388 DyeColor::BROWN => Ids::BROWN_WOOL,
389 DyeColor::CYAN => Ids::CYAN_WOOL,
390 DyeColor::GRAY => Ids::GRAY_WOOL,
391 DyeColor::GREEN => Ids::GREEN_WOOL,
392 DyeColor::LIGHT_BLUE => Ids::LIGHT_BLUE_WOOL,
393 DyeColor::LIGHT_GRAY => Ids::LIGHT_GRAY_WOOL,
394 DyeColor::LIME => Ids::LIME_WOOL,
395 DyeColor::MAGENTA => Ids::MAGENTA_WOOL,
396 DyeColor::ORANGE => Ids::ORANGE_WOOL,
397 DyeColor::PINK => Ids::PINK_WOOL,
398 DyeColor::PURPLE => Ids::PURPLE_WOOL,
399 DyeColor::RED => Ids::RED_WOOL,
400 DyeColor::WHITE => Ids::WHITE_WOOL,
401 DyeColor::YELLOW => Ids::YELLOW_WOOL,
404 $this->map(Blocks::CARPET(), fn(Carpet $block) => Writer::create(match($block->getColor()){
405 DyeColor::BLACK => Ids::BLACK_CARPET,
406 DyeColor::BLUE => Ids::BLUE_CARPET,
407 DyeColor::BROWN => Ids::BROWN_CARPET,
408 DyeColor::CYAN => Ids::CYAN_CARPET,
409 DyeColor::GRAY => Ids::GRAY_CARPET,
410 DyeColor::GREEN => Ids::GREEN_CARPET,
411 DyeColor::LIGHT_BLUE => Ids::LIGHT_BLUE_CARPET,
412 DyeColor::LIGHT_GRAY => Ids::LIGHT_GRAY_CARPET,
413 DyeColor::LIME => Ids::LIME_CARPET,
414 DyeColor::MAGENTA => Ids::MAGENTA_CARPET,
415 DyeColor::ORANGE => Ids::ORANGE_CARPET,
416 DyeColor::PINK => Ids::PINK_CARPET,
417 DyeColor::PURPLE => Ids::PURPLE_CARPET,
418 DyeColor::RED => Ids::RED_CARPET,
419 DyeColor::WHITE => Ids::WHITE_CARPET,
420 DyeColor::YELLOW => Ids::YELLOW_CARPET,
423 $this->map(Blocks::DYED_SHULKER_BOX(), fn(DyedShulkerBox $block) => Writer::create(match($block->getColor()){
424 DyeColor::BLACK => Ids::BLACK_SHULKER_BOX,
425 DyeColor::BLUE => Ids::BLUE_SHULKER_BOX,
426 DyeColor::BROWN => Ids::BROWN_SHULKER_BOX,
427 DyeColor::CYAN => Ids::CYAN_SHULKER_BOX,
428 DyeColor::GRAY => Ids::GRAY_SHULKER_BOX,
429 DyeColor::GREEN => Ids::GREEN_SHULKER_BOX,
430 DyeColor::LIGHT_BLUE => Ids::LIGHT_BLUE_SHULKER_BOX,
431 DyeColor::LIGHT_GRAY => Ids::LIGHT_GRAY_SHULKER_BOX,
432 DyeColor::LIME => Ids::LIME_SHULKER_BOX,
433 DyeColor::MAGENTA => Ids::MAGENTA_SHULKER_BOX,
434 DyeColor::ORANGE => Ids::ORANGE_SHULKER_BOX,
435 DyeColor::PINK => Ids::PINK_SHULKER_BOX,
436 DyeColor::PURPLE => Ids::PURPLE_SHULKER_BOX,
437 DyeColor::RED => Ids::RED_SHULKER_BOX,
438 DyeColor::WHITE => Ids::WHITE_SHULKER_BOX,
439 DyeColor::YELLOW => Ids::YELLOW_SHULKER_BOX,
442 $this->map(Blocks::CONCRETE(), fn(Concrete $block) => Writer::create(match($block->getColor()){
443 DyeColor::BLACK => Ids::BLACK_CONCRETE,
444 DyeColor::BLUE => Ids::BLUE_CONCRETE,
445 DyeColor::BROWN => Ids::BROWN_CONCRETE,
446 DyeColor::CYAN => Ids::CYAN_CONCRETE,
447 DyeColor::GRAY => Ids::GRAY_CONCRETE,
448 DyeColor::GREEN => Ids::GREEN_CONCRETE,
449 DyeColor::LIGHT_BLUE => Ids::LIGHT_BLUE_CONCRETE,
450 DyeColor::LIGHT_GRAY => Ids::LIGHT_GRAY_CONCRETE,
451 DyeColor::LIME => Ids::LIME_CONCRETE,
452 DyeColor::MAGENTA => Ids::MAGENTA_CONCRETE,
453 DyeColor::ORANGE => Ids::ORANGE_CONCRETE,
454 DyeColor::PINK => Ids::PINK_CONCRETE,
455 DyeColor::PURPLE => Ids::PURPLE_CONCRETE,
456 DyeColor::RED => Ids::RED_CONCRETE,
457 DyeColor::WHITE => Ids::WHITE_CONCRETE,
458 DyeColor::YELLOW => Ids::YELLOW_CONCRETE,
461 $this->map(Blocks::CONCRETE_POWDER(), fn(ConcretePowder $block) => Writer::create(match($block->getColor()){
462 DyeColor::BLACK => Ids::BLACK_CONCRETE_POWDER,
463 DyeColor::BLUE => Ids::BLUE_CONCRETE_POWDER,
464 DyeColor::BROWN => Ids::BROWN_CONCRETE_POWDER,
465 DyeColor::CYAN => Ids::CYAN_CONCRETE_POWDER,
466 DyeColor::GRAY => Ids::GRAY_CONCRETE_POWDER,
467 DyeColor::GREEN => Ids::GREEN_CONCRETE_POWDER,
468 DyeColor::LIGHT_BLUE => Ids::LIGHT_BLUE_CONCRETE_POWDER,
469 DyeColor::LIGHT_GRAY => Ids::LIGHT_GRAY_CONCRETE_POWDER,
470 DyeColor::LIME => Ids::LIME_CONCRETE_POWDER,
471 DyeColor::MAGENTA => Ids::MAGENTA_CONCRETE_POWDER,
472 DyeColor::ORANGE => Ids::ORANGE_CONCRETE_POWDER,
473 DyeColor::PINK => Ids::PINK_CONCRETE_POWDER,
474 DyeColor::PURPLE => Ids::PURPLE_CONCRETE_POWDER,
475 DyeColor::RED => Ids::RED_CONCRETE_POWDER,
476 DyeColor::WHITE => Ids::WHITE_CONCRETE_POWDER,
477 DyeColor::YELLOW => Ids::YELLOW_CONCRETE_POWDER,
480 $this->map(Blocks::STAINED_CLAY(), fn(StainedHardenedClay $block) => Writer::create(match($block->getColor()){
481 DyeColor::BLACK => Ids::BLACK_TERRACOTTA,
482 DyeColor::BLUE => Ids::BLUE_TERRACOTTA,
483 DyeColor::BROWN => Ids::BROWN_TERRACOTTA,
484 DyeColor::CYAN => Ids::CYAN_TERRACOTTA,
485 DyeColor::GRAY => Ids::GRAY_TERRACOTTA,
486 DyeColor::GREEN => Ids::GREEN_TERRACOTTA,
487 DyeColor::LIGHT_BLUE => Ids::LIGHT_BLUE_TERRACOTTA,
488 DyeColor::LIGHT_GRAY => Ids::LIGHT_GRAY_TERRACOTTA,
489 DyeColor::LIME => Ids::LIME_TERRACOTTA,
490 DyeColor::MAGENTA => Ids::MAGENTA_TERRACOTTA,
491 DyeColor::ORANGE => Ids::ORANGE_TERRACOTTA,
492 DyeColor::PINK => Ids::PINK_TERRACOTTA,
493 DyeColor::PURPLE => Ids::PURPLE_TERRACOTTA,
494 DyeColor::RED => Ids::RED_TERRACOTTA,
495 DyeColor::WHITE => Ids::WHITE_TERRACOTTA,
496 DyeColor::YELLOW => Ids::YELLOW_TERRACOTTA,
499 $this->map(Blocks::STAINED_GLASS(), fn(StainedGlass $block) => Writer::create(match($block->getColor()){
500 DyeColor::BLACK => Ids::BLACK_STAINED_GLASS,
501 DyeColor::BLUE => Ids::BLUE_STAINED_GLASS,
502 DyeColor::BROWN => Ids::BROWN_STAINED_GLASS,
503 DyeColor::CYAN => Ids::CYAN_STAINED_GLASS,
504 DyeColor::GRAY => Ids::GRAY_STAINED_GLASS,
505 DyeColor::GREEN => Ids::GREEN_STAINED_GLASS,
506 DyeColor::LIGHT_BLUE => Ids::LIGHT_BLUE_STAINED_GLASS,
507 DyeColor::LIGHT_GRAY => Ids::LIGHT_GRAY_STAINED_GLASS,
508 DyeColor::LIME => Ids::LIME_STAINED_GLASS,
509 DyeColor::MAGENTA => Ids::MAGENTA_STAINED_GLASS,
510 DyeColor::ORANGE => Ids::ORANGE_STAINED_GLASS,
511 DyeColor::PINK => Ids::PINK_STAINED_GLASS,
512 DyeColor::PURPLE => Ids::PURPLE_STAINED_GLASS,
513 DyeColor::RED => Ids::RED_STAINED_GLASS,
514 DyeColor::WHITE => Ids::WHITE_STAINED_GLASS,
515 DyeColor::YELLOW => Ids::YELLOW_STAINED_GLASS,
518 $this->map(Blocks::STAINED_GLASS_PANE(), fn(StainedGlassPane $block) => Writer::create(match($block->getColor()){
519 DyeColor::BLACK => Ids::BLACK_STAINED_GLASS_PANE,
520 DyeColor::BLUE => Ids::BLUE_STAINED_GLASS_PANE,
521 DyeColor::BROWN => Ids::BROWN_STAINED_GLASS_PANE,
522 DyeColor::CYAN => Ids::CYAN_STAINED_GLASS_PANE,
523 DyeColor::GRAY => Ids::GRAY_STAINED_GLASS_PANE,
524 DyeColor::GREEN => Ids::GREEN_STAINED_GLASS_PANE,
525 DyeColor::LIGHT_BLUE => Ids::LIGHT_BLUE_STAINED_GLASS_PANE,
526 DyeColor::LIGHT_GRAY => Ids::LIGHT_GRAY_STAINED_GLASS_PANE,
527 DyeColor::LIME => Ids::LIME_STAINED_GLASS_PANE,
528 DyeColor::MAGENTA => Ids::MAGENTA_STAINED_GLASS_PANE,
529 DyeColor::ORANGE => Ids::ORANGE_STAINED_GLASS_PANE,
530 DyeColor::PINK => Ids::PINK_STAINED_GLASS_PANE,
531 DyeColor::PURPLE => Ids::PURPLE_STAINED_GLASS_PANE,
532 DyeColor::RED => Ids::RED_STAINED_GLASS_PANE,
533 DyeColor::WHITE => Ids::WHITE_STAINED_GLASS_PANE,
534 DyeColor::YELLOW => Ids::YELLOW_STAINED_GLASS_PANE,
538 private function registerFlatCoralSerializers() : void{
539 $this->map(Blocks::CORAL(), fn(Coral $block) => Writer::create(
540 match($block->getCoralType()){
541 CoralType::BRAIN => $block->isDead() ? Ids::DEAD_BRAIN_CORAL : Ids::BRAIN_CORAL,
542 CoralType::BUBBLE => $block->isDead() ? Ids::DEAD_BUBBLE_CORAL : Ids::BUBBLE_CORAL,
543 CoralType::FIRE => $block->isDead() ? Ids::DEAD_FIRE_CORAL : Ids::FIRE_CORAL,
544 CoralType::HORN => $block->isDead() ? Ids::DEAD_HORN_CORAL : Ids::HORN_CORAL,
545 CoralType::TUBE => $block->isDead() ? Ids::DEAD_TUBE_CORAL : Ids::TUBE_CORAL,
549 $this->map(Blocks::CORAL_FAN(), fn(FloorCoralFan $block) => Writer::create(
550 match($block->getCoralType()){
551 CoralType::BRAIN => $block->isDead() ? Ids::DEAD_BRAIN_CORAL_FAN : Ids::BRAIN_CORAL_FAN,
552 CoralType::BUBBLE => $block->isDead() ? Ids::DEAD_BUBBLE_CORAL_FAN : Ids::BUBBLE_CORAL_FAN,
553 CoralType::FIRE => $block->isDead() ? Ids::DEAD_FIRE_CORAL_FAN : Ids::FIRE_CORAL_FAN,
554 CoralType::HORN => $block->isDead() ? Ids::DEAD_HORN_CORAL_FAN : Ids::HORN_CORAL_FAN,
555 CoralType::TUBE => $block->isDead() ? Ids::DEAD_TUBE_CORAL_FAN : Ids::TUBE_CORAL_FAN,
557 ->writeInt(StateNames::CORAL_FAN_DIRECTION, match($axis = $block->getAxis()){
560 default => throw new BlockStateSerializeException(
"Invalid axis {$axis}"),
563 $this->map(Blocks::CORAL_BLOCK(), fn(CoralBlock $block) => Writer::create(
564 match($block->getCoralType()){
565 CoralType::BRAIN => $block->isDead() ? Ids::DEAD_BRAIN_CORAL_BLOCK : Ids::BRAIN_CORAL_BLOCK,
566 CoralType::BUBBLE => $block->isDead() ? Ids::DEAD_BUBBLE_CORAL_BLOCK : Ids::BUBBLE_CORAL_BLOCK,
567 CoralType::FIRE => $block->isDead() ? Ids::DEAD_FIRE_CORAL_BLOCK : Ids::FIRE_CORAL_BLOCK,
568 CoralType::HORN => $block->isDead() ? Ids::DEAD_HORN_CORAL_BLOCK : Ids::HORN_CORAL_BLOCK,
569 CoralType::TUBE => $block->isDead() ? Ids::DEAD_TUBE_CORAL_BLOCK : Ids::TUBE_CORAL_BLOCK,
573 $this->map(Blocks::WALL_CORAL_FAN(), fn(WallCoralFan $block) => Writer::create(
574 match($block->getCoralType()){
575 CoralType::TUBE => $block->isDead() ? Ids::DEAD_TUBE_CORAL_WALL_FAN : Ids::TUBE_CORAL_WALL_FAN,
576 CoralType::BRAIN => $block->isDead() ? Ids::DEAD_BRAIN_CORAL_WALL_FAN : Ids::BRAIN_CORAL_WALL_FAN,
577 CoralType::BUBBLE => $block->isDead() ? Ids::DEAD_BUBBLE_CORAL_WALL_FAN : Ids::BUBBLE_CORAL_WALL_FAN,
578 CoralType::FIRE => $block->isDead() ? Ids::DEAD_FIRE_CORAL_WALL_FAN : Ids::FIRE_CORAL_WALL_FAN,
579 CoralType::HORN => $block->isDead() ? Ids::DEAD_HORN_CORAL_WALL_FAN : Ids::HORN_CORAL_WALL_FAN,
581 ->writeCoralFacing($block->getFacing())
585 private function registerCauldronSerializers() : void{
586 $this->map(Blocks::CAULDRON(), fn() => Helper::encodeCauldron(StringValues::CAULDRON_LIQUID_WATER, 0));
587 $this->map(Blocks::LAVA_CAULDRON(), fn(FillableCauldron $b) => Helper::encodeCauldron(StringValues::CAULDRON_LIQUID_LAVA, $b->getFillLevel()));
589 $this->map(Blocks::POTION_CAULDRON(), fn(FillableCauldron $b) => Helper::encodeCauldron(StringValues::CAULDRON_LIQUID_WATER, $b->getFillLevel()));
590 $this->map(Blocks::WATER_CAULDRON(), fn(FillableCauldron $b) => Helper::encodeCauldron(StringValues::CAULDRON_LIQUID_WATER, $b->getFillLevel()));
593 private function registerFlatWoodBlockSerializers() : void{
594 $this->map(Blocks::ACACIA_BUTTON(), fn(WoodenButton $block) => Helper::encodeButton($block, new Writer(Ids::ACACIA_BUTTON)));
595 $this->map(Blocks::ACACIA_DOOR(), fn(WoodenDoor $block) => Helper::encodeDoor($block,
new Writer(Ids::ACACIA_DOOR)));
596 $this->map(Blocks::ACACIA_FENCE_GATE(), fn(FenceGate $block) => Helper::encodeFenceGate($block,
new Writer(Ids::ACACIA_FENCE_GATE)));
597 $this->map(Blocks::ACACIA_PRESSURE_PLATE(), fn(WoodenPressurePlate $block) => Helper::encodeSimplePressurePlate($block,
new Writer(Ids::ACACIA_PRESSURE_PLATE)));
598 $this->map(Blocks::ACACIA_SIGN(), fn(FloorSign $block) => Helper::encodeFloorSign($block,
new Writer(Ids::ACACIA_STANDING_SIGN)));
599 $this->map(Blocks::ACACIA_STAIRS(), fn(WoodenStairs $block) => Helper::encodeStairs($block,
new Writer(Ids::ACACIA_STAIRS)));
600 $this->map(Blocks::ACACIA_TRAPDOOR(), fn(WoodenTrapdoor $block) => Helper::encodeTrapdoor($block,
new Writer(Ids::ACACIA_TRAPDOOR)));
601 $this->map(Blocks::ACACIA_WALL_SIGN(), fn(WallSign $block) => Helper::encodeWallSign($block,
new Writer(Ids::ACACIA_WALL_SIGN)));
602 $this->mapLog(Blocks::ACACIA_LOG(), Ids::ACACIA_LOG, Ids::STRIPPED_ACACIA_LOG);
603 $this->mapLog(Blocks::ACACIA_WOOD(), Ids::ACACIA_WOOD, Ids::STRIPPED_ACACIA_WOOD);
604 $this->mapSimple(Blocks::ACACIA_FENCE(), Ids::ACACIA_FENCE);
605 $this->mapSimple(Blocks::ACACIA_PLANKS(), Ids::ACACIA_PLANKS);
606 $this->mapSlab(Blocks::ACACIA_SLAB(), Ids::ACACIA_SLAB, Ids::ACACIA_DOUBLE_SLAB);
608 $this->map(Blocks::BIRCH_BUTTON(), fn(WoodenButton $block) => Helper::encodeButton($block,
new Writer(Ids::BIRCH_BUTTON)));
609 $this->map(Blocks::BIRCH_DOOR(), fn(WoodenDoor $block) => Helper::encodeDoor($block,
new Writer(Ids::BIRCH_DOOR)));
610 $this->map(Blocks::BIRCH_FENCE_GATE(), fn(FenceGate $block) => Helper::encodeFenceGate($block,
new Writer(Ids::BIRCH_FENCE_GATE)));
611 $this->map(Blocks::BIRCH_PRESSURE_PLATE(), fn(WoodenPressurePlate $block) => Helper::encodeSimplePressurePlate($block,
new Writer(Ids::BIRCH_PRESSURE_PLATE)));
612 $this->map(Blocks::BIRCH_SIGN(), fn(FloorSign $block) => Helper::encodeFloorSign($block,
new Writer(Ids::BIRCH_STANDING_SIGN)));
613 $this->map(Blocks::BIRCH_TRAPDOOR(), fn(WoodenTrapdoor $block) => Helper::encodeTrapdoor($block,
new Writer(Ids::BIRCH_TRAPDOOR)));
614 $this->map(Blocks::BIRCH_WALL_SIGN(), fn(WallSign $block) => Helper::encodeWallSign($block,
new Writer(Ids::BIRCH_WALL_SIGN)));
615 $this->mapLog(Blocks::BIRCH_LOG(), Ids::BIRCH_LOG, Ids::STRIPPED_BIRCH_LOG);
616 $this->mapLog(Blocks::BIRCH_WOOD(), Ids::BIRCH_WOOD, Ids::STRIPPED_BIRCH_WOOD);
617 $this->mapSimple(Blocks::BIRCH_FENCE(), Ids::BIRCH_FENCE);
618 $this->mapSimple(Blocks::BIRCH_PLANKS(), Ids::BIRCH_PLANKS);
619 $this->mapSlab(Blocks::BIRCH_SLAB(), Ids::BIRCH_SLAB, Ids::BIRCH_DOUBLE_SLAB);
620 $this->mapStairs(Blocks::BIRCH_STAIRS(), Ids::BIRCH_STAIRS);
622 $this->map(Blocks::CHERRY_BUTTON(), fn(Button $block) => Helper::encodeButton($block,
new Writer(Ids::CHERRY_BUTTON)));
623 $this->map(Blocks::CHERRY_DOOR(), fn(Door $block) => Helper::encodeDoor($block,
new Writer(Ids::CHERRY_DOOR)));
624 $this->map(Blocks::CHERRY_FENCE_GATE(), fn(FenceGate $block) => Helper::encodeFenceGate($block,
new Writer(Ids::CHERRY_FENCE_GATE)));
625 $this->map(Blocks::CHERRY_LOG(), fn(Wood $block) => Helper::encodeLog($block, Ids::CHERRY_LOG, Ids::STRIPPED_CHERRY_LOG));
626 $this->map(Blocks::CHERRY_PRESSURE_PLATE(), fn(SimplePressurePlate $block) => Helper::encodeSimplePressurePlate($block,
new Writer(Ids::CHERRY_PRESSURE_PLATE)));
627 $this->map(Blocks::CHERRY_SIGN(), fn(FloorSign $block) => Helper::encodeFloorSign($block,
new Writer(Ids::CHERRY_STANDING_SIGN)));
628 $this->map(Blocks::CHERRY_TRAPDOOR(), fn(Trapdoor $block) => Helper::encodeTrapdoor($block,
new Writer(Ids::CHERRY_TRAPDOOR)));
629 $this->map(Blocks::CHERRY_WALL_SIGN(), fn(WallSign $block) => Helper::encodeWallSign($block,
new Writer(Ids::CHERRY_WALL_SIGN)));
630 $this->mapSimple(Blocks::CHERRY_FENCE(), Ids::CHERRY_FENCE);
631 $this->mapSimple(Blocks::CHERRY_PLANKS(), Ids::CHERRY_PLANKS);
632 $this->mapSlab(Blocks::CHERRY_SLAB(), Ids::CHERRY_SLAB, Ids::CHERRY_DOUBLE_SLAB);
633 $this->mapStairs(Blocks::CHERRY_STAIRS(), Ids::CHERRY_STAIRS);
634 $this->mapLog(Blocks::CHERRY_WOOD(), Ids::CHERRY_WOOD, Ids::STRIPPED_CHERRY_WOOD);
636 $this->map(Blocks::CRIMSON_BUTTON(), fn(Button $block) => Helper::encodeButton($block,
new Writer(Ids::CRIMSON_BUTTON)));
637 $this->map(Blocks::CRIMSON_DOOR(), fn(Door $block) => Helper::encodeDoor($block,
new Writer(Ids::CRIMSON_DOOR)));
638 $this->map(Blocks::CRIMSON_FENCE_GATE(), fn(FenceGate $block) => Helper::encodeFenceGate($block,
new Writer(Ids::CRIMSON_FENCE_GATE)));
639 $this->map(Blocks::CRIMSON_HYPHAE(), fn(Wood $block) => Helper::encodeLog($block, Ids::CRIMSON_HYPHAE, Ids::STRIPPED_CRIMSON_HYPHAE));
640 $this->map(Blocks::CRIMSON_PRESSURE_PLATE(), fn(SimplePressurePlate $block) => Helper::encodeSimplePressurePlate($block,
new Writer(Ids::CRIMSON_PRESSURE_PLATE)));
641 $this->map(Blocks::CRIMSON_SIGN(), fn(FloorSign $block) => Helper::encodeFloorSign($block,
new Writer(Ids::CRIMSON_STANDING_SIGN)));
642 $this->map(Blocks::CRIMSON_STEM(), fn(Wood $block) => Helper::encodeLog($block, Ids::CRIMSON_STEM, Ids::STRIPPED_CRIMSON_STEM));
643 $this->map(Blocks::CRIMSON_TRAPDOOR(), fn(Trapdoor $block) => Helper::encodeTrapdoor($block,
new Writer(Ids::CRIMSON_TRAPDOOR)));
644 $this->map(Blocks::CRIMSON_WALL_SIGN(), fn(WallSign $block) => Helper::encodeWallSign($block,
new Writer(Ids::CRIMSON_WALL_SIGN)));
645 $this->mapSimple(Blocks::CRIMSON_FENCE(), Ids::CRIMSON_FENCE);
646 $this->mapSimple(Blocks::CRIMSON_PLANKS(), Ids::CRIMSON_PLANKS);
647 $this->mapSlab(Blocks::CRIMSON_SLAB(), Ids::CRIMSON_SLAB, Ids::CRIMSON_DOUBLE_SLAB);
648 $this->mapStairs(Blocks::CRIMSON_STAIRS(), Ids::CRIMSON_STAIRS);
650 $this->map(Blocks::DARK_OAK_BUTTON(), fn(WoodenButton $block) => Helper::encodeButton($block,
new Writer(Ids::DARK_OAK_BUTTON)));
651 $this->map(Blocks::DARK_OAK_DOOR(), fn(WoodenDoor $block) => Helper::encodeDoor($block,
new Writer(Ids::DARK_OAK_DOOR)));
652 $this->map(Blocks::DARK_OAK_FENCE_GATE(), fn(FenceGate $block) => Helper::encodeFenceGate($block,
new Writer(Ids::DARK_OAK_FENCE_GATE)));
653 $this->map(Blocks::DARK_OAK_PRESSURE_PLATE(), fn(WoodenPressurePlate $block) => Helper::encodeSimplePressurePlate($block,
new Writer(Ids::DARK_OAK_PRESSURE_PLATE)));
654 $this->map(Blocks::DARK_OAK_SIGN(), fn(FloorSign $block) => Helper::encodeFloorSign($block,
new Writer(Ids::DARKOAK_STANDING_SIGN)));
655 $this->map(Blocks::DARK_OAK_TRAPDOOR(), fn(WoodenTrapdoor $block) => Helper::encodeTrapdoor($block,
new Writer(Ids::DARK_OAK_TRAPDOOR)));
656 $this->map(Blocks::DARK_OAK_WALL_SIGN(), fn(WallSign $block) => Helper::encodeWallSign($block,
new Writer(Ids::DARKOAK_WALL_SIGN)));
657 $this->mapLog(Blocks::DARK_OAK_LOG(), Ids::DARK_OAK_LOG, Ids::STRIPPED_DARK_OAK_LOG);
658 $this->mapLog(Blocks::DARK_OAK_WOOD(), Ids::DARK_OAK_WOOD, Ids::STRIPPED_DARK_OAK_WOOD);
659 $this->mapSimple(Blocks::DARK_OAK_FENCE(), Ids::DARK_OAK_FENCE);
660 $this->mapSimple(Blocks::DARK_OAK_PLANKS(), Ids::DARK_OAK_PLANKS);
661 $this->mapSlab(Blocks::DARK_OAK_SLAB(), Ids::DARK_OAK_SLAB, Ids::DARK_OAK_DOUBLE_SLAB);
662 $this->mapStairs(Blocks::DARK_OAK_STAIRS(), Ids::DARK_OAK_STAIRS);
664 $this->map(Blocks::JUNGLE_BUTTON(), fn(WoodenButton $block) => Helper::encodeButton($block,
new Writer(Ids::JUNGLE_BUTTON)));
665 $this->map(Blocks::JUNGLE_DOOR(), fn(WoodenDoor $block) => Helper::encodeDoor($block,
new Writer(Ids::JUNGLE_DOOR)));
666 $this->map(Blocks::JUNGLE_FENCE_GATE(), fn(FenceGate $block) => Helper::encodeFenceGate($block,
new Writer(Ids::JUNGLE_FENCE_GATE)));
667 $this->map(Blocks::JUNGLE_PRESSURE_PLATE(), fn(WoodenPressurePlate $block) => Helper::encodeSimplePressurePlate($block,
new Writer(Ids::JUNGLE_PRESSURE_PLATE)));
668 $this->map(Blocks::JUNGLE_SIGN(), fn(FloorSign $block) => Helper::encodeFloorSign($block,
new Writer(Ids::JUNGLE_STANDING_SIGN)));
669 $this->map(Blocks::JUNGLE_TRAPDOOR(), fn(WoodenTrapdoor $block) => Helper::encodeTrapdoor($block,
new Writer(Ids::JUNGLE_TRAPDOOR)));
670 $this->map(Blocks::JUNGLE_WALL_SIGN(), fn(WallSign $block) => Helper::encodeWallSign($block,
new Writer(Ids::JUNGLE_WALL_SIGN)));
671 $this->mapLog(Blocks::JUNGLE_LOG(), Ids::JUNGLE_LOG, Ids::STRIPPED_JUNGLE_LOG);
672 $this->mapLog(Blocks::JUNGLE_WOOD(), Ids::JUNGLE_WOOD, Ids::STRIPPED_JUNGLE_WOOD);
673 $this->mapSimple(Blocks::JUNGLE_FENCE(), Ids::JUNGLE_FENCE);
674 $this->mapSimple(Blocks::JUNGLE_PLANKS(), Ids::JUNGLE_PLANKS);
675 $this->mapSlab(Blocks::JUNGLE_SLAB(), Ids::JUNGLE_SLAB, Ids::JUNGLE_DOUBLE_SLAB);
676 $this->mapStairs(Blocks::JUNGLE_STAIRS(), Ids::JUNGLE_STAIRS);
678 $this->map(Blocks::MANGROVE_BUTTON(), fn(Button $block) => Helper::encodeButton($block,
new Writer(Ids::MANGROVE_BUTTON)));
679 $this->map(Blocks::MANGROVE_DOOR(), fn(Door $block) => Helper::encodeDoor($block,
new Writer(Ids::MANGROVE_DOOR)));
680 $this->map(Blocks::MANGROVE_FENCE_GATE(), fn(FenceGate $block) => Helper::encodeFenceGate($block,
new Writer(Ids::MANGROVE_FENCE_GATE)));
681 $this->map(Blocks::MANGROVE_LOG(), fn(Wood $block) => Helper::encodeLog($block, Ids::MANGROVE_LOG, Ids::STRIPPED_MANGROVE_LOG));
682 $this->map(Blocks::MANGROVE_PRESSURE_PLATE(), fn(SimplePressurePlate $block) => Helper::encodeSimplePressurePlate($block,
new Writer(Ids::MANGROVE_PRESSURE_PLATE)));
683 $this->map(Blocks::MANGROVE_SIGN(), fn(FloorSign $block) => Helper::encodeFloorSign($block,
new Writer(Ids::MANGROVE_STANDING_SIGN)));
684 $this->map(Blocks::MANGROVE_TRAPDOOR(), fn(Trapdoor $block) => Helper::encodeTrapdoor($block,
new Writer(Ids::MANGROVE_TRAPDOOR)));
685 $this->map(Blocks::MANGROVE_WALL_SIGN(), fn(WallSign $block) => Helper::encodeWallSign($block,
new Writer(Ids::MANGROVE_WALL_SIGN)));
686 $this->mapSimple(Blocks::MANGROVE_FENCE(), Ids::MANGROVE_FENCE);
687 $this->mapSimple(Blocks::MANGROVE_PLANKS(), Ids::MANGROVE_PLANKS);
688 $this->mapSlab(Blocks::MANGROVE_SLAB(), Ids::MANGROVE_SLAB, Ids::MANGROVE_DOUBLE_SLAB);
689 $this->mapStairs(Blocks::MANGROVE_STAIRS(), Ids::MANGROVE_STAIRS);
690 $this->mapLog(Blocks::MANGROVE_WOOD(), Ids::MANGROVE_WOOD, Ids::STRIPPED_MANGROVE_WOOD);
692 $this->map(Blocks::OAK_BUTTON(), fn(WoodenButton $block) => Helper::encodeButton($block,
new Writer(Ids::WOODEN_BUTTON)));
693 $this->map(Blocks::OAK_DOOR(), fn(WoodenDoor $block) => Helper::encodeDoor($block,
new Writer(Ids::WOODEN_DOOR)));
694 $this->map(Blocks::OAK_FENCE_GATE(), fn(FenceGate $block) => Helper::encodeFenceGate($block,
new Writer(Ids::FENCE_GATE)));
695 $this->map(Blocks::OAK_PRESSURE_PLATE(), fn(WoodenPressurePlate $block) => Helper::encodeSimplePressurePlate($block,
new Writer(Ids::WOODEN_PRESSURE_PLATE)));
696 $this->map(Blocks::OAK_SIGN(), fn(FloorSign $block) => Helper::encodeFloorSign($block,
new Writer(Ids::STANDING_SIGN)));
697 $this->map(Blocks::OAK_TRAPDOOR(), fn(WoodenTrapdoor $block) => Helper::encodeTrapdoor($block,
new Writer(Ids::TRAPDOOR)));
698 $this->map(Blocks::OAK_WALL_SIGN(), fn(WallSign $block) => Helper::encodeWallSign($block,
new Writer(Ids::WALL_SIGN)));
699 $this->mapLog(Blocks::OAK_LOG(), Ids::OAK_LOG, Ids::STRIPPED_OAK_LOG);
700 $this->mapLog(Blocks::OAK_WOOD(), Ids::OAK_WOOD, Ids::STRIPPED_OAK_WOOD);
701 $this->mapSimple(Blocks::OAK_FENCE(), Ids::OAK_FENCE);
702 $this->mapSimple(Blocks::OAK_PLANKS(), Ids::OAK_PLANKS);
703 $this->mapSlab(Blocks::OAK_SLAB(), Ids::OAK_SLAB, Ids::OAK_DOUBLE_SLAB);
704 $this->mapStairs(Blocks::OAK_STAIRS(), Ids::OAK_STAIRS);
706 $this->map(Blocks::SPRUCE_BUTTON(), fn(WoodenButton $block) => Helper::encodeButton($block,
new Writer(Ids::SPRUCE_BUTTON)));
707 $this->map(Blocks::SPRUCE_DOOR(), fn(WoodenDoor $block) => Helper::encodeDoor($block,
new Writer(Ids::SPRUCE_DOOR)));
708 $this->map(Blocks::SPRUCE_FENCE_GATE(), fn(FenceGate $block) => Helper::encodeFenceGate($block,
new Writer(Ids::SPRUCE_FENCE_GATE)));
709 $this->map(Blocks::SPRUCE_PRESSURE_PLATE(), fn(WoodenPressurePlate $block) => Helper::encodeSimplePressurePlate($block,
new Writer(Ids::SPRUCE_PRESSURE_PLATE)));
710 $this->map(Blocks::SPRUCE_SIGN(), fn(FloorSign $block) => Helper::encodeFloorSign($block,
new Writer(Ids::SPRUCE_STANDING_SIGN)));
711 $this->map(Blocks::SPRUCE_TRAPDOOR(), fn(WoodenTrapdoor $block) => Helper::encodeTrapdoor($block,
new Writer(Ids::SPRUCE_TRAPDOOR)));
712 $this->map(Blocks::SPRUCE_WALL_SIGN(), fn(WallSign $block) => Helper::encodeWallSign($block,
new Writer(Ids::SPRUCE_WALL_SIGN)));
713 $this->mapLog(Blocks::SPRUCE_LOG(), Ids::SPRUCE_LOG, Ids::STRIPPED_SPRUCE_LOG);
714 $this->mapLog(Blocks::SPRUCE_WOOD(), Ids::SPRUCE_WOOD, Ids::STRIPPED_SPRUCE_WOOD);
715 $this->mapSimple(Blocks::SPRUCE_FENCE(), Ids::SPRUCE_FENCE);
716 $this->mapSimple(Blocks::SPRUCE_PLANKS(), Ids::SPRUCE_PLANKS);
717 $this->mapSlab(Blocks::SPRUCE_SLAB(), Ids::SPRUCE_SLAB, Ids::SPRUCE_DOUBLE_SLAB);
718 $this->mapStairs(Blocks::SPRUCE_STAIRS(), Ids::SPRUCE_STAIRS);
721 $this->map(Blocks::WARPED_BUTTON(), fn(Button $block) => Helper::encodeButton($block,
new Writer(Ids::WARPED_BUTTON)));
722 $this->map(Blocks::WARPED_DOOR(), fn(Door $block) => Helper::encodeDoor($block,
new Writer(Ids::WARPED_DOOR)));
723 $this->map(Blocks::WARPED_FENCE_GATE(), fn(FenceGate $block) => Helper::encodeFenceGate($block,
new Writer(Ids::WARPED_FENCE_GATE)));
724 $this->map(Blocks::WARPED_HYPHAE(), fn(Wood $block) => Helper::encodeLog($block, Ids::WARPED_HYPHAE, Ids::STRIPPED_WARPED_HYPHAE));
725 $this->map(Blocks::WARPED_PRESSURE_PLATE(), fn(SimplePressurePlate $block) => Helper::encodeSimplePressurePlate($block,
new Writer(Ids::WARPED_PRESSURE_PLATE)));
726 $this->map(Blocks::WARPED_SIGN(), fn(FloorSign $block) => Helper::encodeFloorSign($block,
new Writer(Ids::WARPED_STANDING_SIGN)));
727 $this->map(Blocks::WARPED_STEM(), fn(Wood $block) => Helper::encodeLog($block, Ids::WARPED_STEM, Ids::STRIPPED_WARPED_STEM));
728 $this->map(Blocks::WARPED_TRAPDOOR(), fn(Trapdoor $block) => Helper::encodeTrapdoor($block,
new Writer(Ids::WARPED_TRAPDOOR)));
729 $this->map(Blocks::WARPED_WALL_SIGN(), fn(WallSign $block) => Helper::encodeWallSign($block,
new Writer(Ids::WARPED_WALL_SIGN)));
730 $this->mapSimple(Blocks::WARPED_FENCE(), Ids::WARPED_FENCE);
731 $this->mapSimple(Blocks::WARPED_PLANKS(), Ids::WARPED_PLANKS);
732 $this->mapSlab(Blocks::WARPED_SLAB(), Ids::WARPED_SLAB, Ids::WARPED_DOUBLE_SLAB);
733 $this->mapStairs(Blocks::WARPED_STAIRS(), Ids::WARPED_STAIRS);
736 private function registerLeavesSerializers() : void{
738 $this->map(Blocks::AZALEA_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves($block, new Writer(Ids::AZALEA_LEAVES)));
739 $this->map(Blocks::CHERRY_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves($block,
new Writer(Ids::CHERRY_LEAVES)));
740 $this->map(Blocks::FLOWERING_AZALEA_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves($block,
new Writer(Ids::AZALEA_LEAVES_FLOWERED)));
741 $this->map(Blocks::MANGROVE_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves($block,
new Writer(Ids::MANGROVE_LEAVES)));
744 $this->map(Blocks::ACACIA_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves($block,
new Writer(Ids::ACACIA_LEAVES)));
745 $this->map(Blocks::BIRCH_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves($block,
new Writer(Ids::BIRCH_LEAVES)));
746 $this->map(Blocks::DARK_OAK_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves($block,
new Writer(Ids::DARK_OAK_LEAVES)));
747 $this->map(Blocks::JUNGLE_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves($block,
new Writer(Ids::JUNGLE_LEAVES)));
748 $this->map(Blocks::OAK_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves($block,
new Writer(Ids::OAK_LEAVES)));
749 $this->map(Blocks::SPRUCE_LEAVES(), fn(Leaves $block) => Helper::encodeLeaves($block,
new Writer(Ids::SPRUCE_LEAVES)));
752 private function registerSaplingSerializers() : void{
754 Ids::ACACIA_SAPLING => Blocks::ACACIA_SAPLING(),
755 Ids::BIRCH_SAPLING => Blocks::BIRCH_SAPLING(),
756 Ids::DARK_OAK_SAPLING => Blocks::DARK_OAK_SAPLING(),
757 Ids::JUNGLE_SAPLING => Blocks::JUNGLE_SAPLING(),
758 Ids::OAK_SAPLING => Blocks::OAK_SAPLING(),
759 Ids::SPRUCE_SAPLING => Blocks::SPRUCE_SAPLING(),
761 $this->map($block, fn(Sapling $block) => Helper::encodeSapling($block,
new Writer($id)));
765 private function registerMobHeadSerializers() : void{
766 $this->map(Blocks::MOB_HEAD(), fn(MobHead $block) => Writer::create(match ($block->getMobHeadType()){
767 MobHeadType::CREEPER => Ids::CREEPER_HEAD,
768 MobHeadType::DRAGON => Ids::DRAGON_HEAD,
769 MobHeadType::PIGLIN => Ids::PIGLIN_HEAD,
770 MobHeadType::PLAYER => Ids::PLAYER_HEAD,
771 MobHeadType::SKELETON => Ids::SKELETON_SKULL,
772 MobHeadType::WITHER_SKELETON => Ids::WITHER_SKELETON_SKULL,
773 MobHeadType::ZOMBIE => Ids::ZOMBIE_HEAD,
774 })->writeFacingWithoutDown($block->getFacing()));
777 private function registerSimpleSerializers() : void{
778 $this->mapSimple(Blocks::AIR(), Ids::AIR);
779 $this->mapSimple(Blocks::AMETHYST(), Ids::AMETHYST_BLOCK);
780 $this->mapSimple(Blocks::ANCIENT_DEBRIS(), Ids::ANCIENT_DEBRIS);
781 $this->mapSimple(Blocks::ANDESITE(), Ids::ANDESITE);
782 $this->mapSimple(Blocks::BARRIER(), Ids::BARRIER);
783 $this->mapSimple(Blocks::BEACON(), Ids::BEACON);
784 $this->mapSimple(Blocks::BLACKSTONE(), Ids::BLACKSTONE);
785 $this->mapSimple(Blocks::BLUE_ICE(), Ids::BLUE_ICE);
786 $this->mapSimple(Blocks::BOOKSHELF(), Ids::BOOKSHELF);
787 $this->mapSimple(Blocks::BRICKS(), Ids::BRICK_BLOCK);
788 $this->mapSimple(Blocks::BROWN_MUSHROOM(), Ids::BROWN_MUSHROOM);
789 $this->mapSimple(Blocks::BUDDING_AMETHYST(), Ids::BUDDING_AMETHYST);
790 $this->mapSimple(Blocks::CALCITE(), Ids::CALCITE);
791 $this->mapSimple(Blocks::CARTOGRAPHY_TABLE(), Ids::CARTOGRAPHY_TABLE);
792 $this->mapSimple(Blocks::CHEMICAL_HEAT(), Ids::CHEMICAL_HEAT);
793 $this->mapSimple(Blocks::CHISELED_DEEPSLATE(), Ids::CHISELED_DEEPSLATE);
794 $this->mapSimple(Blocks::CHISELED_NETHER_BRICKS(), Ids::CHISELED_NETHER_BRICKS);
795 $this->mapSimple(Blocks::CHISELED_POLISHED_BLACKSTONE(), Ids::CHISELED_POLISHED_BLACKSTONE);
796 $this->mapSimple(Blocks::CHISELED_RED_SANDSTONE(), Ids::CHISELED_RED_SANDSTONE);
797 $this->mapSimple(Blocks::CHISELED_SANDSTONE(), Ids::CHISELED_SANDSTONE);
798 $this->mapSimple(Blocks::CHISELED_STONE_BRICKS(), Ids::CHISELED_STONE_BRICKS);
799 $this->mapSimple(Blocks::CHISELED_TUFF(), Ids::CHISELED_TUFF);
800 $this->mapSimple(Blocks::CHISELED_TUFF_BRICKS(), Ids::CHISELED_TUFF_BRICKS);
801 $this->mapSimple(Blocks::CHORUS_PLANT(), Ids::CHORUS_PLANT);
802 $this->mapSimple(Blocks::CLAY(), Ids::CLAY);
803 $this->mapSimple(Blocks::COAL(), Ids::COAL_BLOCK);
804 $this->mapSimple(Blocks::COAL_ORE(), Ids::COAL_ORE);
805 $this->mapSimple(Blocks::COBBLED_DEEPSLATE(), Ids::COBBLED_DEEPSLATE);
806 $this->mapSimple(Blocks::COBBLESTONE(), Ids::COBBLESTONE);
807 $this->mapSimple(Blocks::COBWEB(), Ids::WEB);
808 $this->mapSimple(Blocks::COPPER_ORE(), Ids::COPPER_ORE);
809 $this->mapSimple(Blocks::CRACKED_DEEPSLATE_BRICKS(), Ids::CRACKED_DEEPSLATE_BRICKS);
810 $this->mapSimple(Blocks::CRACKED_DEEPSLATE_TILES(), Ids::CRACKED_DEEPSLATE_TILES);
811 $this->mapSimple(Blocks::CRACKED_NETHER_BRICKS(), Ids::CRACKED_NETHER_BRICKS);
812 $this->mapSimple(Blocks::CRACKED_POLISHED_BLACKSTONE_BRICKS(), Ids::CRACKED_POLISHED_BLACKSTONE_BRICKS);
813 $this->mapSimple(Blocks::CRACKED_STONE_BRICKS(), Ids::CRACKED_STONE_BRICKS);
814 $this->mapSimple(Blocks::CRAFTING_TABLE(), Ids::CRAFTING_TABLE);
815 $this->mapSimple(Blocks::CRIMSON_ROOTS(), Ids::CRIMSON_ROOTS);
816 $this->mapSimple(Blocks::CRYING_OBSIDIAN(), Ids::CRYING_OBSIDIAN);
817 $this->mapSimple(Blocks::DANDELION(), Ids::DANDELION);
818 $this->mapSimple(Blocks::CUT_RED_SANDSTONE(), Ids::CUT_RED_SANDSTONE);
819 $this->mapSimple(Blocks::CUT_SANDSTONE(), Ids::CUT_SANDSTONE);
820 $this->mapSimple(Blocks::DARK_PRISMARINE(), Ids::DARK_PRISMARINE);
821 $this->mapSimple(Blocks::DEAD_BUSH(), Ids::DEADBUSH);
822 $this->mapSimple(Blocks::DEEPSLATE_BRICKS(), Ids::DEEPSLATE_BRICKS);
823 $this->mapSimple(Blocks::DEEPSLATE_COAL_ORE(), Ids::DEEPSLATE_COAL_ORE);
824 $this->mapSimple(Blocks::DEEPSLATE_COPPER_ORE(), Ids::DEEPSLATE_COPPER_ORE);
825 $this->mapSimple(Blocks::DEEPSLATE_DIAMOND_ORE(), Ids::DEEPSLATE_DIAMOND_ORE);
826 $this->mapSimple(Blocks::DEEPSLATE_EMERALD_ORE(), Ids::DEEPSLATE_EMERALD_ORE);
827 $this->mapSimple(Blocks::DEEPSLATE_GOLD_ORE(), Ids::DEEPSLATE_GOLD_ORE);
828 $this->mapSimple(Blocks::DEEPSLATE_IRON_ORE(), Ids::DEEPSLATE_IRON_ORE);
829 $this->mapSimple(Blocks::DEEPSLATE_LAPIS_LAZULI_ORE(), Ids::DEEPSLATE_LAPIS_ORE);
830 $this->mapSimple(Blocks::DEEPSLATE_TILES(), Ids::DEEPSLATE_TILES);
831 $this->mapSimple(Blocks::DIAMOND(), Ids::DIAMOND_BLOCK);
832 $this->mapSimple(Blocks::DIAMOND_ORE(), Ids::DIAMOND_ORE);
833 $this->mapSimple(Blocks::DIORITE(), Ids::DIORITE);
834 $this->mapSimple(Blocks::DRAGON_EGG(), Ids::DRAGON_EGG);
835 $this->mapSimple(Blocks::DRIED_KELP(), Ids::DRIED_KELP_BLOCK);
836 $this->mapSimple(Blocks::ELEMENT_ACTINIUM(), Ids::ELEMENT_89);
837 $this->mapSimple(Blocks::ELEMENT_ALUMINUM(), Ids::ELEMENT_13);
838 $this->mapSimple(Blocks::ELEMENT_AMERICIUM(), Ids::ELEMENT_95);
839 $this->mapSimple(Blocks::ELEMENT_ANTIMONY(), Ids::ELEMENT_51);
840 $this->mapSimple(Blocks::ELEMENT_ARGON(), Ids::ELEMENT_18);
841 $this->mapSimple(Blocks::ELEMENT_ARSENIC(), Ids::ELEMENT_33);
842 $this->mapSimple(Blocks::ELEMENT_ASTATINE(), Ids::ELEMENT_85);
843 $this->mapSimple(Blocks::ELEMENT_BARIUM(), Ids::ELEMENT_56);
844 $this->mapSimple(Blocks::ELEMENT_BERKELIUM(), Ids::ELEMENT_97);
845 $this->mapSimple(Blocks::ELEMENT_BERYLLIUM(), Ids::ELEMENT_4);
846 $this->mapSimple(Blocks::ELEMENT_BISMUTH(), Ids::ELEMENT_83);
847 $this->mapSimple(Blocks::ELEMENT_BOHRIUM(), Ids::ELEMENT_107);
848 $this->mapSimple(Blocks::ELEMENT_BORON(), Ids::ELEMENT_5);
849 $this->mapSimple(Blocks::ELEMENT_BROMINE(), Ids::ELEMENT_35);
850 $this->mapSimple(Blocks::ELEMENT_CADMIUM(), Ids::ELEMENT_48);
851 $this->mapSimple(Blocks::ELEMENT_CALCIUM(), Ids::ELEMENT_20);
852 $this->mapSimple(Blocks::ELEMENT_CALIFORNIUM(), Ids::ELEMENT_98);
853 $this->mapSimple(Blocks::ELEMENT_CARBON(), Ids::ELEMENT_6);
854 $this->mapSimple(Blocks::ELEMENT_CERIUM(), Ids::ELEMENT_58);
855 $this->mapSimple(Blocks::ELEMENT_CESIUM(), Ids::ELEMENT_55);
856 $this->mapSimple(Blocks::ELEMENT_CHLORINE(), Ids::ELEMENT_17);
857 $this->mapSimple(Blocks::ELEMENT_CHROMIUM(), Ids::ELEMENT_24);
858 $this->mapSimple(Blocks::ELEMENT_COBALT(), Ids::ELEMENT_27);
859 $this->mapSimple(Blocks::ELEMENT_COPERNICIUM(), Ids::ELEMENT_112);
860 $this->mapSimple(Blocks::ELEMENT_COPPER(), Ids::ELEMENT_29);
861 $this->mapSimple(Blocks::ELEMENT_CURIUM(), Ids::ELEMENT_96);
862 $this->mapSimple(Blocks::ELEMENT_DARMSTADTIUM(), Ids::ELEMENT_110);
863 $this->mapSimple(Blocks::ELEMENT_DUBNIUM(), Ids::ELEMENT_105);
864 $this->mapSimple(Blocks::ELEMENT_DYSPROSIUM(), Ids::ELEMENT_66);
865 $this->mapSimple(Blocks::ELEMENT_EINSTEINIUM(), Ids::ELEMENT_99);
866 $this->mapSimple(Blocks::ELEMENT_ERBIUM(), Ids::ELEMENT_68);
867 $this->mapSimple(Blocks::ELEMENT_EUROPIUM(), Ids::ELEMENT_63);
868 $this->mapSimple(Blocks::ELEMENT_FERMIUM(), Ids::ELEMENT_100);
869 $this->mapSimple(Blocks::ELEMENT_FLEROVIUM(), Ids::ELEMENT_114);
870 $this->mapSimple(Blocks::ELEMENT_FLUORINE(), Ids::ELEMENT_9);
871 $this->mapSimple(Blocks::ELEMENT_FRANCIUM(), Ids::ELEMENT_87);
872 $this->mapSimple(Blocks::ELEMENT_GADOLINIUM(), Ids::ELEMENT_64);
873 $this->mapSimple(Blocks::ELEMENT_GALLIUM(), Ids::ELEMENT_31);
874 $this->mapSimple(Blocks::ELEMENT_GERMANIUM(), Ids::ELEMENT_32);
875 $this->mapSimple(Blocks::ELEMENT_GOLD(), Ids::ELEMENT_79);
876 $this->mapSimple(Blocks::ELEMENT_HAFNIUM(), Ids::ELEMENT_72);
877 $this->mapSimple(Blocks::ELEMENT_HASSIUM(), Ids::ELEMENT_108);
878 $this->mapSimple(Blocks::ELEMENT_HELIUM(), Ids::ELEMENT_2);
879 $this->mapSimple(Blocks::ELEMENT_HOLMIUM(), Ids::ELEMENT_67);
880 $this->mapSimple(Blocks::ELEMENT_HYDROGEN(), Ids::ELEMENT_1);
881 $this->mapSimple(Blocks::ELEMENT_INDIUM(), Ids::ELEMENT_49);
882 $this->mapSimple(Blocks::ELEMENT_IODINE(), Ids::ELEMENT_53);
883 $this->mapSimple(Blocks::ELEMENT_IRIDIUM(), Ids::ELEMENT_77);
884 $this->mapSimple(Blocks::ELEMENT_IRON(), Ids::ELEMENT_26);
885 $this->mapSimple(Blocks::ELEMENT_KRYPTON(), Ids::ELEMENT_36);
886 $this->mapSimple(Blocks::ELEMENT_LANTHANUM(), Ids::ELEMENT_57);
887 $this->mapSimple(Blocks::ELEMENT_LAWRENCIUM(), Ids::ELEMENT_103);
888 $this->mapSimple(Blocks::ELEMENT_LEAD(), Ids::ELEMENT_82);
889 $this->mapSimple(Blocks::ELEMENT_LITHIUM(), Ids::ELEMENT_3);
890 $this->mapSimple(Blocks::ELEMENT_LIVERMORIUM(), Ids::ELEMENT_116);
891 $this->mapSimple(Blocks::ELEMENT_LUTETIUM(), Ids::ELEMENT_71);
892 $this->mapSimple(Blocks::ELEMENT_MAGNESIUM(), Ids::ELEMENT_12);
893 $this->mapSimple(Blocks::ELEMENT_MANGANESE(), Ids::ELEMENT_25);
894 $this->mapSimple(Blocks::ELEMENT_MEITNERIUM(), Ids::ELEMENT_109);
895 $this->mapSimple(Blocks::ELEMENT_MENDELEVIUM(), Ids::ELEMENT_101);
896 $this->mapSimple(Blocks::ELEMENT_MERCURY(), Ids::ELEMENT_80);
897 $this->mapSimple(Blocks::ELEMENT_MOLYBDENUM(), Ids::ELEMENT_42);
898 $this->mapSimple(Blocks::ELEMENT_MOSCOVIUM(), Ids::ELEMENT_115);
899 $this->mapSimple(Blocks::ELEMENT_NEODYMIUM(), Ids::ELEMENT_60);
900 $this->mapSimple(Blocks::ELEMENT_NEON(), Ids::ELEMENT_10);
901 $this->mapSimple(Blocks::ELEMENT_NEPTUNIUM(), Ids::ELEMENT_93);
902 $this->mapSimple(Blocks::ELEMENT_NICKEL(), Ids::ELEMENT_28);
903 $this->mapSimple(Blocks::ELEMENT_NIHONIUM(), Ids::ELEMENT_113);
904 $this->mapSimple(Blocks::ELEMENT_NIOBIUM(), Ids::ELEMENT_41);
905 $this->mapSimple(Blocks::ELEMENT_NITROGEN(), Ids::ELEMENT_7);
906 $this->mapSimple(Blocks::ELEMENT_NOBELIUM(), Ids::ELEMENT_102);
907 $this->mapSimple(Blocks::ELEMENT_OGANESSON(), Ids::ELEMENT_118);
908 $this->mapSimple(Blocks::ELEMENT_OSMIUM(), Ids::ELEMENT_76);
909 $this->mapSimple(Blocks::ELEMENT_OXYGEN(), Ids::ELEMENT_8);
910 $this->mapSimple(Blocks::ELEMENT_PALLADIUM(), Ids::ELEMENT_46);
911 $this->mapSimple(Blocks::ELEMENT_PHOSPHORUS(), Ids::ELEMENT_15);
912 $this->mapSimple(Blocks::ELEMENT_PLATINUM(), Ids::ELEMENT_78);
913 $this->mapSimple(Blocks::ELEMENT_PLUTONIUM(), Ids::ELEMENT_94);
914 $this->mapSimple(Blocks::ELEMENT_POLONIUM(), Ids::ELEMENT_84);
915 $this->mapSimple(Blocks::ELEMENT_POTASSIUM(), Ids::ELEMENT_19);
916 $this->mapSimple(Blocks::ELEMENT_PRASEODYMIUM(), Ids::ELEMENT_59);
917 $this->mapSimple(Blocks::ELEMENT_PROMETHIUM(), Ids::ELEMENT_61);
918 $this->mapSimple(Blocks::ELEMENT_PROTACTINIUM(), Ids::ELEMENT_91);
919 $this->mapSimple(Blocks::ELEMENT_RADIUM(), Ids::ELEMENT_88);
920 $this->mapSimple(Blocks::ELEMENT_RADON(), Ids::ELEMENT_86);
921 $this->mapSimple(Blocks::ELEMENT_RHENIUM(), Ids::ELEMENT_75);
922 $this->mapSimple(Blocks::ELEMENT_RHODIUM(), Ids::ELEMENT_45);
923 $this->mapSimple(Blocks::ELEMENT_ROENTGENIUM(), Ids::ELEMENT_111);
924 $this->mapSimple(Blocks::ELEMENT_RUBIDIUM(), Ids::ELEMENT_37);
925 $this->mapSimple(Blocks::ELEMENT_RUTHENIUM(), Ids::ELEMENT_44);
926 $this->mapSimple(Blocks::ELEMENT_RUTHERFORDIUM(), Ids::ELEMENT_104);
927 $this->mapSimple(Blocks::ELEMENT_SAMARIUM(), Ids::ELEMENT_62);
928 $this->mapSimple(Blocks::ELEMENT_SCANDIUM(), Ids::ELEMENT_21);
929 $this->mapSimple(Blocks::ELEMENT_SEABORGIUM(), Ids::ELEMENT_106);
930 $this->mapSimple(Blocks::ELEMENT_SELENIUM(), Ids::ELEMENT_34);
931 $this->mapSimple(Blocks::ELEMENT_SILICON(), Ids::ELEMENT_14);
932 $this->mapSimple(Blocks::ELEMENT_SILVER(), Ids::ELEMENT_47);
933 $this->mapSimple(Blocks::ELEMENT_SODIUM(), Ids::ELEMENT_11);
934 $this->mapSimple(Blocks::ELEMENT_STRONTIUM(), Ids::ELEMENT_38);
935 $this->mapSimple(Blocks::ELEMENT_SULFUR(), Ids::ELEMENT_16);
936 $this->mapSimple(Blocks::ELEMENT_TANTALUM(), Ids::ELEMENT_73);
937 $this->mapSimple(Blocks::ELEMENT_TECHNETIUM(), Ids::ELEMENT_43);
938 $this->mapSimple(Blocks::ELEMENT_TELLURIUM(), Ids::ELEMENT_52);
939 $this->mapSimple(Blocks::ELEMENT_TENNESSINE(), Ids::ELEMENT_117);
940 $this->mapSimple(Blocks::ELEMENT_TERBIUM(), Ids::ELEMENT_65);
941 $this->mapSimple(Blocks::ELEMENT_THALLIUM(), Ids::ELEMENT_81);
942 $this->mapSimple(Blocks::ELEMENT_THORIUM(), Ids::ELEMENT_90);
943 $this->mapSimple(Blocks::ELEMENT_THULIUM(), Ids::ELEMENT_69);
944 $this->mapSimple(Blocks::ELEMENT_TIN(), Ids::ELEMENT_50);
945 $this->mapSimple(Blocks::ELEMENT_TITANIUM(), Ids::ELEMENT_22);
946 $this->mapSimple(Blocks::ELEMENT_TUNGSTEN(), Ids::ELEMENT_74);
947 $this->mapSimple(Blocks::ELEMENT_URANIUM(), Ids::ELEMENT_92);
948 $this->mapSimple(Blocks::ELEMENT_VANADIUM(), Ids::ELEMENT_23);
949 $this->mapSimple(Blocks::ELEMENT_XENON(), Ids::ELEMENT_54);
950 $this->mapSimple(Blocks::ELEMENT_YTTERBIUM(), Ids::ELEMENT_70);
951 $this->mapSimple(Blocks::ELEMENT_YTTRIUM(), Ids::ELEMENT_39);
952 $this->mapSimple(Blocks::ELEMENT_ZERO(), Ids::ELEMENT_0);
953 $this->mapSimple(Blocks::ELEMENT_ZINC(), Ids::ELEMENT_30);
954 $this->mapSimple(Blocks::ELEMENT_ZIRCONIUM(), Ids::ELEMENT_40);
955 $this->mapSimple(Blocks::EMERALD(), Ids::EMERALD_BLOCK);
956 $this->mapSimple(Blocks::EMERALD_ORE(), Ids::EMERALD_ORE);
957 $this->mapSimple(Blocks::ENCHANTING_TABLE(), Ids::ENCHANTING_TABLE);
958 $this->mapSimple(Blocks::END_STONE(), Ids::END_STONE);
959 $this->mapSimple(Blocks::END_STONE_BRICKS(), Ids::END_BRICKS);
960 $this->mapSimple(Blocks::FERN(), Ids::FERN);
961 $this->mapSimple(Blocks::FLETCHING_TABLE(), Ids::FLETCHING_TABLE);
962 $this->mapSimple(Blocks::GILDED_BLACKSTONE(), Ids::GILDED_BLACKSTONE);
963 $this->mapSimple(Blocks::GLASS(), Ids::GLASS);
964 $this->mapSimple(Blocks::GLASS_PANE(), Ids::GLASS_PANE);
965 $this->mapSimple(Blocks::GLOWING_OBSIDIAN(), Ids::GLOWINGOBSIDIAN);
966 $this->mapSimple(Blocks::GLOWSTONE(), Ids::GLOWSTONE);
967 $this->mapSimple(Blocks::GOLD(), Ids::GOLD_BLOCK);
968 $this->mapSimple(Blocks::GOLD_ORE(), Ids::GOLD_ORE);
969 $this->mapSimple(Blocks::GRANITE(), Ids::GRANITE);
970 $this->mapSimple(Blocks::GRASS(), Ids::GRASS_BLOCK);
971 $this->mapSimple(Blocks::GRASS_PATH(), Ids::GRASS_PATH);
972 $this->mapSimple(Blocks::GRAVEL(), Ids::GRAVEL);
973 $this->mapSimple(Blocks::HANGING_ROOTS(), Ids::HANGING_ROOTS);
974 $this->mapSimple(Blocks::HARDENED_CLAY(), Ids::HARDENED_CLAY);
975 $this->mapSimple(Blocks::HARDENED_GLASS(), Ids::HARD_GLASS);
976 $this->mapSimple(Blocks::HARDENED_GLASS_PANE(), Ids::HARD_GLASS_PANE);
977 $this->mapSimple(Blocks::HONEYCOMB(), Ids::HONEYCOMB_BLOCK);
978 $this->mapSimple(Blocks::ICE(), Ids::ICE);
979 $this->mapSimple(Blocks::INFESTED_CHISELED_STONE_BRICK(), Ids::INFESTED_CHISELED_STONE_BRICKS);
980 $this->mapSimple(Blocks::INFESTED_COBBLESTONE(), Ids::INFESTED_COBBLESTONE);
981 $this->mapSimple(Blocks::INFESTED_CRACKED_STONE_BRICK(), Ids::INFESTED_CRACKED_STONE_BRICKS);
982 $this->mapSimple(Blocks::INFESTED_MOSSY_STONE_BRICK(), Ids::INFESTED_MOSSY_STONE_BRICKS);
983 $this->mapSimple(Blocks::INFESTED_STONE(), Ids::INFESTED_STONE);
984 $this->mapSimple(Blocks::INFESTED_STONE_BRICK(), Ids::INFESTED_STONE_BRICKS);
985 $this->mapSimple(Blocks::INFO_UPDATE(), Ids::INFO_UPDATE);
986 $this->mapSimple(Blocks::INFO_UPDATE2(), Ids::INFO_UPDATE2);
987 $this->mapSimple(Blocks::INVISIBLE_BEDROCK(), Ids::INVISIBLE_BEDROCK);
988 $this->mapSimple(Blocks::IRON(), Ids::IRON_BLOCK);
989 $this->mapSimple(Blocks::IRON_BARS(), Ids::IRON_BARS);
990 $this->mapSimple(Blocks::IRON_ORE(), Ids::IRON_ORE);
991 $this->mapSimple(Blocks::JUKEBOX(), Ids::JUKEBOX);
992 $this->mapSimple(Blocks::LAPIS_LAZULI(), Ids::LAPIS_BLOCK);
993 $this->mapSimple(Blocks::LAPIS_LAZULI_ORE(), Ids::LAPIS_ORE);
994 $this->mapSimple(Blocks::LEGACY_STONECUTTER(), Ids::STONECUTTER);
995 $this->mapSimple(Blocks::LILY_PAD(), Ids::WATERLILY);
996 $this->mapSimple(Blocks::MAGMA(), Ids::MAGMA);
997 $this->mapSimple(Blocks::MANGROVE_ROOTS(), Ids::MANGROVE_ROOTS);
998 $this->mapSimple(Blocks::MELON(), Ids::MELON_BLOCK);
999 $this->mapSimple(Blocks::MONSTER_SPAWNER(), Ids::MOB_SPAWNER);
1000 $this->mapSimple(Blocks::MOSSY_COBBLESTONE(), Ids::MOSSY_COBBLESTONE);
1001 $this->mapSimple(Blocks::MOSSY_STONE_BRICKS(), Ids::MOSSY_STONE_BRICKS);
1002 $this->mapSimple(Blocks::MUD(), Ids::MUD);
1003 $this->mapSimple(Blocks::MUD_BRICKS(), Ids::MUD_BRICKS);
1004 $this->mapSimple(Blocks::MYCELIUM(), Ids::MYCELIUM);
1005 $this->mapSimple(Blocks::NETHERITE(), Ids::NETHERITE_BLOCK);
1006 $this->mapSimple(Blocks::NETHERRACK(), Ids::NETHERRACK);
1007 $this->mapSimple(Blocks::NETHER_BRICKS(), Ids::NETHER_BRICK);
1008 $this->mapSimple(Blocks::NETHER_BRICK_FENCE(), Ids::NETHER_BRICK_FENCE);
1009 $this->mapSimple(Blocks::NETHER_GOLD_ORE(), Ids::NETHER_GOLD_ORE);
1010 $this->mapSimple(Blocks::NETHER_QUARTZ_ORE(), Ids::QUARTZ_ORE);
1011 $this->mapSimple(Blocks::NETHER_REACTOR_CORE(), Ids::NETHERREACTOR);
1012 $this->mapSimple(Blocks::NETHER_WART_BLOCK(), Ids::NETHER_WART_BLOCK);
1013 $this->mapSimple(Blocks::NOTE_BLOCK(), Ids::NOTEBLOCK);
1014 $this->mapSimple(Blocks::OBSIDIAN(), Ids::OBSIDIAN);
1015 $this->mapSimple(Blocks::PACKED_ICE(), Ids::PACKED_ICE);
1016 $this->mapSimple(Blocks::PACKED_MUD(), Ids::PACKED_MUD);
1017 $this->mapSimple(Blocks::PODZOL(), Ids::PODZOL);
1018 $this->mapSimple(Blocks::POLISHED_ANDESITE(), Ids::POLISHED_ANDESITE);
1019 $this->mapSimple(Blocks::POLISHED_BLACKSTONE(), Ids::POLISHED_BLACKSTONE);
1020 $this->mapSimple(Blocks::POLISHED_BLACKSTONE_BRICKS(), Ids::POLISHED_BLACKSTONE_BRICKS);
1021 $this->mapSimple(Blocks::POLISHED_DEEPSLATE(), Ids::POLISHED_DEEPSLATE);
1022 $this->mapSimple(Blocks::POLISHED_DIORITE(), Ids::POLISHED_DIORITE);
1023 $this->mapSimple(Blocks::POLISHED_GRANITE(), Ids::POLISHED_GRANITE);
1024 $this->mapSimple(Blocks::POLISHED_TUFF(), Ids::POLISHED_TUFF);
1025 $this->mapSimple(Blocks::PRISMARINE(), Ids::PRISMARINE);
1026 $this->mapSimple(Blocks::PRISMARINE_BRICKS(), Ids::PRISMARINE_BRICKS);
1027 $this->mapSimple(Blocks::QUARTZ_BRICKS(), Ids::QUARTZ_BRICKS);
1028 $this->mapSimple(Blocks::RAW_COPPER(), Ids::RAW_COPPER_BLOCK);
1029 $this->mapSimple(Blocks::RAW_GOLD(), Ids::RAW_GOLD_BLOCK);
1030 $this->mapSimple(Blocks::RAW_IRON(), Ids::RAW_IRON_BLOCK);
1031 $this->mapSimple(Blocks::REDSTONE(), Ids::REDSTONE_BLOCK);
1032 $this->mapSimple(Blocks::RED_MUSHROOM(), Ids::RED_MUSHROOM);
1033 $this->mapSimple(Blocks::RED_NETHER_BRICKS(), Ids::RED_NETHER_BRICK);
1034 $this->mapSimple(Blocks::RED_SAND(), Ids::RED_SAND);
1035 $this->mapSimple(Blocks::RED_SANDSTONE(), Ids::RED_SANDSTONE);
1036 $this->mapSimple(Blocks::REINFORCED_DEEPSLATE(), Ids::REINFORCED_DEEPSLATE);
1037 $this->mapSimple(Blocks::RESERVED6(), Ids::RESERVED6);
1038 $this->mapSimple(Blocks::SAND(), Ids::SAND);
1039 $this->mapSimple(Blocks::SANDSTONE(), Ids::SANDSTONE);
1040 $this->mapSimple(Blocks::SCULK(), Ids::SCULK);
1041 $this->mapSimple(Blocks::SEA_LANTERN(), Ids::SEA_LANTERN);
1042 $this->mapSimple(Blocks::SHROOMLIGHT(), Ids::SHROOMLIGHT);
1043 $this->mapSimple(Blocks::SHULKER_BOX(), Ids::UNDYED_SHULKER_BOX);
1044 $this->mapSimple(Blocks::SLIME(), Ids::SLIME);
1045 $this->mapSimple(Blocks::SMITHING_TABLE(), Ids::SMITHING_TABLE);
1046 $this->mapSimple(Blocks::SMOOTH_BASALT(), Ids::SMOOTH_BASALT);
1047 $this->mapSimple(Blocks::SMOOTH_RED_SANDSTONE(), Ids::SMOOTH_RED_SANDSTONE);
1048 $this->mapSimple(Blocks::SMOOTH_SANDSTONE(), Ids::SMOOTH_SANDSTONE);
1049 $this->mapSimple(Blocks::SMOOTH_STONE(), Ids::SMOOTH_STONE);
1050 $this->mapSimple(Blocks::SNOW(), Ids::SNOW);
1051 $this->mapSimple(Blocks::SOUL_SAND(), Ids::SOUL_SAND);
1052 $this->mapSimple(Blocks::SOUL_SOIL(), Ids::SOUL_SOIL);
1053 $this->mapSimple(Blocks::SPORE_BLOSSOM(), Ids::SPORE_BLOSSOM);
1054 $this->mapSimple(Blocks::STONE(), Ids::STONE);
1055 $this->mapSimple(Blocks::STONE_BRICKS(), Ids::STONE_BRICKS);
1056 $this->mapSimple(Blocks::TALL_GRASS(), Ids::SHORT_GRASS);
1057 $this->mapSimple(Blocks::TINTED_GLASS(), Ids::TINTED_GLASS);
1058 $this->mapSimple(Blocks::TORCHFLOWER(), Ids::TORCHFLOWER);
1059 $this->mapSimple(Blocks::TUFF(), Ids::TUFF);
1060 $this->mapSimple(Blocks::TUFF_BRICKS(), Ids::TUFF_BRICKS);
1061 $this->mapSimple(Blocks::WARPED_WART_BLOCK(), Ids::WARPED_WART_BLOCK);
1062 $this->mapSimple(Blocks::WARPED_ROOTS(), Ids::WARPED_ROOTS);
1063 $this->mapSimple(Blocks::WITHER_ROSE(), Ids::WITHER_ROSE);
1065 $this->mapSimple(Blocks::ALLIUM(), Ids::ALLIUM);
1066 $this->mapSimple(Blocks::CORNFLOWER(), Ids::CORNFLOWER);
1067 $this->mapSimple(Blocks::AZURE_BLUET(), Ids::AZURE_BLUET);
1068 $this->mapSimple(Blocks::LILY_OF_THE_VALLEY(), Ids::LILY_OF_THE_VALLEY);
1069 $this->mapSimple(Blocks::BLUE_ORCHID(), Ids::BLUE_ORCHID);
1070 $this->mapSimple(Blocks::OXEYE_DAISY(), Ids::OXEYE_DAISY);
1071 $this->mapSimple(Blocks::POPPY(), Ids::POPPY);
1072 $this->mapSimple(Blocks::ORANGE_TULIP(), Ids::ORANGE_TULIP);
1073 $this->mapSimple(Blocks::PINK_TULIP(), Ids::PINK_TULIP);
1074 $this->mapSimple(Blocks::RED_TULIP(), Ids::RED_TULIP);
1075 $this->mapSimple(Blocks::WHITE_TULIP(), Ids::WHITE_TULIP);
1078 private function registerSerializers() : void{
1079 $this->map(Blocks::ACTIVATOR_RAIL(), function(ActivatorRail $block) : Writer{
1080 return Writer::create(Ids::ACTIVATOR_RAIL)
1081 ->writeBool(StateNames::RAIL_DATA_BIT, $block->isPowered())
1082 ->writeInt(StateNames::RAIL_DIRECTION, $block->getShape());
1084 $this->map(Blocks::ALL_SIDED_MUSHROOM_STEM(), fn() => Writer::create(Ids::MUSHROOM_STEM)
1085 ->writeInt(StateNames::HUGE_MUSHROOM_BITS, BlockLegacyMetadata::MUSHROOM_BLOCK_ALL_STEM));
1086 $this->map(Blocks::AMETHYST_CLUSTER(), fn(AmethystCluster $block) => Writer::create(
1087 match($stage = $block->getStage()){
1088 AmethystCluster::STAGE_SMALL_BUD => Ids::SMALL_AMETHYST_BUD,
1089 AmethystCluster::STAGE_MEDIUM_BUD => Ids::MEDIUM_AMETHYST_BUD,
1090 AmethystCluster::STAGE_LARGE_BUD => Ids::LARGE_AMETHYST_BUD,
1091 AmethystCluster::STAGE_CLUSTER => Ids::AMETHYST_CLUSTER,
1092 default => throw new BlockStateSerializeException(
"Invalid Amethyst Cluster stage $stage"),
1094 ->writeBlockFace($block->getFacing())
1096 $this->mapSlab(Blocks::ANDESITE_SLAB(), Ids::ANDESITE_SLAB, Ids::ANDESITE_DOUBLE_SLAB);
1097 $this->map(Blocks::ANDESITE_STAIRS(), fn(Stair $block) => Helper::encodeStairs($block,
new Writer(Ids::ANDESITE_STAIRS)));
1098 $this->map(Blocks::ANDESITE_WALL(), fn(Wall $block) => Helper::encodeWall($block, Writer::create(Ids::ANDESITE_WALL)));
1099 $this->map(Blocks::ANVIL(), fn(Anvil $block) : Writer => Writer::create(
1100 match($damage = $block->getDamage()){
1102 1 => Ids::CHIPPED_ANVIL,
1103 2 => Ids::DAMAGED_ANVIL,
1104 default => throw new BlockStateSerializeException(
"Invalid Anvil damage {$damage}"),
1106 ->writeCardinalHorizontalFacing($block->getFacing())
1108 $this->map(Blocks::BAMBOO(),
function(Bamboo $block) : Writer{
1109 return Writer::create(Ids::BAMBOO)
1110 ->writeBool(StateNames::AGE_BIT, $block->isReady())
1111 ->writeString(StateNames::BAMBOO_LEAF_SIZE, match($block->getLeafSize()){
1112 Bamboo::NO_LEAVES => StringValues::BAMBOO_LEAF_SIZE_NO_LEAVES,
1113 Bamboo::SMALL_LEAVES => StringValues::BAMBOO_LEAF_SIZE_SMALL_LEAVES,
1114 Bamboo::LARGE_LEAVES => StringValues::BAMBOO_LEAF_SIZE_LARGE_LEAVES,
1115 default => throw new BlockStateSerializeException(
"Invalid Bamboo leaf thickness " . $block->getLeafSize()),
1117 ->writeString(StateNames::BAMBOO_STALK_THICKNESS, $block->isThick() ? StringValues::BAMBOO_STALK_THICKNESS_THICK : StringValues::BAMBOO_STALK_THICKNESS_THIN);
1119 $this->map(Blocks::BAMBOO_SAPLING(),
function(BambooSapling $block) : Writer{
1120 return Writer::create(Ids::BAMBOO_SAPLING)
1121 ->writeBool(StateNames::AGE_BIT, $block->isReady());
1123 $this->map(Blocks::BANNER(),
function(FloorBanner $block) : Writer{
1124 return Writer::create(Ids::STANDING_BANNER)
1125 ->writeInt(StateNames::GROUND_SIGN_DIRECTION, $block->getRotation());
1127 $this->map(Blocks::BARREL(),
function(Barrel $block) : Writer{
1128 return Writer::create(Ids::BARREL)
1129 ->writeBool(StateNames::OPEN_BIT, $block->isOpen())
1130 ->writeFacingDirection($block->getFacing());
1132 $this->map(Blocks::BASALT(),
function(SimplePillar $block) : Writer{
1133 return Writer::create(Ids::BASALT)
1134 ->writePillarAxis($block->getAxis());
1136 $this->map(Blocks::BED(),
function(Bed $block) : Writer{
1137 return Writer::create(Ids::BED)
1138 ->writeBool(StateNames::HEAD_PIECE_BIT, $block->isHeadPart())
1139 ->writeBool(StateNames::OCCUPIED_BIT, $block->isOccupied())
1140 ->writeLegacyHorizontalFacing($block->getFacing());
1142 $this->map(Blocks::BEDROCK(),
function(Block $block) : Writer{
1143 return Writer::create(Ids::BEDROCK)
1144 ->writeBool(StateNames::INFINIBURN_BIT, $block->burnsForever());
1146 $this->map(Blocks::BEETROOTS(), fn(Beetroot $block) => Helper::encodeCrops($block,
new Writer(Ids::BEETROOT)));
1147 $this->map(Blocks::BELL(),
function(Bell $block) : Writer{
1148 return Writer::create(Ids::BELL)
1149 ->writeBellAttachmentType($block->getAttachmentType())
1150 ->writeBool(StateNames::TOGGLE_BIT,
false)
1151 ->writeLegacyHorizontalFacing($block->getFacing());
1154 $this->map(Blocks::BIG_DRIPLEAF_HEAD(),
function(BigDripleafHead $block) : Writer{
1155 return Writer::create(Ids::BIG_DRIPLEAF)
1156 ->writeCardinalHorizontalFacing($block->getFacing())
1157 ->writeString(StateNames::BIG_DRIPLEAF_TILT, match($block->getLeafState()){
1158 DripleafState::STABLE => StringValues::BIG_DRIPLEAF_TILT_NONE,
1159 DripleafState::UNSTABLE => StringValues::BIG_DRIPLEAF_TILT_UNSTABLE,
1160 DripleafState::PARTIAL_TILT => StringValues::BIG_DRIPLEAF_TILT_PARTIAL_TILT,
1161 DripleafState::FULL_TILT => StringValues::BIG_DRIPLEAF_TILT_FULL_TILT,
1163 ->writeBool(StateNames::BIG_DRIPLEAF_HEAD,
true);
1165 $this->map(Blocks::BIG_DRIPLEAF_STEM(),
function(BigDripleafStem $block) : Writer{
1166 return Writer::create(Ids::BIG_DRIPLEAF)
1167 ->writeCardinalHorizontalFacing($block->getFacing())
1168 ->writeString(StateNames::BIG_DRIPLEAF_TILT, StringValues::BIG_DRIPLEAF_TILT_NONE)
1169 ->writeBool(StateNames::BIG_DRIPLEAF_HEAD,
false);
1171 $this->mapSlab(Blocks::BLACKSTONE_SLAB(), Ids::BLACKSTONE_SLAB, Ids::BLACKSTONE_DOUBLE_SLAB);
1172 $this->mapStairs(Blocks::BLACKSTONE_STAIRS(), Ids::BLACKSTONE_STAIRS);
1173 $this->map(Blocks::BLACKSTONE_WALL(), fn(Wall $block) => Helper::encodeWall($block,
new Writer(Ids::BLACKSTONE_WALL)));
1174 $this->map(Blocks::BLAST_FURNACE(), fn(Furnace $block) => Helper::encodeFurnace($block, Ids::BLAST_FURNACE, Ids::LIT_BLAST_FURNACE));
1175 $this->map(Blocks::BLUE_TORCH(), fn(Torch $block) => Helper::encodeTorch($block, Writer::create(Ids::COLORED_TORCH_BLUE)));
1176 $this->map(Blocks::BONE_BLOCK(),
function(BoneBlock $block) : Writer{
1177 return Writer::create(Ids::BONE_BLOCK)
1178 ->writeInt(StateNames::DEPRECATED, 0)
1179 ->writePillarAxis($block->getAxis());
1181 $this->map(Blocks::BREWING_STAND(),
function(BrewingStand $block) : Writer{
1182 return Writer::create(Ids::BREWING_STAND)
1183 ->writeBool(StateNames::BREWING_STAND_SLOT_A_BIT, $block->hasSlot(BrewingStandSlot::EAST))
1184 ->writeBool(StateNames::BREWING_STAND_SLOT_B_BIT, $block->hasSlot(BrewingStandSlot::SOUTHWEST))
1185 ->writeBool(StateNames::BREWING_STAND_SLOT_C_BIT, $block->hasSlot(BrewingStandSlot::NORTHWEST));
1187 $this->mapSlab(Blocks::BRICK_SLAB(), Ids::BRICK_SLAB, Ids::BRICK_DOUBLE_SLAB);
1188 $this->mapStairs(Blocks::BRICK_STAIRS(), Ids::BRICK_STAIRS);
1189 $this->map(Blocks::BRICK_WALL(), fn(Wall $block) => Helper::encodeWall($block, Writer::create(Ids::BRICK_WALL)));
1190 $this->map(Blocks::BROWN_MUSHROOM_BLOCK(), fn(BrownMushroomBlock $block) => Helper::encodeMushroomBlock($block,
new Writer(Ids::BROWN_MUSHROOM_BLOCK)));
1191 $this->map(Blocks::CACTUS(),
function(Cactus $block) : Writer{
1192 return Writer::create(Ids::CACTUS)
1193 ->writeInt(StateNames::AGE, $block->getAge());
1195 $this->map(Blocks::CAKE(),
function(Cake $block) : Writer{
1196 return Writer::create(Ids::CAKE)
1197 ->writeInt(StateNames::BITE_COUNTER, $block->getBites());
1199 $this->map(Blocks::CAMPFIRE(),
function(Campfire $block) : Writer{
1200 return Writer::create(Ids::CAMPFIRE)
1201 ->writeCardinalHorizontalFacing($block->getFacing())
1202 ->writeBool(StateNames::EXTINGUISHED, !$block->isLit());
1204 $this->map(Blocks::CARROTS(), fn(Carrot $block) => Helper::encodeCrops($block,
new Writer(Ids::CARROTS)));
1205 $this->map(Blocks::CARVED_PUMPKIN(),
function(CarvedPumpkin $block) : Writer{
1206 return Writer::create(Ids::CARVED_PUMPKIN)
1207 ->writeCardinalHorizontalFacing($block->getFacing());
1209 $this->map(Blocks::CAVE_VINES(),
function(CaveVines $block) : Writer{
1211 return Writer::create($block->hasBerries() ?
1213 Ids::CAVE_VINES_HEAD_WITH_BERRIES :
1214 Ids::CAVE_VINES_BODY_WITH_BERRIES
1218 ->writeInt(StateNames::GROWING_PLANT_AGE, $block->getAge());
1220 $this->map(Blocks::CHAIN(),
function(Chain $block) : Writer{
1221 return Writer::create(Ids::CHAIN)
1222 ->writePillarAxis($block->getAxis());
1224 $this->map(Blocks::CHEST(),
function(Chest $block) : Writer{
1225 return Writer::create(Ids::CHEST)
1226 ->writeCardinalHorizontalFacing($block->getFacing());
1228 $this->map(Blocks::CHISELED_BOOKSHELF(),
function(ChiseledBookshelf $block) : Writer{
1230 foreach($block->getSlots() as $slot){
1231 $flags |= 1 << $slot->value;
1233 return Writer::create(Ids::CHISELED_BOOKSHELF)
1234 ->writeLegacyHorizontalFacing($block->getFacing())
1235 ->writeInt(StateNames::BOOKS_STORED, $flags);
1237 $this->map(Blocks::CHISELED_QUARTZ(), fn(SimplePillar $block) => Helper::encodeQuartz($block->getAxis(), Writer::create(Ids::CHISELED_QUARTZ_BLOCK)));
1238 $this->map(Blocks::CHORUS_FLOWER(),
function(ChorusFlower $block) : Writer{
1239 return Writer::create(Ids::CHORUS_FLOWER)
1240 ->writeInt(StateNames::AGE, $block->getAge());
1242 $this->mapSlab(Blocks::COBBLED_DEEPSLATE_SLAB(), Ids::COBBLED_DEEPSLATE_SLAB, Ids::COBBLED_DEEPSLATE_DOUBLE_SLAB);
1243 $this->mapStairs(Blocks::COBBLED_DEEPSLATE_STAIRS(), Ids::COBBLED_DEEPSLATE_STAIRS);
1244 $this->map(Blocks::COBBLED_DEEPSLATE_WALL(), fn(Wall $block) => Helper::encodeWall($block,
new Writer(Ids::COBBLED_DEEPSLATE_WALL)));
1245 $this->mapSlab(Blocks::COBBLESTONE_SLAB(), Ids::COBBLESTONE_SLAB, Ids::COBBLESTONE_DOUBLE_SLAB);
1246 $this->mapStairs(Blocks::COBBLESTONE_STAIRS(), Ids::STONE_STAIRS);
1247 $this->map(Blocks::COBBLESTONE_WALL(), fn(Wall $block) => Helper::encodeWall($block, Writer::create(Ids::COBBLESTONE_WALL)));
1248 $this->map(Blocks::COPPER(),
function(Copper $block) : Writer{
1249 $oxidation = $block->getOxidation();
1250 return new Writer($block->isWaxed() ?
1251 Helper::selectCopperId($oxidation, Ids::WAXED_COPPER, Ids::WAXED_EXPOSED_COPPER, Ids::WAXED_WEATHERED_COPPER, Ids::WAXED_OXIDIZED_COPPER) :
1252 Helper::selectCopperId($oxidation, Ids::COPPER_BLOCK, Ids::EXPOSED_COPPER, Ids::WEATHERED_COPPER, Ids::OXIDIZED_COPPER)
1255 $this->map(Blocks::CHISELED_COPPER(),
function(Copper $block) : Writer{
1256 $oxidation = $block->getOxidation();
1257 return new Writer($block->isWaxed() ?
1258 Helper::selectCopperId($oxidation,
1259 Ids::WAXED_CHISELED_COPPER,
1260 Ids::WAXED_EXPOSED_CHISELED_COPPER,
1261 Ids::WAXED_WEATHERED_CHISELED_COPPER,
1262 Ids::WAXED_OXIDIZED_CHISELED_COPPER
1264 Helper::selectCopperId($oxidation,
1265 Ids::CHISELED_COPPER,
1266 Ids::EXPOSED_CHISELED_COPPER,
1267 Ids::WEATHERED_CHISELED_COPPER,
1268 Ids::OXIDIZED_CHISELED_COPPER
1272 $this->map(Blocks::COPPER_GRATE(),
function(CopperGrate $block) : Writer{
1273 $oxidation = $block->getOxidation();
1274 return new Writer($block->isWaxed() ?
1275 Helper::selectCopperId($oxidation,
1276 Ids::WAXED_COPPER_GRATE,
1277 Ids::WAXED_EXPOSED_COPPER_GRATE,
1278 Ids::WAXED_WEATHERED_COPPER_GRATE,
1279 Ids::WAXED_OXIDIZED_COPPER_GRATE
1281 Helper::selectCopperId($oxidation,
1283 Ids::EXPOSED_COPPER_GRATE,
1284 Ids::WEATHERED_COPPER_GRATE,
1285 Ids::OXIDIZED_COPPER_GRATE
1289 $this->map(Blocks::CUT_COPPER(),
function(Copper $block) : Writer{
1290 $oxidation = $block->getOxidation();
1291 return new Writer($block->isWaxed() ?
1292 Helper::selectCopperId($oxidation, Ids::WAXED_CUT_COPPER, Ids::WAXED_EXPOSED_CUT_COPPER, Ids::WAXED_WEATHERED_CUT_COPPER, Ids::WAXED_OXIDIZED_CUT_COPPER) :
1293 Helper::selectCopperId($oxidation, Ids::CUT_COPPER, Ids::EXPOSED_CUT_COPPER, Ids::WEATHERED_CUT_COPPER, Ids::OXIDIZED_CUT_COPPER)
1296 $this->map(Blocks::CUT_COPPER_SLAB(),
function(CopperSlab $block) : Writer{
1297 $oxidation = $block->getOxidation();
1298 return Helper::encodeSlab(
1300 ($block->isWaxed() ?
1301 Helper::selectCopperId(
1303 Ids::WAXED_CUT_COPPER_SLAB,
1304 Ids::WAXED_EXPOSED_CUT_COPPER_SLAB,
1305 Ids::WAXED_WEATHERED_CUT_COPPER_SLAB,
1306 Ids::WAXED_OXIDIZED_CUT_COPPER_SLAB
1308 Helper::selectCopperId(
1310 Ids::CUT_COPPER_SLAB,
1311 Ids::EXPOSED_CUT_COPPER_SLAB,
1312 Ids::WEATHERED_CUT_COPPER_SLAB,
1313 Ids::OXIDIZED_CUT_COPPER_SLAB
1316 ($block->isWaxed() ?
1317 Helper::selectCopperId(
1319 Ids::WAXED_DOUBLE_CUT_COPPER_SLAB,
1320 Ids::WAXED_EXPOSED_DOUBLE_CUT_COPPER_SLAB,
1321 Ids::WAXED_WEATHERED_DOUBLE_CUT_COPPER_SLAB,
1322 Ids::WAXED_OXIDIZED_DOUBLE_CUT_COPPER_SLAB
1324 Helper::selectCopperId(
1326 Ids::DOUBLE_CUT_COPPER_SLAB,
1327 Ids::EXPOSED_DOUBLE_CUT_COPPER_SLAB,
1328 Ids::WEATHERED_DOUBLE_CUT_COPPER_SLAB,
1329 Ids::OXIDIZED_DOUBLE_CUT_COPPER_SLAB
1334 $this->map(Blocks::CUT_COPPER_STAIRS(),
function(CopperStairs $block) : Writer{
1335 $oxidation = $block->getOxidation();
1336 return Helper::encodeStairs(
1338 new Writer($block->isWaxed() ?
1339 Helper::selectCopperId(
1341 Ids::WAXED_CUT_COPPER_STAIRS,
1342 Ids::WAXED_EXPOSED_CUT_COPPER_STAIRS,
1343 Ids::WAXED_WEATHERED_CUT_COPPER_STAIRS,
1344 Ids::WAXED_OXIDIZED_CUT_COPPER_STAIRS
1346 Helper::selectCopperId(
1348 Ids::CUT_COPPER_STAIRS,
1349 Ids::EXPOSED_CUT_COPPER_STAIRS,
1350 Ids::WEATHERED_CUT_COPPER_STAIRS,
1351 Ids::OXIDIZED_CUT_COPPER_STAIRS
1356 $this->map(Blocks::COPPER_BULB(),
function(CopperBulb $block) : Writer{
1357 $oxidation = $block->getOxidation();
1358 return Writer::create($block->isWaxed() ?
1359 Helper::selectCopperId($oxidation,
1360 Ids::WAXED_COPPER_BULB,
1361 Ids::WAXED_EXPOSED_COPPER_BULB,
1362 Ids::WAXED_WEATHERED_COPPER_BULB,
1363 Ids::WAXED_OXIDIZED_COPPER_BULB) :
1364 Helper::selectCopperId($oxidation,
1366 Ids::EXPOSED_COPPER_BULB,
1367 Ids::WEATHERED_COPPER_BULB,
1368 Ids::OXIDIZED_COPPER_BULB
1370 ->writeBool(StateNames::LIT, $block->isLit())
1371 ->writeBool(StateNames::POWERED_BIT, $block->isPowered());
1373 $this->map(Blocks::COPPER_DOOR(),
function(CopperDoor $block) : Writer{
1374 $oxidation = $block->getOxidation();
1375 return Helper::encodeDoor(
1377 new Writer($block->isWaxed() ?
1378 Helper::selectCopperId(
1380 Ids::WAXED_COPPER_DOOR,
1381 Ids::WAXED_EXPOSED_COPPER_DOOR,
1382 Ids::WAXED_WEATHERED_COPPER_DOOR,
1383 Ids::WAXED_OXIDIZED_COPPER_DOOR
1385 Helper::selectCopperId(
1388 Ids::EXPOSED_COPPER_DOOR,
1389 Ids::WEATHERED_COPPER_DOOR,
1390 Ids::OXIDIZED_COPPER_DOOR
1395 $this->map(Blocks::COPPER_TRAPDOOR(),
function(CopperTrapdoor $block) : Writer{
1396 $oxidation = $block->getOxidation();
1397 return Helper::encodeTrapdoor(
1399 new Writer($block->isWaxed() ?
1400 Helper::selectCopperId(
1402 Ids::WAXED_COPPER_TRAPDOOR,
1403 Ids::WAXED_EXPOSED_COPPER_TRAPDOOR,
1404 Ids::WAXED_WEATHERED_COPPER_TRAPDOOR,
1405 Ids::WAXED_OXIDIZED_COPPER_TRAPDOOR
1407 Helper::selectCopperId(
1409 Ids::COPPER_TRAPDOOR,
1410 Ids::EXPOSED_COPPER_TRAPDOOR,
1411 Ids::WEATHERED_COPPER_TRAPDOOR,
1412 Ids::OXIDIZED_COPPER_TRAPDOOR
1417 $this->map(Blocks::COCOA_POD(),
function(CocoaBlock $block) : Writer{
1418 return Writer::create(Ids::COCOA)
1419 ->writeInt(StateNames::AGE, $block->getAge())
1420 ->writeLegacyHorizontalFacing(Facing::opposite($block->getFacing()));
1422 $this->map(Blocks::COMPOUND_CREATOR(), fn(ChemistryTable $block) => Helper::encodeChemistryTable($block, Writer::create(Ids::COMPOUND_CREATOR)));
1423 $this->mapSlab(Blocks::CUT_RED_SANDSTONE_SLAB(), Ids::CUT_RED_SANDSTONE_SLAB, Ids::CUT_RED_SANDSTONE_DOUBLE_SLAB);
1424 $this->mapSlab(Blocks::CUT_SANDSTONE_SLAB(), Ids::CUT_SANDSTONE_SLAB, Ids::CUT_SANDSTONE_DOUBLE_SLAB);
1425 $this->mapSlab(Blocks::DARK_PRISMARINE_SLAB(), Ids::DARK_PRISMARINE_SLAB, Ids::DARK_PRISMARINE_DOUBLE_SLAB);
1426 $this->mapStairs(Blocks::DARK_PRISMARINE_STAIRS(), Ids::DARK_PRISMARINE_STAIRS);
1427 $this->map(Blocks::DAYLIGHT_SENSOR(),
function(DaylightSensor $block) : Writer{
1428 return Writer::create($block->isInverted() ? Ids::DAYLIGHT_DETECTOR_INVERTED : Ids::DAYLIGHT_DETECTOR)
1429 ->writeInt(StateNames::REDSTONE_SIGNAL, $block->getOutputSignalStrength());
1431 $this->map(Blocks::DEEPSLATE(),
function(SimplePillar $block) : Writer{
1432 return Writer::create(Ids::DEEPSLATE)
1433 ->writePillarAxis($block->getAxis());
1435 $this->mapSlab(Blocks::DEEPSLATE_BRICK_SLAB(), Ids::DEEPSLATE_BRICK_SLAB, Ids::DEEPSLATE_BRICK_DOUBLE_SLAB);
1436 $this->mapStairs(Blocks::DEEPSLATE_BRICK_STAIRS(), Ids::DEEPSLATE_BRICK_STAIRS);
1437 $this->map(Blocks::DEEPSLATE_BRICK_WALL(), fn(Wall $block) => Helper::encodeWall($block,
new Writer(Ids::DEEPSLATE_BRICK_WALL)));
1438 $this->map(Blocks::DEEPSLATE_REDSTONE_ORE(), fn(RedstoneOre $block) =>
new Writer($block->isLit() ? Ids::LIT_DEEPSLATE_REDSTONE_ORE : Ids::DEEPSLATE_REDSTONE_ORE));
1439 $this->mapSlab(Blocks::DEEPSLATE_TILE_SLAB(), Ids::DEEPSLATE_TILE_SLAB, Ids::DEEPSLATE_TILE_DOUBLE_SLAB);
1440 $this->mapStairs(Blocks::DEEPSLATE_TILE_STAIRS(), Ids::DEEPSLATE_TILE_STAIRS);
1441 $this->map(Blocks::DEEPSLATE_TILE_WALL(), fn(Wall $block) => Helper::encodeWall($block,
new Writer(Ids::DEEPSLATE_TILE_WALL)));
1442 $this->map(Blocks::DETECTOR_RAIL(),
function(DetectorRail $block) : Writer{
1443 return Writer::create(Ids::DETECTOR_RAIL)
1444 ->writeBool(StateNames::RAIL_DATA_BIT, $block->isActivated())
1445 ->writeInt(StateNames::RAIL_DIRECTION, $block->getShape());
1447 $this->mapSlab(Blocks::DIORITE_SLAB(), Ids::DIORITE_SLAB, Ids::DIORITE_DOUBLE_SLAB);
1448 $this->mapStairs(Blocks::DIORITE_STAIRS(), Ids::DIORITE_STAIRS);
1449 $this->map(Blocks::DIORITE_WALL(), fn(Wall $block) => Helper::encodeWall($block, Writer::create(Ids::DIORITE_WALL)));
1450 $this->map(Blocks::DIRT(),
function(Dirt $block) : Writer{
1451 return Writer::create(match($block->getDirtType()){
1452 DirtType::NORMAL => Ids::DIRT,
1453 DirtType::COARSE => Ids::COARSE_DIRT,
1454 DirtType::ROOTED => Ids::DIRT_WITH_ROOTS,
1457 $this->map(Blocks::DOUBLE_TALLGRASS(), fn(DoubleTallGrass $block) => Helper::encodeDoublePlant($block, Writer::create(Ids::TALL_GRASS)));
1458 $this->map(Blocks::ELEMENT_CONSTRUCTOR(), fn(ChemistryTable $block) => Helper::encodeChemistryTable($block, Writer::create(Ids::ELEMENT_CONSTRUCTOR)));
1459 $this->map(Blocks::ENDER_CHEST(),
function(EnderChest $block) : Writer{
1460 return Writer::create(Ids::ENDER_CHEST)
1461 ->writeCardinalHorizontalFacing($block->getFacing());
1463 $this->map(Blocks::END_PORTAL_FRAME(),
function(EndPortalFrame $block) : Writer{
1464 return Writer::create(Ids::END_PORTAL_FRAME)
1465 ->writeBool(StateNames::END_PORTAL_EYE_BIT, $block->hasEye())
1466 ->writeCardinalHorizontalFacing($block->getFacing());
1468 $this->map(Blocks::END_ROD(),
function(EndRod $block) : Writer{
1469 return Writer::create(Ids::END_ROD)
1470 ->writeEndRodFacingDirection($block->getFacing());
1472 $this->mapSlab(Blocks::END_STONE_BRICK_SLAB(), Ids::END_STONE_BRICK_SLAB, Ids::END_STONE_BRICK_DOUBLE_SLAB);
1473 $this->mapStairs(Blocks::END_STONE_BRICK_STAIRS(), Ids::END_BRICK_STAIRS);
1474 $this->map(Blocks::END_STONE_BRICK_WALL(), fn(Wall $block) => Helper::encodeWall($block, Writer::create(Ids::END_STONE_BRICK_WALL)));
1475 $this->mapSlab(Blocks::FAKE_WOODEN_SLAB(), Ids::PETRIFIED_OAK_SLAB, Ids::PETRIFIED_OAK_DOUBLE_SLAB);
1476 $this->map(Blocks::FARMLAND(),
function(Farmland $block) : Writer{
1477 return Writer::create(Ids::FARMLAND)
1478 ->writeInt(StateNames::MOISTURIZED_AMOUNT, $block->getWetness());
1480 $this->map(Blocks::FIRE(),
function(Fire $block) : Writer{
1481 return Writer::create(Ids::FIRE)
1482 ->writeInt(StateNames::AGE, $block->getAge());
1484 $this->map(Blocks::FLOWER_POT(),
function() : Writer{
1485 return Writer::create(Ids::FLOWER_POT)
1486 ->writeBool(StateNames::UPDATE_BIT,
false);
1488 $this->map(Blocks::FROGLIGHT(),
function(Froglight $block){
1489 return Writer::create(match($block->getFroglightType()){
1490 FroglightType::OCHRE => Ids::OCHRE_FROGLIGHT,
1491 FroglightType::PEARLESCENT => Ids::PEARLESCENT_FROGLIGHT,
1492 FroglightType::VERDANT => Ids::VERDANT_FROGLIGHT,
1494 ->writePillarAxis($block->getAxis());
1496 $this->map(Blocks::FROSTED_ICE(),
function(FrostedIce $block) : Writer{
1497 return Writer::create(Ids::FROSTED_ICE)
1498 ->writeInt(StateNames::AGE, $block->getAge());
1500 $this->map(Blocks::FURNACE(), fn(Furnace $block) => Helper::encodeFurnace($block, Ids::FURNACE, Ids::LIT_FURNACE));
1501 $this->map(Blocks::GLOW_LICHEN(),
function(GlowLichen $block) : Writer{
1502 return Writer::create(Ids::GLOW_LICHEN)
1503 ->writeFacingFlags($block->getFaces());
1505 $this->map(Blocks::GLOWING_ITEM_FRAME(), fn(ItemFrame $block) => Helper::encodeItemFrame($block, Ids::GLOW_FRAME));
1506 $this->mapSlab(Blocks::GRANITE_SLAB(), Ids::GRANITE_SLAB, Ids::GRANITE_DOUBLE_SLAB);
1507 $this->mapStairs(Blocks::GRANITE_STAIRS(), Ids::GRANITE_STAIRS);
1508 $this->map(Blocks::GRANITE_WALL(), fn(Wall $block) => Helper::encodeWall($block, Writer::create(Ids::GRANITE_WALL)));
1509 $this->map(Blocks::GREEN_TORCH(), fn(Torch $block) => Helper::encodeTorch($block, Writer::create(Ids::COLORED_TORCH_GREEN)));
1510 $this->map(Blocks::HAY_BALE(),
function(HayBale $block) : Writer{
1511 return Writer::create(Ids::HAY_BLOCK)
1512 ->writeInt(StateNames::DEPRECATED, 0)
1513 ->writePillarAxis($block->getAxis());
1515 $this->map(Blocks::HOPPER(),
function(Hopper $block) : Writer{
1516 return Writer::create(Ids::HOPPER)
1517 ->writeBool(StateNames::TOGGLE_BIT, $block->isPowered())
1518 ->writeFacingWithoutUp($block->getFacing());
1520 $this->map(Blocks::IRON_DOOR(), fn(Door $block) => Helper::encodeDoor($block,
new Writer(Ids::IRON_DOOR)));
1521 $this->map(Blocks::IRON_TRAPDOOR(), fn(Trapdoor $block) => Helper::encodeTrapdoor($block,
new Writer(Ids::IRON_TRAPDOOR)));
1522 $this->map(Blocks::ITEM_FRAME(), fn(ItemFrame $block) => Helper::encodeItemFrame($block, Ids::FRAME));
1523 $this->map(Blocks::LAB_TABLE(), fn(ChemistryTable $block) => Helper::encodeChemistryTable($block, Writer::create(Ids::LAB_TABLE)));
1524 $this->map(Blocks::LADDER(),
function(Ladder $block) : Writer{
1525 return Writer::create(Ids::LADDER)
1526 ->writeHorizontalFacing($block->getFacing());
1528 $this->map(Blocks::LANTERN(),
function(Lantern $block) : Writer{
1529 return Writer::create(Ids::LANTERN)
1530 ->writeBool(StateNames::HANGING, $block->isHanging());
1532 $this->map(Blocks::LARGE_FERN(), fn(DoubleTallGrass $block) => Helper::encodeDoublePlant($block, Writer::create(Ids::LARGE_FERN)));
1533 $this->map(Blocks::LAVA(), fn(Lava $block) => Helper::encodeLiquid($block, Ids::LAVA, Ids::FLOWING_LAVA));
1534 $this->map(Blocks::LECTERN(),
function(Lectern $block) : Writer{
1535 return Writer::create(Ids::LECTERN)
1536 ->writeBool(StateNames::POWERED_BIT, $block->isProducingSignal())
1537 ->writeCardinalHorizontalFacing($block->getFacing());
1539 $this->map(Blocks::LEVER(),
function(Lever $block) : Writer{
1540 return Writer::create(Ids::LEVER)
1541 ->writeBool(StateNames::OPEN_BIT, $block->isActivated())
1542 ->writeString(StateNames::LEVER_DIRECTION, match($block->getFacing()){
1543 LeverFacing::DOWN_AXIS_Z => StringValues::LEVER_DIRECTION_DOWN_NORTH_SOUTH,
1544 LeverFacing::DOWN_AXIS_X => StringValues::LEVER_DIRECTION_DOWN_EAST_WEST,
1545 LeverFacing::UP_AXIS_Z => StringValues::LEVER_DIRECTION_UP_NORTH_SOUTH,
1546 LeverFacing::UP_AXIS_X => StringValues::LEVER_DIRECTION_UP_EAST_WEST,
1547 LeverFacing::NORTH => StringValues::LEVER_DIRECTION_NORTH,
1548 LeverFacing::SOUTH => StringValues::LEVER_DIRECTION_SOUTH,
1549 LeverFacing::WEST => StringValues::LEVER_DIRECTION_WEST,
1550 LeverFacing::EAST => StringValues::LEVER_DIRECTION_EAST,
1553 $this->map(Blocks::LIGHT(),
function(Light $block) : Writer{
1554 return Writer::create(match($block->getLightLevel()){
1555 0 => Ids::LIGHT_BLOCK_0,
1556 1 => Ids::LIGHT_BLOCK_1,
1557 2 => Ids::LIGHT_BLOCK_2,
1558 3 => Ids::LIGHT_BLOCK_3,
1559 4 => Ids::LIGHT_BLOCK_4,
1560 5 => Ids::LIGHT_BLOCK_5,
1561 6 => Ids::LIGHT_BLOCK_6,
1562 7 => Ids::LIGHT_BLOCK_7,
1563 8 => Ids::LIGHT_BLOCK_8,
1564 9 => Ids::LIGHT_BLOCK_9,
1565 10 => Ids::LIGHT_BLOCK_10,
1566 11 => Ids::LIGHT_BLOCK_11,
1567 12 => Ids::LIGHT_BLOCK_12,
1568 13 => Ids::LIGHT_BLOCK_13,
1569 14 => Ids::LIGHT_BLOCK_14,
1570 15 => Ids::LIGHT_BLOCK_15,
1571 default => throw new BlockStateSerializeException(
"Invalid light level " . $block->getLightLevel()),
1574 $this->map(Blocks::LIGHTNING_ROD(),
function(LightningRod $block) : Writer{
1575 return Writer::create(Ids::LIGHTNING_ROD)
1576 ->writeFacingDirection($block->getFacing());
1578 $this->map(Blocks::LILAC(), fn(DoublePlant $block) => Helper::encodeDoublePlant($block, Writer::create(Ids::LILAC)));
1579 $this->map(Blocks::LIT_PUMPKIN(),
function(LitPumpkin $block) : Writer{
1580 return Writer::create(Ids::LIT_PUMPKIN)
1581 ->writeCardinalHorizontalFacing($block->getFacing());
1583 $this->map(Blocks::LOOM(),
function(Loom $block) : Writer{
1584 return Writer::create(Ids::LOOM)
1585 ->writeLegacyHorizontalFacing($block->getFacing());
1587 $this->map(Blocks::MATERIAL_REDUCER(), fn(ChemistryTable $block) => Helper::encodeChemistryTable($block, Writer::create(Ids::MATERIAL_REDUCER)));
1588 $this->map(Blocks::MELON_STEM(), fn(MelonStem $block) => Helper::encodeStem($block,
new Writer(Ids::MELON_STEM)));
1589 $this->mapSlab(Blocks::MOSSY_COBBLESTONE_SLAB(), Ids::MOSSY_COBBLESTONE_SLAB, Ids::MOSSY_COBBLESTONE_DOUBLE_SLAB);
1590 $this->mapStairs(Blocks::MOSSY_COBBLESTONE_STAIRS(), Ids::MOSSY_COBBLESTONE_STAIRS);
1591 $this->map(Blocks::MOSSY_COBBLESTONE_WALL(), fn(Wall $block) => Helper::encodeWall($block, Writer::create(Ids::MOSSY_COBBLESTONE_WALL)));
1592 $this->mapSlab(Blocks::MOSSY_STONE_BRICK_SLAB(), Ids::MOSSY_STONE_BRICK_SLAB, Ids::MOSSY_STONE_BRICK_DOUBLE_SLAB);
1593 $this->mapStairs(Blocks::MOSSY_STONE_BRICK_STAIRS(), Ids::MOSSY_STONE_BRICK_STAIRS);
1594 $this->map(Blocks::MOSSY_STONE_BRICK_WALL(), fn(Wall $block) => Helper::encodeWall($block, Writer::create(Ids::MOSSY_STONE_BRICK_WALL)));
1595 $this->mapSlab(Blocks::MUD_BRICK_SLAB(), Ids::MUD_BRICK_SLAB, Ids::MUD_BRICK_DOUBLE_SLAB);
1596 $this->mapStairs(Blocks::MUD_BRICK_STAIRS(), Ids::MUD_BRICK_STAIRS);
1597 $this->map(Blocks::MUD_BRICK_WALL(), fn(Wall $block) => Helper::encodeWall($block,
new Writer(Ids::MUD_BRICK_WALL)));
1598 $this->map(Blocks::MUDDY_MANGROVE_ROOTS(), fn(SimplePillar $block) => Writer::create(Ids::MUDDY_MANGROVE_ROOTS)
1599 ->writePillarAxis($block->getAxis()));
1600 $this->map(Blocks::MUSHROOM_STEM(), fn() => Writer::create(Ids::MUSHROOM_STEM)
1601 ->writeInt(StateNames::HUGE_MUSHROOM_BITS, BlockLegacyMetadata::MUSHROOM_BLOCK_STEM));
1602 $this->mapSlab(Blocks::NETHER_BRICK_SLAB(), Ids::NETHER_BRICK_SLAB, Ids::NETHER_BRICK_DOUBLE_SLAB);
1603 $this->mapStairs(Blocks::NETHER_BRICK_STAIRS(), Ids::NETHER_BRICK_STAIRS);
1604 $this->map(Blocks::NETHER_BRICK_WALL(), fn(Wall $block) => Helper::encodeWall($block, Writer::create(Ids::NETHER_BRICK_WALL)));
1605 $this->map(Blocks::NETHER_PORTAL(),
function(NetherPortal $block) : Writer{
1606 return Writer::create(Ids::PORTAL)
1607 ->writeString(StateNames::PORTAL_AXIS, match($block->getAxis()){
1608 Axis::X => StringValues::PORTAL_AXIS_X,
1609 Axis::Z => StringValues::PORTAL_AXIS_Z,
1610 default => throw new BlockStateSerializeException(
"Invalid Nether Portal axis " . $block->getAxis()),
1613 $this->map(Blocks::NETHER_WART(),
function(NetherWartPlant $block) : Writer{
1614 return Writer::create(Ids::NETHER_WART)
1615 ->writeInt(StateNames::AGE, $block->getAge());
1617 $this->map(Blocks::PEONY(), fn(DoublePlant $block) => Helper::encodeDoublePlant($block, Writer::create(Ids::PEONY)));
1618 $this->map(Blocks::PINK_PETALS(),
function(PinkPetals $block) : Writer{
1619 return Writer::create(Ids::PINK_PETALS)
1620 ->writeCardinalHorizontalFacing($block->getFacing())
1621 ->writeInt(StateNames::GROWTH, $block->getCount() - 1);
1623 $this->map(Blocks::PITCHER_PLANT(),
function(DoublePlant $block) : Writer{
1624 return Writer::create(Ids::PITCHER_PLANT)
1625 ->writeBool(StateNames::UPPER_BLOCK_BIT, $block->isTop());
1627 $this->map(Blocks::PITCHER_CROP(),
function(PitcherCrop $block) : Writer{
1628 return Writer::create(Ids::PITCHER_CROP)
1629 ->writeInt(StateNames::GROWTH, $block->getAge())
1630 ->writeBool(StateNames::UPPER_BLOCK_BIT,
false);
1632 $this->map(Blocks::DOUBLE_PITCHER_CROP(),
function(DoublePitcherCrop $block) : Writer{
1633 return Writer::create(Ids::PITCHER_CROP)
1634 ->writeInt(StateNames::GROWTH, $block->getAge() + 1 + PitcherCrop::MAX_AGE)
1635 ->writeBool(StateNames::UPPER_BLOCK_BIT, $block->isTop());
1637 $this->mapSlab(Blocks::POLISHED_ANDESITE_SLAB(), Ids::POLISHED_ANDESITE_SLAB, Ids::POLISHED_ANDESITE_DOUBLE_SLAB);
1638 $this->mapStairs(Blocks::POLISHED_ANDESITE_STAIRS(), Ids::POLISHED_ANDESITE_STAIRS);
1639 $this->map(Blocks::POLISHED_BASALT(),
function(SimplePillar $block) : Writer{
1640 return Writer::create(Ids::POLISHED_BASALT)
1641 ->writePillarAxis($block->getAxis());
1643 $this->mapSlab(Blocks::POLISHED_BLACKSTONE_BRICK_SLAB(), Ids::POLISHED_BLACKSTONE_BRICK_SLAB, Ids::POLISHED_BLACKSTONE_BRICK_DOUBLE_SLAB);
1644 $this->mapStairs(Blocks::POLISHED_BLACKSTONE_BRICK_STAIRS(), Ids::POLISHED_BLACKSTONE_BRICK_STAIRS);
1645 $this->map(Blocks::POLISHED_BLACKSTONE_BRICK_WALL(), fn(Wall $block) => Helper::encodeWall($block,
new Writer(Ids::POLISHED_BLACKSTONE_BRICK_WALL)));
1646 $this->map(Blocks::POLISHED_BLACKSTONE_BUTTON(), fn(Button $block) => Helper::encodeButton($block,
new Writer(Ids::POLISHED_BLACKSTONE_BUTTON)));
1647 $this->map(Blocks::POLISHED_BLACKSTONE_PRESSURE_PLATE(), fn(SimplePressurePlate $block) => Helper::encodeSimplePressurePlate($block,
new Writer(Ids::POLISHED_BLACKSTONE_PRESSURE_PLATE)));
1648 $this->mapSlab(Blocks::POLISHED_BLACKSTONE_SLAB(), Ids::POLISHED_BLACKSTONE_SLAB, Ids::POLISHED_BLACKSTONE_DOUBLE_SLAB);
1649 $this->mapStairs(Blocks::POLISHED_BLACKSTONE_STAIRS(), Ids::POLISHED_BLACKSTONE_STAIRS);
1650 $this->map(Blocks::POLISHED_BLACKSTONE_WALL(), fn(Wall $block) => Helper::encodeWall($block,
new Writer(Ids::POLISHED_BLACKSTONE_WALL)));
1651 $this->mapSlab(Blocks::POLISHED_DEEPSLATE_SLAB(), Ids::POLISHED_DEEPSLATE_SLAB, Ids::POLISHED_DEEPSLATE_DOUBLE_SLAB);
1652 $this->mapStairs(Blocks::POLISHED_DEEPSLATE_STAIRS(), Ids::POLISHED_DEEPSLATE_STAIRS);
1653 $this->map(Blocks::POLISHED_DEEPSLATE_WALL(), fn(Wall $block) => Helper::encodeWall($block,
new Writer(Ids::POLISHED_DEEPSLATE_WALL)));
1654 $this->mapSlab(Blocks::POLISHED_DIORITE_SLAB(), Ids::POLISHED_DIORITE_SLAB, Ids::POLISHED_DIORITE_DOUBLE_SLAB);
1655 $this->mapStairs(Blocks::POLISHED_DIORITE_STAIRS(), Ids::POLISHED_DIORITE_STAIRS);
1656 $this->mapSlab(Blocks::POLISHED_GRANITE_SLAB(), Ids::POLISHED_GRANITE_SLAB, Ids::POLISHED_GRANITE_DOUBLE_SLAB);
1657 $this->mapStairs(Blocks::POLISHED_GRANITE_STAIRS(), Ids::POLISHED_GRANITE_STAIRS);
1658 $this->mapSlab(Blocks::POLISHED_TUFF_SLAB(), Ids::POLISHED_TUFF_SLAB, Ids::POLISHED_TUFF_DOUBLE_SLAB);
1659 $this->mapStairs(Blocks::POLISHED_TUFF_STAIRS(), Ids::POLISHED_TUFF_STAIRS);
1660 $this->map(Blocks::POLISHED_TUFF_WALL(), fn(Wall $block) => Helper::encodeWall($block,
new Writer(Ids::POLISHED_TUFF_WALL)));
1661 $this->map(Blocks::POTATOES(), fn(Potato $block) => Helper::encodeCrops($block,
new Writer(Ids::POTATOES)));
1662 $this->map(Blocks::POWERED_RAIL(),
function(PoweredRail $block) : Writer{
1663 return Writer::create(Ids::GOLDEN_RAIL)
1664 ->writeBool(StateNames::RAIL_DATA_BIT, $block->isPowered())
1665 ->writeInt(StateNames::RAIL_DIRECTION, $block->getShape());
1667 $this->mapSlab(Blocks::PRISMARINE_BRICKS_SLAB(), Ids::PRISMARINE_BRICK_SLAB, Ids::PRISMARINE_BRICK_DOUBLE_SLAB);
1668 $this->mapStairs(Blocks::PRISMARINE_BRICKS_STAIRS(), Ids::PRISMARINE_BRICKS_STAIRS);
1669 $this->mapSlab(Blocks::PRISMARINE_SLAB(), Ids::PRISMARINE_SLAB, Ids::PRISMARINE_DOUBLE_SLAB);
1670 $this->mapStairs(Blocks::PRISMARINE_STAIRS(), Ids::PRISMARINE_STAIRS);
1671 $this->map(Blocks::PRISMARINE_WALL(), fn(Wall $block) => Helper::encodeWall($block, Writer::create(Ids::PRISMARINE_WALL)));
1672 $this->map(Blocks::PUMPKIN(),
function() : Writer{
1673 return Writer::create(Ids::PUMPKIN)
1674 ->writeCardinalHorizontalFacing(Facing::SOUTH);
1676 $this->map(Blocks::PUMPKIN_STEM(), fn(PumpkinStem $block) => Helper::encodeStem($block,
new Writer(Ids::PUMPKIN_STEM)));
1677 $this->map(Blocks::PURPUR(), fn() => Writer::create(Ids::PURPUR_BLOCK)->writePillarAxis(Axis::Y));
1678 $this->map(Blocks::PURPLE_TORCH(), fn(Torch $block) => Helper::encodeTorch($block, Writer::create(Ids::COLORED_TORCH_PURPLE)));
1679 $this->map(Blocks::PURPUR_PILLAR(),
function(SimplePillar $block) : Writer{
1680 return Writer::create(Ids::PURPUR_PILLAR)
1681 ->writePillarAxis($block->getAxis());
1683 $this->mapSlab(Blocks::PURPUR_SLAB(), Ids::PURPUR_SLAB, Ids::PURPUR_DOUBLE_SLAB);
1684 $this->mapStairs(Blocks::PURPUR_STAIRS(), Ids::PURPUR_STAIRS);
1685 $this->map(Blocks::QUARTZ(), fn() => Helper::encodeQuartz(Axis::Y, Writer::create(Ids::QUARTZ_BLOCK)));
1686 $this->map(Blocks::QUARTZ_PILLAR(), fn(SimplePillar $block) => Helper::encodeQuartz($block->getAxis(), Writer::create(Ids::QUARTZ_PILLAR)));
1687 $this->mapSlab(Blocks::QUARTZ_SLAB(), Ids::QUARTZ_SLAB, Ids::QUARTZ_DOUBLE_SLAB);
1688 $this->mapStairs(Blocks::QUARTZ_STAIRS(), Ids::QUARTZ_STAIRS);
1689 $this->map(Blocks::RAIL(),
function(Rail $block) : Writer{
1690 return Writer::create(Ids::RAIL)
1691 ->writeInt(StateNames::RAIL_DIRECTION, $block->getShape());
1693 $this->map(Blocks::REDSTONE_COMPARATOR(),
function(RedstoneComparator $block) : Writer{
1694 return Writer::create($block->isPowered() ? Ids::POWERED_COMPARATOR : Ids::UNPOWERED_COMPARATOR)
1695 ->writeBool(StateNames::OUTPUT_LIT_BIT, $block->isPowered())
1696 ->writeBool(StateNames::OUTPUT_SUBTRACT_BIT, $block->isSubtractMode())
1697 ->writeCardinalHorizontalFacing($block->getFacing());
1699 $this->map(Blocks::REDSTONE_LAMP(), fn(RedstoneLamp $block) =>
new Writer($block->isPowered() ? Ids::LIT_REDSTONE_LAMP : Ids::REDSTONE_LAMP));
1700 $this->map(Blocks::REDSTONE_ORE(), fn(RedstoneOre $block) =>
new Writer($block->isLit() ? Ids::LIT_REDSTONE_ORE : Ids::REDSTONE_ORE));
1701 $this->map(Blocks::REDSTONE_REPEATER(),
function(RedstoneRepeater $block) : Writer{
1702 return Writer::create($block->isPowered() ? Ids::POWERED_REPEATER : Ids::UNPOWERED_REPEATER)
1703 ->writeCardinalHorizontalFacing($block->getFacing())
1704 ->writeInt(StateNames::REPEATER_DELAY, $block->getDelay() - 1);
1706 $this->map(Blocks::REDSTONE_TORCH(),
function(RedstoneTorch $block) : Writer{
1707 return Writer::create($block->isLit() ? Ids::REDSTONE_TORCH : Ids::UNLIT_REDSTONE_TORCH)
1708 ->writeTorchFacing($block->getFacing());
1710 $this->map(Blocks::REDSTONE_WIRE(),
function(RedstoneWire $block) : Writer{
1711 return Writer::create(Ids::REDSTONE_WIRE)
1712 ->writeInt(StateNames::REDSTONE_SIGNAL, $block->getOutputSignalStrength());
1714 $this->map(Blocks::RED_MUSHROOM_BLOCK(), fn(RedMushroomBlock $block) => Helper::encodeMushroomBlock($block,
new Writer(Ids::RED_MUSHROOM_BLOCK)));
1715 $this->mapSlab(Blocks::RED_NETHER_BRICK_SLAB(), Ids::RED_NETHER_BRICK_SLAB, Ids::RED_NETHER_BRICK_DOUBLE_SLAB);
1716 $this->mapStairs(Blocks::RED_NETHER_BRICK_STAIRS(), Ids::RED_NETHER_BRICK_STAIRS);
1717 $this->map(Blocks::RED_NETHER_BRICK_WALL(), fn(Wall $block) => Helper::encodeWall($block, Writer::create(Ids::RED_NETHER_BRICK_WALL)));
1718 $this->mapSlab(Blocks::RED_SANDSTONE_SLAB(), Ids::RED_SANDSTONE_SLAB, Ids::RED_SANDSTONE_DOUBLE_SLAB);
1719 $this->mapStairs(Blocks::RED_SANDSTONE_STAIRS(), Ids::RED_SANDSTONE_STAIRS);
1720 $this->map(Blocks::RED_SANDSTONE_WALL(), fn(Wall $block) => Helper::encodeWall($block, Writer::create(Ids::RED_SANDSTONE_WALL)));
1721 $this->map(Blocks::RED_TORCH(), fn(Torch $block) => Helper::encodeTorch($block, Writer::create(Ids::COLORED_TORCH_RED)));
1722 $this->map(Blocks::ROSE_BUSH(), fn(DoublePlant $block) => Helper::encodeDoublePlant($block, Writer::create(Ids::ROSE_BUSH)));
1723 $this->mapSlab(Blocks::SANDSTONE_SLAB(), Ids::SANDSTONE_SLAB, Ids::SANDSTONE_DOUBLE_SLAB);
1724 $this->mapStairs(Blocks::SANDSTONE_STAIRS(), Ids::SANDSTONE_STAIRS);
1725 $this->map(Blocks::SANDSTONE_WALL(), fn(Wall $block) => Helper::encodeWall($block, Writer::create(Ids::SANDSTONE_WALL)));
1726 $this->map(Blocks::SEA_PICKLE(),
function(SeaPickle $block) : Writer{
1727 return Writer::create(Ids::SEA_PICKLE)
1728 ->writeBool(StateNames::DEAD_BIT, !$block->isUnderwater())
1729 ->writeInt(StateNames::CLUSTER_COUNT, $block->getCount() - 1);
1731 $this->map(Blocks::SMALL_DRIPLEAF(),
function(SmallDripleaf $block) : Writer{
1732 return Writer::create(Ids::SMALL_DRIPLEAF_BLOCK)
1733 ->writeCardinalHorizontalFacing($block->getFacing())
1734 ->writeBool(StateNames::UPPER_BLOCK_BIT, $block->isTop());
1736 $this->map(Blocks::SMOKER(), fn(Furnace $block) => Helper::encodeFurnace($block, Ids::SMOKER, Ids::LIT_SMOKER));
1737 $this->map(Blocks::SMOOTH_QUARTZ(), fn() => Helper::encodeQuartz(Axis::Y, Writer::create(Ids::SMOOTH_QUARTZ)));
1738 $this->mapSlab(Blocks::SMOOTH_QUARTZ_SLAB(), Ids::SMOOTH_QUARTZ_SLAB, Ids::SMOOTH_QUARTZ_DOUBLE_SLAB);
1739 $this->mapStairs(Blocks::SMOOTH_QUARTZ_STAIRS(), Ids::SMOOTH_QUARTZ_STAIRS);
1740 $this->mapSlab(Blocks::SMOOTH_RED_SANDSTONE_SLAB(), Ids::SMOOTH_RED_SANDSTONE_SLAB, Ids::SMOOTH_RED_SANDSTONE_DOUBLE_SLAB);
1741 $this->mapStairs(Blocks::SMOOTH_RED_SANDSTONE_STAIRS(), Ids::SMOOTH_RED_SANDSTONE_STAIRS);
1742 $this->mapSlab(Blocks::SMOOTH_SANDSTONE_SLAB(), Ids::SMOOTH_SANDSTONE_SLAB, Ids::SMOOTH_SANDSTONE_DOUBLE_SLAB);
1743 $this->mapStairs(Blocks::SMOOTH_SANDSTONE_STAIRS(), Ids::SMOOTH_SANDSTONE_STAIRS);
1744 $this->mapSlab(Blocks::SMOOTH_STONE_SLAB(), Ids::SMOOTH_STONE_SLAB, Ids::SMOOTH_STONE_DOUBLE_SLAB);
1745 $this->map(Blocks::SNOW_LAYER(),
function(SnowLayer $block) : Writer{
1746 return Writer::create(Ids::SNOW_LAYER)
1747 ->writeBool(StateNames::COVERED_BIT,
false)
1748 ->writeInt(StateNames::HEIGHT, $block->getLayers() - 1);
1750 $this->map(Blocks::SOUL_CAMPFIRE(),
function(SoulCampfire $block) : Writer{
1751 return Writer::create(Ids::SOUL_CAMPFIRE)
1752 ->writeCardinalHorizontalFacing($block->getFacing())
1753 ->writeBool(StateNames::EXTINGUISHED, !$block->isLit());
1755 $this->map(Blocks::SOUL_FIRE(),
function() : Writer{
1756 return Writer::create(Ids::SOUL_FIRE)
1757 ->writeInt(StateNames::AGE, 0);
1759 $this->map(Blocks::SOUL_LANTERN(),
function(Lantern $block) : Writer{
1760 return Writer::create(Ids::SOUL_LANTERN)
1761 ->writeBool(StateNames::HANGING, $block->isHanging());
1763 $this->map(Blocks::SOUL_TORCH(),
function(Torch $block) : Writer{
1764 return Writer::create(Ids::SOUL_TORCH)
1765 ->writeTorchFacing($block->getFacing());
1767 $this->map(Blocks::SPONGE(), fn(Sponge $block) => Writer::create($block->isWet() ? Ids::WET_SPONGE : Ids::SPONGE));
1768 $this->map(Blocks::STONECUTTER(), fn(Stonecutter $block) => Writer::create(Ids::STONECUTTER_BLOCK)
1769 ->writeCardinalHorizontalFacing($block->getFacing()));
1770 $this->mapSlab(Blocks::STONE_BRICK_SLAB(), Ids::STONE_BRICK_SLAB, Ids::STONE_BRICK_DOUBLE_SLAB);
1771 $this->mapStairs(Blocks::STONE_BRICK_STAIRS(), Ids::STONE_BRICK_STAIRS);
1772 $this->map(Blocks::STONE_BRICK_WALL(), fn(Wall $block) => Helper::encodeWall($block, Writer::create(Ids::STONE_BRICK_WALL)));
1773 $this->map(Blocks::STONE_BUTTON(), fn(StoneButton $block) => Helper::encodeButton($block,
new Writer(Ids::STONE_BUTTON)));
1774 $this->map(Blocks::STONE_PRESSURE_PLATE(), fn(StonePressurePlate $block) => Helper::encodeSimplePressurePlate($block,
new Writer(Ids::STONE_PRESSURE_PLATE)));
1775 $this->mapSlab(Blocks::STONE_SLAB(), Ids::NORMAL_STONE_SLAB, Ids::NORMAL_STONE_DOUBLE_SLAB);
1776 $this->mapStairs(Blocks::STONE_STAIRS(), Ids::NORMAL_STONE_STAIRS);
1777 $this->map(Blocks::SUGARCANE(),
function(Sugarcane $block) : Writer{
1778 return Writer::create(Ids::REEDS)
1779 ->writeInt(StateNames::AGE, $block->getAge());
1781 $this->map(Blocks::SUNFLOWER(), fn(DoublePlant $block) => Helper::encodeDoublePlant($block, Writer::create(Ids::SUNFLOWER)));
1782 $this->map(Blocks::SWEET_BERRY_BUSH(),
function(SweetBerryBush $block) : Writer{
1783 return Writer::create(Ids::SWEET_BERRY_BUSH)
1784 ->writeInt(StateNames::GROWTH, $block->getAge());
1786 $this->map(Blocks::TNT(), fn(TNT $block) => Writer::create($block->worksUnderwater() ? Ids::UNDERWATER_TNT : Ids::TNT)
1787 ->writeBool(StateNames::EXPLODE_BIT, $block->isUnstable())
1789 $this->map(Blocks::TORCH(),
function(Torch $block) : Writer{
1790 return Writer::create(Ids::TORCH)
1791 ->writeTorchFacing($block->getFacing());
1793 $this->map(Blocks::TORCHFLOWER_CROP(),
function(TorchflowerCrop $block){
1794 return Writer::create(Ids::TORCHFLOWER_CROP)
1795 ->writeInt(StateNames::GROWTH, $block->isReady() ? 1 : 0);
1797 $this->map(Blocks::TRAPPED_CHEST(),
function(TrappedChest $block) : Writer{
1798 return Writer::create(Ids::TRAPPED_CHEST)
1799 ->writeCardinalHorizontalFacing($block->getFacing());
1801 $this->map(Blocks::TRIPWIRE(),
function(Tripwire $block) : Writer{
1802 return Writer::create(Ids::TRIP_WIRE)
1803 ->writeBool(StateNames::ATTACHED_BIT, $block->isConnected())
1804 ->writeBool(StateNames::DISARMED_BIT, $block->isDisarmed())
1805 ->writeBool(StateNames::POWERED_BIT, $block->isTriggered())
1806 ->writeBool(StateNames::SUSPENDED_BIT, $block->isSuspended());
1808 $this->map(Blocks::TRIPWIRE_HOOK(),
function(TripwireHook $block) : Writer{
1809 return Writer::create(Ids::TRIPWIRE_HOOK)
1810 ->writeBool(StateNames::ATTACHED_BIT, $block->isConnected())
1811 ->writeBool(StateNames::POWERED_BIT, $block->isPowered())
1812 ->writeLegacyHorizontalFacing($block->getFacing());
1814 $this->mapSlab(Blocks::TUFF_BRICK_SLAB(), Ids::TUFF_BRICK_SLAB, Ids::TUFF_BRICK_DOUBLE_SLAB);
1815 $this->mapStairs(Blocks::TUFF_BRICK_STAIRS(), Ids::TUFF_BRICK_STAIRS);
1816 $this->map(Blocks::TUFF_BRICK_WALL(), fn(Wall $block) => Helper::encodeWall($block,
new Writer(Ids::TUFF_BRICK_WALL)));
1817 $this->mapSlab(Blocks::TUFF_SLAB(), Ids::TUFF_SLAB, Ids::TUFF_DOUBLE_SLAB);
1818 $this->mapStairs(Blocks::TUFF_STAIRS(), Ids::TUFF_STAIRS);
1819 $this->map(Blocks::TUFF_WALL(), fn(Wall $block) => Helper::encodeWall($block,
new Writer(Ids::TUFF_WALL)));
1820 $this->map(Blocks::TWISTING_VINES(),
function(NetherVines $block) : Writer{
1821 return Writer::create(Ids::TWISTING_VINES)
1822 ->writeInt(StateNames::TWISTING_VINES_AGE, $block->getAge());
1824 $this->map(Blocks::UNDERWATER_TORCH(),
function(UnderwaterTorch $block) : Writer{
1825 return Writer::create(Ids::UNDERWATER_TORCH)
1826 ->writeTorchFacing($block->getFacing());
1828 $this->map(Blocks::VINES(),
function(Vine $block) : Writer{
1829 return Writer::create(Ids::VINE)
1830 ->writeInt(StateNames::VINE_DIRECTION_BITS, ($block->hasFace(Facing::NORTH) ? BlockLegacyMetadata::VINE_FLAG_NORTH : 0) | ($block->hasFace(Facing::SOUTH) ? BlockLegacyMetadata::VINE_FLAG_SOUTH : 0) | ($block->hasFace(Facing::WEST) ? BlockLegacyMetadata::VINE_FLAG_WEST : 0) | ($block->hasFace(Facing::EAST) ? BlockLegacyMetadata::VINE_FLAG_EAST : 0));
1832 $this->map(Blocks::WALL_BANNER(),
function(WallBanner $block) : Writer{
1833 return Writer::create(Ids::WALL_BANNER)
1834 ->writeHorizontalFacing($block->getFacing());
1836 $this->map(Blocks::WATER(), fn(Water $block) => Helper::encodeLiquid($block, Ids::WATER, Ids::FLOWING_WATER));
1837 $this->map(Blocks::WEEPING_VINES(),
function(NetherVines $block) : Writer{
1838 return Writer::create(Ids::WEEPING_VINES)
1839 ->writeInt(StateNames::WEEPING_VINES_AGE, $block->getAge());
1841 $this->map(Blocks::WEIGHTED_PRESSURE_PLATE_HEAVY(),
function(WeightedPressurePlate $block) : Writer{
1842 return Writer::create(Ids::HEAVY_WEIGHTED_PRESSURE_PLATE)
1843 ->writeInt(StateNames::REDSTONE_SIGNAL, $block->getOutputSignalStrength());
1845 $this->map(Blocks::WEIGHTED_PRESSURE_PLATE_LIGHT(),
function(WeightedPressurePlate $block) : Writer{
1846 return Writer::create(Ids::LIGHT_WEIGHTED_PRESSURE_PLATE)
1847 ->writeInt(StateNames::REDSTONE_SIGNAL, $block->getOutputSignalStrength());
1849 $this->map(Blocks::WHEAT(), fn(Wheat $block) => Helper::encodeCrops($block,
new Writer(Ids::WHEAT)));