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