Move simple block (de)serializer registrations into their own functions

This commit is contained in:
Dylan K. Taylor 2022-07-18 18:47:30 +01:00
parent 6d4279671e
commit b0a492c063
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
2 changed files with 769 additions and 761 deletions

View File

@ -60,6 +60,7 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
public function __construct(){ public function __construct(){
$this->registerCandleDeserializers(); $this->registerCandleDeserializers();
$this->registerSimpleDeserializers();
$this->registerDeserializers(); $this->registerDeserializers();
} }
@ -135,151 +136,20 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
$this->map(Ids::YELLOW_CANDLE_CAKE, $cakeWithDyedCandleDeserializer(DyeColor::YELLOW())); $this->map(Ids::YELLOW_CANDLE_CAKE, $cakeWithDyedCandleDeserializer(DyeColor::YELLOW()));
} }
private function registerDeserializers() : void{ private function registerSimpleDeserializers() : void{
$this->map(Ids::ACACIA_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::ACACIA_BUTTON(), $in));
$this->map(Ids::ACACIA_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::ACACIA_DOOR(), $in));
$this->map(Ids::ACACIA_FENCE_GATE, fn(Reader $in) => Helper::decodeFenceGate(Blocks::ACACIA_FENCE_GATE(), $in));
$this->map(Ids::ACACIA_PRESSURE_PLATE, fn(Reader $in) => Helper::decodeSimplePressurePlate(Blocks::ACACIA_PRESSURE_PLATE(), $in));
$this->mapStairs(Ids::ACACIA_STAIRS, fn() => Blocks::ACACIA_STAIRS());
$this->map(Ids::ACACIA_STANDING_SIGN, fn(Reader $in) => Helper::decodeFloorSign(Blocks::ACACIA_SIGN(), $in));
$this->map(Ids::ACACIA_TRAPDOOR, fn(Reader $in) => Helper::decodeTrapdoor(Blocks::ACACIA_TRAPDOOR(), $in));
$this->map(Ids::ACACIA_WALL_SIGN, fn(Reader $in) => Helper::decodeWallSign(Blocks::ACACIA_WALL_SIGN(), $in));
$this->map(Ids::ACTIVATOR_RAIL, function(Reader $in) : Block{
return Blocks::ACTIVATOR_RAIL()
->setPowered($in->readBool(StateNames::RAIL_DATA_BIT))
->setShape($in->readBoundedInt(StateNames::RAIL_DIRECTION, 0, 5));
});
$this->map(Ids::AIR, fn() => Blocks::AIR()); $this->map(Ids::AIR, fn() => Blocks::AIR());
$this->map(Ids::AMETHYST_BLOCK, fn() => Blocks::AMETHYST()); $this->map(Ids::AMETHYST_BLOCK, fn() => Blocks::AMETHYST());
$this->map(Ids::ANCIENT_DEBRIS, fn() => Blocks::ANCIENT_DEBRIS()); $this->map(Ids::ANCIENT_DEBRIS, fn() => Blocks::ANCIENT_DEBRIS());
$this->mapStairs(Ids::ANDESITE_STAIRS, fn() => Blocks::ANDESITE_STAIRS());
$this->map(Ids::ANVIL, function(Reader $in) : Block{
return Blocks::ANVIL()
->setDamage(match($value = $in->readString(StateNames::DAMAGE)){
StringValues::DAMAGE_UNDAMAGED => 0,
StringValues::DAMAGE_SLIGHTLY_DAMAGED => 1,
StringValues::DAMAGE_VERY_DAMAGED => 2,
StringValues::DAMAGE_BROKEN => 0,
default => throw $in->badValueException(StateNames::DAMAGE, $value),
})
->setFacing($in->readLegacyHorizontalFacing());
});
$this->map(Ids::BAMBOO, function(Reader $in) : Block{
return Blocks::BAMBOO()
->setLeafSize(match($value = $in->readString(StateNames::BAMBOO_LEAF_SIZE)){
StringValues::BAMBOO_LEAF_SIZE_NO_LEAVES => Bamboo::NO_LEAVES,
StringValues::BAMBOO_LEAF_SIZE_SMALL_LEAVES => Bamboo::SMALL_LEAVES,
StringValues::BAMBOO_LEAF_SIZE_LARGE_LEAVES => Bamboo::LARGE_LEAVES,
default => throw $in->badValueException(StateNames::BAMBOO_LEAF_SIZE, $value),
})
->setReady($in->readBool(StateNames::AGE_BIT))
->setThick(match($value = $in->readString(StateNames::BAMBOO_STALK_THICKNESS)){
StringValues::BAMBOO_STALK_THICKNESS_THIN => false,
StringValues::BAMBOO_STALK_THICKNESS_THICK => true,
default => throw $in->badValueException(StateNames::BAMBOO_STALK_THICKNESS, $value),
});
});
$this->map(Ids::BAMBOO_SAPLING, function(Reader $in) : Block{
$in->ignored(StateNames::SAPLING_TYPE); //bug in MCPE
return Blocks::BAMBOO_SAPLING()->setReady($in->readBool(StateNames::AGE_BIT));
});
$this->map(Ids::BARREL, function(Reader $in) : Block{
return Blocks::BARREL()
->setFacing($in->readFacingDirection())
->setOpen($in->readBool(StateNames::OPEN_BIT));
});
$this->map(Ids::BARRIER, fn() => Blocks::BARRIER()); $this->map(Ids::BARRIER, fn() => Blocks::BARRIER());
$this->map(Ids::BASALT, function(Reader $in){
return Blocks::BASALT()
->setAxis($in->readPillarAxis());
});
$this->map(Ids::BEACON, fn() => Blocks::BEACON()); $this->map(Ids::BEACON, fn() => Blocks::BEACON());
$this->map(Ids::BED, function(Reader $in) : Block{
return Blocks::BED()
->setFacing($in->readLegacyHorizontalFacing())
->setHead($in->readBool(StateNames::HEAD_PIECE_BIT))
->setOccupied($in->readBool(StateNames::OCCUPIED_BIT));
});
$this->map(Ids::BEDROCK, function(Reader $in) : Block{
return Blocks::BEDROCK()
->setBurnsForever($in->readBool(StateNames::INFINIBURN_BIT));
});
$this->map(Ids::BEETROOT, fn(Reader $in) => Helper::decodeCrops(Blocks::BEETROOTS(), $in));
$this->map(Ids::BELL, function(Reader $in) : Block{
$in->ignored(StateNames::TOGGLE_BIT); //only useful at runtime
return Blocks::BELL()
->setFacing($in->readLegacyHorizontalFacing())
->setAttachmentType($in->readBellAttachmentType());
});
$this->map(Ids::BIRCH_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::BIRCH_BUTTON(), $in));
$this->map(Ids::BIRCH_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::BIRCH_DOOR(), $in));
$this->map(Ids::BIRCH_FENCE_GATE, fn(Reader $in) => Helper::decodeFenceGate(Blocks::BIRCH_FENCE_GATE(), $in));
$this->map(Ids::BIRCH_PRESSURE_PLATE, fn(Reader $in) => Helper::decodeSimplePressurePlate(Blocks::BIRCH_PRESSURE_PLATE(), $in));
$this->mapStairs(Ids::BIRCH_STAIRS, fn() => Blocks::BIRCH_STAIRS());
$this->map(Ids::BIRCH_STANDING_SIGN, fn(Reader $in) => Helper::decodeFloorSign(Blocks::BIRCH_SIGN(), $in));
$this->map(Ids::BIRCH_TRAPDOOR, fn(Reader $in) => Helper::decodeTrapdoor(Blocks::BIRCH_TRAPDOOR(), $in));
$this->map(Ids::BIRCH_WALL_SIGN, fn(Reader $in) => Helper::decodeWallSign(Blocks::BIRCH_WALL_SIGN(), $in));
$this->map(Ids::BLACKSTONE, fn() => Blocks::BLACKSTONE()); $this->map(Ids::BLACKSTONE, fn() => Blocks::BLACKSTONE());
$this->mapSlab(Ids::BLACKSTONE_SLAB, Ids::BLACKSTONE_DOUBLE_SLAB, fn() => Blocks::BLACKSTONE_SLAB());
$this->mapStairs(Ids::BLACKSTONE_STAIRS, fn() => Blocks::BLACKSTONE_STAIRS());
$this->map(Ids::BLACKSTONE_WALL, fn(Reader $in) => Helper::decodeWall(Blocks::BLACKSTONE_WALL(), $in));
$this->map(Ids::BLACK_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::BLACK(), $in));
$this->map(Ids::BLAST_FURNACE, function(Reader $in) : Block{
return Blocks::BLAST_FURNACE()
->setFacing($in->readHorizontalFacing())
->setLit(false);
});
$this->map(Ids::BLUE_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::BLUE(), $in));
$this->map(Ids::BLUE_ICE, fn() => Blocks::BLUE_ICE()); $this->map(Ids::BLUE_ICE, fn() => Blocks::BLUE_ICE());
$this->map(Ids::BONE_BLOCK, function(Reader $in) : Block{
$in->ignored(StateNames::DEPRECATED);
return Blocks::BONE_BLOCK()->setAxis($in->readPillarAxis());
});
$this->map(Ids::BOOKSHELF, fn() => Blocks::BOOKSHELF()); $this->map(Ids::BOOKSHELF, fn() => Blocks::BOOKSHELF());
$this->map(Ids::BREWING_STAND, function(Reader $in) : Block{
return Blocks::BREWING_STAND()
->setSlot(BrewingStandSlot::EAST(), $in->readBool(StateNames::BREWING_STAND_SLOT_A_BIT))
->setSlot(BrewingStandSlot::SOUTHWEST(), $in->readBool(StateNames::BREWING_STAND_SLOT_B_BIT))
->setSlot(BrewingStandSlot::NORTHWEST(), $in->readBool(StateNames::BREWING_STAND_SLOT_C_BIT));
});
$this->map(Ids::BRICK_BLOCK, fn() => Blocks::BRICKS()); $this->map(Ids::BRICK_BLOCK, fn() => Blocks::BRICKS());
$this->mapStairs(Ids::BRICK_STAIRS, fn() => Blocks::BRICK_STAIRS());
$this->map(Ids::BROWN_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::BROWN(), $in));
$this->map(Ids::BROWN_MUSHROOM, fn() => Blocks::BROWN_MUSHROOM()); $this->map(Ids::BROWN_MUSHROOM, fn() => Blocks::BROWN_MUSHROOM());
$this->map(Ids::BROWN_MUSHROOM_BLOCK, fn(Reader $in) => Helper::decodeMushroomBlock(Blocks::BROWN_MUSHROOM_BLOCK(), $in));
$this->map(Ids::CACTUS, function(Reader $in) : Block{
return Blocks::CACTUS()
->setAge($in->readBoundedInt(StateNames::AGE, 0, 15));
});
$this->map(Ids::CAKE, function(Reader $in) : Block{
return Blocks::CAKE()
->setBites($in->readBoundedInt(StateNames::BITE_COUNTER, 0, 6));
});
$this->map(Ids::CALCITE, fn() => Blocks::CALCITE()); $this->map(Ids::CALCITE, fn() => Blocks::CALCITE());
$this->map(Ids::CARPET, function(Reader $in) : Block{
return Blocks::CARPET()
->setColor($in->readColor());
});
$this->map(Ids::CARROTS, fn(Reader $in) => Helper::decodeCrops(Blocks::CARROTS(), $in));
$this->map(Ids::CARTOGRAPHY_TABLE, fn() => Blocks::CARTOGRAPHY_TABLE()); $this->map(Ids::CARTOGRAPHY_TABLE, fn() => Blocks::CARTOGRAPHY_TABLE());
$this->map(Ids::CARVED_PUMPKIN, function(Reader $in) : Block{
return Blocks::CARVED_PUMPKIN()
->setFacing($in->readLegacyHorizontalFacing());
});
$this->map(Ids::CHEMICAL_HEAT, fn() => Blocks::CHEMICAL_HEAT()); $this->map(Ids::CHEMICAL_HEAT, fn() => Blocks::CHEMICAL_HEAT());
$this->map(Ids::CHEMISTRY_TABLE, function(Reader $in) : Block{
return (match($type = $in->readString(StateNames::CHEMISTRY_TABLE_TYPE)){
StringValues::CHEMISTRY_TABLE_TYPE_COMPOUND_CREATOR => Blocks::COMPOUND_CREATOR(),
StringValues::CHEMISTRY_TABLE_TYPE_ELEMENT_CONSTRUCTOR => Blocks::ELEMENT_CONSTRUCTOR(),
StringValues::CHEMISTRY_TABLE_TYPE_LAB_TABLE => Blocks::LAB_TABLE(),
StringValues::CHEMISTRY_TABLE_TYPE_MATERIAL_REDUCER => Blocks::MATERIAL_REDUCER(),
default => throw $in->badValueException(StateNames::CHEMISTRY_TABLE_TYPE, $type),
})->setFacing(Facing::opposite($in->readLegacyHorizontalFacing()));
});
$this->map(Ids::CHEST, function(Reader $in) : Block{
return Blocks::CHEST()
->setFacing($in->readHorizontalFacing());
});
$this->map(Ids::CHISELED_DEEPSLATE, fn() => Blocks::CHISELED_DEEPSLATE()); $this->map(Ids::CHISELED_DEEPSLATE, fn() => Blocks::CHISELED_DEEPSLATE());
$this->map(Ids::CHISELED_NETHER_BRICKS, fn() => Blocks::CHISELED_NETHER_BRICKS()); $this->map(Ids::CHISELED_NETHER_BRICKS, fn() => Blocks::CHISELED_NETHER_BRICKS());
$this->map(Ids::CHISELED_POLISHED_BLACKSTONE, fn() => Blocks::CHISELED_POLISHED_BLACKSTONE()); $this->map(Ids::CHISELED_POLISHED_BLACKSTONE, fn() => Blocks::CHISELED_POLISHED_BLACKSTONE());
@ -287,104 +157,18 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
$this->map(Ids::COAL_BLOCK, fn() => Blocks::COAL()); $this->map(Ids::COAL_BLOCK, fn() => Blocks::COAL());
$this->map(Ids::COAL_ORE, fn() => Blocks::COAL_ORE()); $this->map(Ids::COAL_ORE, fn() => Blocks::COAL_ORE());
$this->map(Ids::COBBLED_DEEPSLATE, fn() => Blocks::COBBLED_DEEPSLATE()); $this->map(Ids::COBBLED_DEEPSLATE, fn() => Blocks::COBBLED_DEEPSLATE());
$this->mapSlab(Ids::COBBLED_DEEPSLATE_SLAB, Ids::COBBLED_DEEPSLATE_DOUBLE_SLAB, fn() => Blocks::COBBLED_DEEPSLATE_SLAB());
$this->mapStairs(Ids::COBBLED_DEEPSLATE_STAIRS, fn() => Blocks::COBBLED_DEEPSLATE_STAIRS());
$this->map(Ids::COBBLED_DEEPSLATE_WALL, fn(Reader $in) => Helper::decodeWall(Blocks::COBBLED_DEEPSLATE_WALL(), $in));
$this->map(Ids::COBBLESTONE, fn() => Blocks::COBBLESTONE()); $this->map(Ids::COBBLESTONE, fn() => Blocks::COBBLESTONE());
$this->map(Ids::COBBLESTONE_WALL, fn(Reader $in) => Helper::mapLegacyWallType($in));
$this->map(Ids::COCOA, function(Reader $in) : Block{
return Blocks::COCOA_POD()
->setAge($in->readBoundedInt(StateNames::AGE, 0, 2))
->setFacing(Facing::opposite($in->readLegacyHorizontalFacing()));
});
$this->map(Ids::COLORED_TORCH_BP, function(Reader $in) : Block{
return $in->readBool(StateNames::COLOR_BIT) ?
Blocks::PURPLE_TORCH()->setFacing($in->readTorchFacing()) :
Blocks::BLUE_TORCH()->setFacing($in->readTorchFacing());
});
$this->map(Ids::COLORED_TORCH_RG, function(Reader $in) : Block{
return $in->readBool(StateNames::COLOR_BIT) ?
Blocks::GREEN_TORCH()->setFacing($in->readTorchFacing()) :
Blocks::RED_TORCH()->setFacing($in->readTorchFacing());
});
$this->map(Ids::CONCRETE, function(Reader $in) : Block{
return Blocks::CONCRETE()
->setColor($in->readColor());
});
$this->map(Ids::CONCRETE_POWDER, function(Reader $in) : Block{
return Blocks::CONCRETE_POWDER()
->setColor($in->readColor());
});
$this->map(Ids::COPPER_BLOCK, fn() => Helper::decodeCopper(Blocks::COPPER(), CopperOxidation::NONE()));
$this->map(Ids::CUT_COPPER, fn() => Helper::decodeCopper(Blocks::CUT_COPPER(), CopperOxidation::NONE()));
$this->mapSlab(Ids::CUT_COPPER_SLAB, Ids::DOUBLE_CUT_COPPER_SLAB, fn() => Helper::decodeCopper(Blocks::CUT_COPPER_SLAB(), CopperOxidation::NONE()));
$this->mapStairs(Ids::CUT_COPPER_STAIRS, fn() => Helper::decodeCopper(Blocks::CUT_COPPER_STAIRS(), CopperOxidation::NONE()));
$this->map(Ids::COPPER_ORE, fn() => Blocks::COPPER_ORE()); $this->map(Ids::COPPER_ORE, fn() => Blocks::COPPER_ORE());
$this->map(Ids::CORAL, function(Reader $in) : Block{
return Blocks::CORAL()
->setCoralType($in->readCoralType())
->setDead($in->readBool(StateNames::DEAD_BIT));
});
$this->map(Ids::CORAL_BLOCK, function(Reader $in) : Block{
return Blocks::CORAL_BLOCK()
->setCoralType($in->readCoralType())
->setDead($in->readBool(StateNames::DEAD_BIT));
});
$this->map(Ids::CORAL_FAN, fn(Reader $in) => Helper::decodeFloorCoralFan(Blocks::CORAL_FAN(), $in)
->setDead(false));
$this->map(Ids::CORAL_FAN_DEAD, fn(Reader $in) => Helper::decodeFloorCoralFan(Blocks::CORAL_FAN(), $in)
->setDead(true));
$this->map(Ids::CORAL_FAN_HANG, fn(Reader $in) => Helper::decodeWallCoralFan(Blocks::WALL_CORAL_FAN(), $in)
->setCoralType($in->readBool(StateNames::CORAL_HANG_TYPE_BIT) ? CoralType::BRAIN() : CoralType::TUBE()));
$this->map(Ids::CORAL_FAN_HANG2, fn(Reader $in) => Helper::decodeWallCoralFan(Blocks::WALL_CORAL_FAN(), $in)
->setCoralType($in->readBool(StateNames::CORAL_HANG_TYPE_BIT) ? CoralType::FIRE() : CoralType::BUBBLE()));
$this->map(Ids::CORAL_FAN_HANG3, function(Reader $in) : Block{
$in->ignored(StateNames::CORAL_HANG_TYPE_BIT); //the game always writes this, even though it's not used
return Helper::decodeWallCoralFan(Blocks::WALL_CORAL_FAN(), $in)
->setCoralType(CoralType::HORN());
});
$this->map(Ids::CRACKED_DEEPSLATE_BRICKS, fn() => Blocks::CRACKED_DEEPSLATE_BRICKS()); $this->map(Ids::CRACKED_DEEPSLATE_BRICKS, fn() => Blocks::CRACKED_DEEPSLATE_BRICKS());
$this->map(Ids::CRACKED_DEEPSLATE_TILES, fn() => Blocks::CRACKED_DEEPSLATE_TILES()); $this->map(Ids::CRACKED_DEEPSLATE_TILES, fn() => Blocks::CRACKED_DEEPSLATE_TILES());
$this->map(Ids::CRACKED_NETHER_BRICKS, fn() => Blocks::CRACKED_NETHER_BRICKS()); $this->map(Ids::CRACKED_NETHER_BRICKS, fn() => Blocks::CRACKED_NETHER_BRICKS());
$this->map(Ids::CRACKED_POLISHED_BLACKSTONE_BRICKS, fn() => Blocks::CRACKED_POLISHED_BLACKSTONE_BRICKS()); $this->map(Ids::CRACKED_POLISHED_BLACKSTONE_BRICKS, fn() => Blocks::CRACKED_POLISHED_BLACKSTONE_BRICKS());
$this->map(Ids::CRAFTING_TABLE, fn() => Blocks::CRAFTING_TABLE()); $this->map(Ids::CRAFTING_TABLE, fn() => Blocks::CRAFTING_TABLE());
$this->map(Ids::CRIMSON_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::CRIMSON_BUTTON(), $in));
$this->map(Ids::CRIMSON_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::CRIMSON_DOOR(), $in));
$this->mapSlab(Ids::CRIMSON_SLAB, Ids::CRIMSON_DOUBLE_SLAB, fn() => Blocks::CRIMSON_SLAB());
$this->map(Ids::CRIMSON_FENCE, fn() => Blocks::CRIMSON_FENCE()); $this->map(Ids::CRIMSON_FENCE, fn() => Blocks::CRIMSON_FENCE());
$this->map(Ids::CRIMSON_FENCE_GATE, fn(Reader $in) => Helper::decodeFenceGate(Blocks::CRIMSON_FENCE_GATE(), $in));
$this->map(Ids::CRIMSON_HYPHAE, fn(Reader $in) => Helper::decodeLog(Blocks::CRIMSON_HYPHAE(), false, $in));
$this->map(Ids::CRIMSON_PLANKS, fn() => Blocks::CRIMSON_PLANKS()); $this->map(Ids::CRIMSON_PLANKS, fn() => Blocks::CRIMSON_PLANKS());
$this->map(Ids::CRIMSON_PRESSURE_PLATE, fn(Reader $in) => Helper::decodeSimplePressurePlate(Blocks::CRIMSON_PRESSURE_PLATE(), $in));
$this->mapStairs(Ids::CRIMSON_STAIRS, fn() => Blocks::CRIMSON_STAIRS());
$this->map(Ids::CRIMSON_STANDING_SIGN, fn(Reader $in) => Helper::decodeFloorSign(Blocks::CRIMSON_SIGN(), $in));
$this->map(Ids::CRIMSON_STEM, fn(Reader $in) => Helper::decodeLog(Blocks::CRIMSON_STEM(), false, $in));
$this->map(Ids::CRIMSON_TRAPDOOR, fn(Reader $in) => Helper::decodeTrapdoor(Blocks::CRIMSON_TRAPDOOR(), $in));
$this->map(Ids::CRIMSON_WALL_SIGN, fn(Reader $in) => Helper::decodeWallSign(Blocks::CRIMSON_WALL_SIGN(), $in));
$this->map(Ids::CRYING_OBSIDIAN, fn() => Blocks::CRYING_OBSIDIAN()); $this->map(Ids::CRYING_OBSIDIAN, fn() => Blocks::CRYING_OBSIDIAN());
$this->map(Ids::CYAN_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::CYAN(), $in));
$this->map(Ids::DARK_OAK_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::DARK_OAK_BUTTON(), $in));
$this->map(Ids::DARK_OAK_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::DARK_OAK_DOOR(), $in));
$this->map(Ids::DARK_OAK_FENCE_GATE, fn(Reader $in) => Helper::decodeFenceGate(Blocks::DARK_OAK_FENCE_GATE(), $in));
$this->map(Ids::DARK_OAK_PRESSURE_PLATE, fn(Reader $in) => Helper::decodeSimplePressurePlate(Blocks::DARK_OAK_PRESSURE_PLATE(), $in));
$this->mapStairs(Ids::DARK_OAK_STAIRS, fn() => Blocks::DARK_OAK_STAIRS());
$this->map(Ids::DARK_OAK_TRAPDOOR, fn(Reader $in) => Helper::decodeTrapdoor(Blocks::DARK_OAK_TRAPDOOR(), $in));
$this->mapStairs(Ids::DARK_PRISMARINE_STAIRS, fn() => Blocks::DARK_PRISMARINE_STAIRS());
$this->map(Ids::DARKOAK_STANDING_SIGN, fn(Reader $in) => Helper::decodeFloorSign(Blocks::DARK_OAK_SIGN(), $in));
$this->map(Ids::DARKOAK_WALL_SIGN, fn(Reader $in) => Helper::decodeWallSign(Blocks::DARK_OAK_WALL_SIGN(), $in));
$this->map(Ids::DAYLIGHT_DETECTOR, fn(Reader $in) => Helper::decodeDaylightSensor(Blocks::DAYLIGHT_SENSOR(), $in)
->setInverted(false));
$this->map(Ids::DAYLIGHT_DETECTOR_INVERTED, fn(Reader $in) => Helper::decodeDaylightSensor(Blocks::DAYLIGHT_SENSOR(), $in)
->setInverted(true));
$this->map(Ids::DEADBUSH, fn() => Blocks::DEAD_BUSH()); $this->map(Ids::DEADBUSH, fn() => Blocks::DEAD_BUSH());
$this->map(Ids::DEEPSLATE, function(Reader $in) : Block{
return Blocks::DEEPSLATE()
->setAxis($in->readPillarAxis());
});
$this->map(Ids::DEEPSLATE_BRICKS, fn() => Blocks::DEEPSLATE_BRICKS()); $this->map(Ids::DEEPSLATE_BRICKS, fn() => Blocks::DEEPSLATE_BRICKS());
$this->mapSlab(Ids::DEEPSLATE_BRICK_SLAB, Ids::DEEPSLATE_BRICK_DOUBLE_SLAB, fn() => Blocks::DEEPSLATE_BRICK_SLAB());
$this->mapStairs(Ids::DEEPSLATE_BRICK_STAIRS, fn() => Blocks::DEEPSLATE_BRICK_STAIRS());
$this->map(Ids::DEEPSLATE_BRICK_WALL, fn(Reader $in) => Helper::decodeWall(Blocks::DEEPSLATE_BRICK_WALL(), $in));
$this->map(Ids::DEEPSLATE_COAL_ORE, fn() => Blocks::DEEPSLATE_COAL_ORE()); $this->map(Ids::DEEPSLATE_COAL_ORE, fn() => Blocks::DEEPSLATE_COAL_ORE());
$this->map(Ids::DEEPSLATE_COPPER_ORE, fn() => Blocks::DEEPSLATE_COPPER_ORE()); $this->map(Ids::DEEPSLATE_COPPER_ORE, fn() => Blocks::DEEPSLATE_COPPER_ORE());
$this->map(Ids::DEEPSLATE_DIAMOND_ORE, fn() => Blocks::DEEPSLATE_DIAMOND_ORE()); $this->map(Ids::DEEPSLATE_DIAMOND_ORE, fn() => Blocks::DEEPSLATE_DIAMOND_ORE());
@ -392,58 +176,9 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
$this->map(Ids::DEEPSLATE_GOLD_ORE, fn() => Blocks::DEEPSLATE_GOLD_ORE()); $this->map(Ids::DEEPSLATE_GOLD_ORE, fn() => Blocks::DEEPSLATE_GOLD_ORE());
$this->map(Ids::DEEPSLATE_IRON_ORE, fn() => Blocks::DEEPSLATE_IRON_ORE()); $this->map(Ids::DEEPSLATE_IRON_ORE, fn() => Blocks::DEEPSLATE_IRON_ORE());
$this->map(Ids::DEEPSLATE_LAPIS_ORE, fn() => Blocks::DEEPSLATE_LAPIS_LAZULI_ORE()); $this->map(Ids::DEEPSLATE_LAPIS_ORE, fn() => Blocks::DEEPSLATE_LAPIS_LAZULI_ORE());
$this->map(Ids::DEEPSLATE_REDSTONE_ORE, fn() => Blocks::DEEPSLATE_REDSTONE_ORE()->setLit(false));
$this->map(Ids::DEEPSLATE_TILES, fn() => Blocks::DEEPSLATE_TILES()); $this->map(Ids::DEEPSLATE_TILES, fn() => Blocks::DEEPSLATE_TILES());
$this->mapSlab(Ids::DEEPSLATE_TILE_SLAB, Ids::DEEPSLATE_TILE_DOUBLE_SLAB, fn() => Blocks::DEEPSLATE_TILE_SLAB());
$this->mapStairs(Ids::DEEPSLATE_TILE_STAIRS, fn() => Blocks::DEEPSLATE_TILE_STAIRS());
$this->map(Ids::DEEPSLATE_TILE_WALL, fn(Reader $in) => Helper::decodeWall(Blocks::DEEPSLATE_TILE_WALL(), $in));
$this->map(Ids::DETECTOR_RAIL, function(Reader $in) : Block{
return Blocks::DETECTOR_RAIL()
->setActivated($in->readBool(StateNames::RAIL_DATA_BIT))
->setShape($in->readBoundedInt(StateNames::RAIL_DIRECTION, 0, 5));
});
$this->map(Ids::DIAMOND_BLOCK, fn() => Blocks::DIAMOND()); $this->map(Ids::DIAMOND_BLOCK, fn() => Blocks::DIAMOND());
$this->map(Ids::DIAMOND_ORE, fn() => Blocks::DIAMOND_ORE()); $this->map(Ids::DIAMOND_ORE, fn() => Blocks::DIAMOND_ORE());
$this->mapStairs(Ids::DIORITE_STAIRS, fn() => Blocks::DIORITE_STAIRS());
$this->map(Ids::DIRT, function(Reader $in) : Block{
return Blocks::DIRT()
->setCoarse(match($value = $in->readString(StateNames::DIRT_TYPE)){
StringValues::DIRT_TYPE_NORMAL => false,
StringValues::DIRT_TYPE_COARSE => true,
default => throw $in->badValueException(StateNames::DIRT_TYPE, $value),
});
});
$this->map(Ids::DOUBLE_PLANT, function(Reader $in) : Block{
return (match($type = $in->readString(StateNames::DOUBLE_PLANT_TYPE)){
StringValues::DOUBLE_PLANT_TYPE_FERN => Blocks::LARGE_FERN(),
StringValues::DOUBLE_PLANT_TYPE_GRASS => Blocks::DOUBLE_TALLGRASS(),
StringValues::DOUBLE_PLANT_TYPE_PAEONIA => Blocks::PEONY(),
StringValues::DOUBLE_PLANT_TYPE_ROSE => Blocks::ROSE_BUSH(),
StringValues::DOUBLE_PLANT_TYPE_SUNFLOWER => Blocks::SUNFLOWER(),
StringValues::DOUBLE_PLANT_TYPE_SYRINGA => Blocks::LILAC(),
default => throw $in->badValueException(StateNames::DOUBLE_PLANT_TYPE, $type),
})->setTop($in->readBool(StateNames::UPPER_BLOCK_BIT));
});
$this->map(Ids::DOUBLE_STONE_BLOCK_SLAB, function(Reader $in) : Block{
$in->ignored(StateNames::TOP_SLOT_BIT); //useless for double slabs
return Helper::mapStoneSlab1Type($in)->setSlabType(SlabType::DOUBLE());
});
$this->map(Ids::DOUBLE_STONE_BLOCK_SLAB2, function(Reader $in) : Block{
$in->ignored(StateNames::TOP_SLOT_BIT); //useless for double slabs
return Helper::mapStoneSlab2Type($in)->setSlabType(SlabType::DOUBLE());
});
$this->map(Ids::DOUBLE_STONE_BLOCK_SLAB3, function(Reader $in) : Block{
$in->ignored(StateNames::TOP_SLOT_BIT); //useless for double slabs
return Helper::mapStoneSlab3Type($in)->setSlabType(SlabType::DOUBLE());
});
$this->map(Ids::DOUBLE_STONE_BLOCK_SLAB4, function(Reader $in) : Block{
$in->ignored(StateNames::TOP_SLOT_BIT); //useless for double slabs
return Helper::mapStoneSlab4Type($in)->setSlabType(SlabType::DOUBLE());
});
$this->map(Ids::DOUBLE_WOODEN_SLAB, function(Reader $in) : Block{
$in->ignored(StateNames::TOP_SLOT_BIT); //useless for double slabs
return Helper::mapWoodenSlabType($in)->setSlabType(SlabType::DOUBLE());
});
$this->map(Ids::DRAGON_EGG, fn() => Blocks::DRAGON_EGG()); $this->map(Ids::DRAGON_EGG, fn() => Blocks::DRAGON_EGG());
$this->map(Ids::DRIED_KELP_BLOCK, fn() => Blocks::DRIED_KELP()); $this->map(Ids::DRIED_KELP_BLOCK, fn() => Blocks::DRIED_KELP());
$this->map(Ids::ELEMENT_0, fn() => Blocks::ELEMENT_ZERO()); $this->map(Ids::ELEMENT_0, fn() => Blocks::ELEMENT_ZERO());
@ -568,8 +303,355 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
$this->map(Ids::EMERALD_BLOCK, fn() => Blocks::EMERALD()); $this->map(Ids::EMERALD_BLOCK, fn() => Blocks::EMERALD());
$this->map(Ids::EMERALD_ORE, fn() => Blocks::EMERALD_ORE()); $this->map(Ids::EMERALD_ORE, fn() => Blocks::EMERALD_ORE());
$this->map(Ids::ENCHANTING_TABLE, fn() => Blocks::ENCHANTING_TABLE()); $this->map(Ids::ENCHANTING_TABLE, fn() => Blocks::ENCHANTING_TABLE());
$this->mapStairs(Ids::END_BRICK_STAIRS, fn() => Blocks::END_STONE_BRICK_STAIRS());
$this->map(Ids::END_BRICKS, fn() => Blocks::END_STONE_BRICKS()); $this->map(Ids::END_BRICKS, fn() => Blocks::END_STONE_BRICKS());
$this->map(Ids::END_STONE, fn() => Blocks::END_STONE());
$this->map(Ids::FLETCHING_TABLE, fn() => Blocks::FLETCHING_TABLE());
$this->map(Ids::GILDED_BLACKSTONE, fn() => Blocks::GILDED_BLACKSTONE());
$this->map(Ids::GLASS, fn() => Blocks::GLASS());
$this->map(Ids::GLASS_PANE, fn() => Blocks::GLASS_PANE());
$this->map(Ids::GLOWINGOBSIDIAN, fn() => Blocks::GLOWING_OBSIDIAN());
$this->map(Ids::GLOWSTONE, fn() => Blocks::GLOWSTONE());
$this->map(Ids::GOLD_BLOCK, fn() => Blocks::GOLD());
$this->map(Ids::GOLD_ORE, fn() => Blocks::GOLD_ORE());
$this->map(Ids::GRASS, fn() => Blocks::GRASS());
$this->map(Ids::GRASS_PATH, fn() => Blocks::GRASS_PATH());
$this->map(Ids::GRAVEL, fn() => Blocks::GRAVEL());
$this->map(Ids::HANGING_ROOTS, fn() => Blocks::HANGING_ROOTS());
$this->map(Ids::HARD_GLASS, fn() => Blocks::HARDENED_GLASS());
$this->map(Ids::HARD_GLASS_PANE, fn() => Blocks::HARDENED_GLASS_PANE());
$this->map(Ids::HARDENED_CLAY, fn() => Blocks::HARDENED_CLAY());
$this->map(Ids::HONEYCOMB_BLOCK, fn() => Blocks::HONEYCOMB());
$this->map(Ids::ICE, fn() => Blocks::ICE());
$this->map(Ids::INFO_UPDATE, fn() => Blocks::INFO_UPDATE());
$this->map(Ids::INFO_UPDATE2, fn() => Blocks::INFO_UPDATE2());
$this->map(Ids::INVISIBLE_BEDROCK, fn() => Blocks::INVISIBLE_BEDROCK());
$this->map(Ids::IRON_BARS, fn() => Blocks::IRON_BARS());
$this->map(Ids::IRON_BLOCK, fn() => Blocks::IRON());
$this->map(Ids::IRON_ORE, fn() => Blocks::IRON_ORE());
$this->map(Ids::JUKEBOX, fn() => Blocks::JUKEBOX());
$this->map(Ids::LAPIS_BLOCK, fn() => Blocks::LAPIS_LAZULI());
$this->map(Ids::LAPIS_ORE, fn() => Blocks::LAPIS_LAZULI_ORE());
$this->map(Ids::MAGMA, fn() => Blocks::MAGMA());
$this->map(Ids::MANGROVE_FENCE, fn() => Blocks::MANGROVE_FENCE());
$this->map(Ids::MANGROVE_PLANKS, fn() => Blocks::MANGROVE_PLANKS());
$this->map(Ids::MELON_BLOCK, fn() => Blocks::MELON());
$this->map(Ids::MOB_SPAWNER, fn() => Blocks::MONSTER_SPAWNER());
$this->map(Ids::MOSSY_COBBLESTONE, fn() => Blocks::MOSSY_COBBLESTONE());
$this->map(Ids::MUD_BRICKS, fn() => Blocks::MUD_BRICKS());
$this->map(Ids::MYCELIUM, fn() => Blocks::MYCELIUM());
$this->map(Ids::NETHER_BRICK, fn() => Blocks::NETHER_BRICKS());
$this->map(Ids::NETHER_BRICK_FENCE, fn() => Blocks::NETHER_BRICK_FENCE());
$this->map(Ids::NETHER_GOLD_ORE, fn() => Blocks::NETHER_GOLD_ORE());
$this->map(Ids::NETHER_WART_BLOCK, fn() => Blocks::NETHER_WART_BLOCK());
$this->map(Ids::NETHERITE_BLOCK, fn() => Blocks::NETHERITE());
$this->map(Ids::NETHERRACK, fn() => Blocks::NETHERRACK());
$this->map(Ids::NETHERREACTOR, fn() => Blocks::NETHER_REACTOR_CORE());
$this->map(Ids::NOTEBLOCK, fn() => Blocks::NOTE_BLOCK());
$this->map(Ids::OBSIDIAN, fn() => Blocks::OBSIDIAN());
$this->map(Ids::PACKED_ICE, fn() => Blocks::PACKED_ICE());
$this->map(Ids::PODZOL, fn() => Blocks::PODZOL());
$this->map(Ids::POLISHED_BLACKSTONE, fn() => Blocks::POLISHED_BLACKSTONE());
$this->map(Ids::POLISHED_BLACKSTONE_BRICKS, fn() => Blocks::POLISHED_BLACKSTONE_BRICKS());
$this->map(Ids::POLISHED_DEEPSLATE, fn() => Blocks::POLISHED_DEEPSLATE());
$this->map(Ids::QUARTZ_BRICKS, fn() => Blocks::QUARTZ_BRICKS());
$this->map(Ids::QUARTZ_ORE, fn() => Blocks::NETHER_QUARTZ_ORE());
$this->map(Ids::RAW_COPPER_BLOCK, fn() => Blocks::RAW_COPPER());
$this->map(Ids::RAW_GOLD_BLOCK, fn() => Blocks::RAW_GOLD());
$this->map(Ids::RAW_IRON_BLOCK, fn() => Blocks::RAW_IRON());
$this->map(Ids::RED_MUSHROOM, fn() => Blocks::RED_MUSHROOM());
$this->map(Ids::RED_NETHER_BRICK, fn() => Blocks::RED_NETHER_BRICKS());
$this->map(Ids::REDSTONE_BLOCK, fn() => Blocks::REDSTONE());
$this->map(Ids::RESERVED6, fn() => Blocks::RESERVED6());
$this->map(Ids::SEA_LANTERN, fn() => Blocks::SEA_LANTERN());
$this->map(Ids::SHROOMLIGHT, fn() => Blocks::SHROOMLIGHT());
$this->map(Ids::SLIME, fn() => Blocks::SLIME());
$this->map(Ids::SMITHING_TABLE, fn() => Blocks::SMITHING_TABLE());
$this->map(Ids::SMOOTH_BASALT, fn() => Blocks::SMOOTH_BASALT());
$this->map(Ids::SMOOTH_STONE, fn() => Blocks::SMOOTH_STONE());
$this->map(Ids::SNOW, fn() => Blocks::SNOW());
$this->map(Ids::SOUL_SAND, fn() => Blocks::SOUL_SAND());
$this->map(Ids::SOUL_SOIL, fn() => Blocks::SOUL_SOIL());
$this->map(Ids::STONECUTTER, fn() => Blocks::LEGACY_STONECUTTER());
$this->map(Ids::TINTED_GLASS, fn() => Blocks::TINTED_GLASS());
$this->map(Ids::TUFF, fn() => Blocks::TUFF());
$this->map(Ids::UNDYED_SHULKER_BOX, fn() => Blocks::SHULKER_BOX());
$this->map(Ids::WARPED_FENCE, fn() => Blocks::WARPED_FENCE());
$this->map(Ids::WARPED_PLANKS, fn() => Blocks::WARPED_PLANKS());
$this->map(Ids::WARPED_WART_BLOCK, fn() => Blocks::WARPED_WART_BLOCK());
$this->map(Ids::WATERLILY, fn() => Blocks::LILY_PAD());
$this->map(Ids::WEB, fn() => Blocks::COBWEB());
$this->map(Ids::WITHER_ROSE, fn() => Blocks::WITHER_ROSE());
$this->map(Ids::YELLOW_FLOWER, fn() => Blocks::DANDELION());
}
private function registerDeserializers() : void{
$this->map(Ids::ACACIA_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::ACACIA_BUTTON(), $in));
$this->map(Ids::ACACIA_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::ACACIA_DOOR(), $in));
$this->map(Ids::ACACIA_FENCE_GATE, fn(Reader $in) => Helper::decodeFenceGate(Blocks::ACACIA_FENCE_GATE(), $in));
$this->map(Ids::ACACIA_PRESSURE_PLATE, fn(Reader $in) => Helper::decodeSimplePressurePlate(Blocks::ACACIA_PRESSURE_PLATE(), $in));
$this->mapStairs(Ids::ACACIA_STAIRS, fn() => Blocks::ACACIA_STAIRS());
$this->map(Ids::ACACIA_STANDING_SIGN, fn(Reader $in) => Helper::decodeFloorSign(Blocks::ACACIA_SIGN(), $in));
$this->map(Ids::ACACIA_TRAPDOOR, fn(Reader $in) => Helper::decodeTrapdoor(Blocks::ACACIA_TRAPDOOR(), $in));
$this->map(Ids::ACACIA_WALL_SIGN, fn(Reader $in) => Helper::decodeWallSign(Blocks::ACACIA_WALL_SIGN(), $in));
$this->map(Ids::ACTIVATOR_RAIL, function(Reader $in) : Block{
return Blocks::ACTIVATOR_RAIL()
->setPowered($in->readBool(StateNames::RAIL_DATA_BIT))
->setShape($in->readBoundedInt(StateNames::RAIL_DIRECTION, 0, 5));
});
$this->mapStairs(Ids::ANDESITE_STAIRS, fn() => Blocks::ANDESITE_STAIRS());
$this->map(Ids::ANVIL, function(Reader $in) : Block{
return Blocks::ANVIL()
->setDamage(match($value = $in->readString(StateNames::DAMAGE)){
StringValues::DAMAGE_UNDAMAGED => 0,
StringValues::DAMAGE_SLIGHTLY_DAMAGED => 1,
StringValues::DAMAGE_VERY_DAMAGED => 2,
StringValues::DAMAGE_BROKEN => 0,
default => throw $in->badValueException(StateNames::DAMAGE, $value),
})
->setFacing($in->readLegacyHorizontalFacing());
});
$this->map(Ids::BAMBOO, function(Reader $in) : Block{
return Blocks::BAMBOO()
->setLeafSize(match($value = $in->readString(StateNames::BAMBOO_LEAF_SIZE)){
StringValues::BAMBOO_LEAF_SIZE_NO_LEAVES => Bamboo::NO_LEAVES,
StringValues::BAMBOO_LEAF_SIZE_SMALL_LEAVES => Bamboo::SMALL_LEAVES,
StringValues::BAMBOO_LEAF_SIZE_LARGE_LEAVES => Bamboo::LARGE_LEAVES,
default => throw $in->badValueException(StateNames::BAMBOO_LEAF_SIZE, $value),
})
->setReady($in->readBool(StateNames::AGE_BIT))
->setThick(match($value = $in->readString(StateNames::BAMBOO_STALK_THICKNESS)){
StringValues::BAMBOO_STALK_THICKNESS_THIN => false,
StringValues::BAMBOO_STALK_THICKNESS_THICK => true,
default => throw $in->badValueException(StateNames::BAMBOO_STALK_THICKNESS, $value),
});
});
$this->map(Ids::BAMBOO_SAPLING, function(Reader $in) : Block{
$in->ignored(StateNames::SAPLING_TYPE); //bug in MCPE
return Blocks::BAMBOO_SAPLING()->setReady($in->readBool(StateNames::AGE_BIT));
});
$this->map(Ids::BARREL, function(Reader $in) : Block{
return Blocks::BARREL()
->setFacing($in->readFacingDirection())
->setOpen($in->readBool(StateNames::OPEN_BIT));
});
$this->map(Ids::BASALT, function(Reader $in){
return Blocks::BASALT()
->setAxis($in->readPillarAxis());
});
$this->map(Ids::BED, function(Reader $in) : Block{
return Blocks::BED()
->setFacing($in->readLegacyHorizontalFacing())
->setHead($in->readBool(StateNames::HEAD_PIECE_BIT))
->setOccupied($in->readBool(StateNames::OCCUPIED_BIT));
});
$this->map(Ids::BEDROCK, function(Reader $in) : Block{
return Blocks::BEDROCK()
->setBurnsForever($in->readBool(StateNames::INFINIBURN_BIT));
});
$this->map(Ids::BEETROOT, fn(Reader $in) => Helper::decodeCrops(Blocks::BEETROOTS(), $in));
$this->map(Ids::BELL, function(Reader $in) : Block{
$in->ignored(StateNames::TOGGLE_BIT); //only useful at runtime
return Blocks::BELL()
->setFacing($in->readLegacyHorizontalFacing())
->setAttachmentType($in->readBellAttachmentType());
});
$this->map(Ids::BIRCH_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::BIRCH_BUTTON(), $in));
$this->map(Ids::BIRCH_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::BIRCH_DOOR(), $in));
$this->map(Ids::BIRCH_FENCE_GATE, fn(Reader $in) => Helper::decodeFenceGate(Blocks::BIRCH_FENCE_GATE(), $in));
$this->map(Ids::BIRCH_PRESSURE_PLATE, fn(Reader $in) => Helper::decodeSimplePressurePlate(Blocks::BIRCH_PRESSURE_PLATE(), $in));
$this->mapStairs(Ids::BIRCH_STAIRS, fn() => Blocks::BIRCH_STAIRS());
$this->map(Ids::BIRCH_STANDING_SIGN, fn(Reader $in) => Helper::decodeFloorSign(Blocks::BIRCH_SIGN(), $in));
$this->map(Ids::BIRCH_TRAPDOOR, fn(Reader $in) => Helper::decodeTrapdoor(Blocks::BIRCH_TRAPDOOR(), $in));
$this->map(Ids::BIRCH_WALL_SIGN, fn(Reader $in) => Helper::decodeWallSign(Blocks::BIRCH_WALL_SIGN(), $in));
$this->mapSlab(Ids::BLACKSTONE_SLAB, Ids::BLACKSTONE_DOUBLE_SLAB, fn() => Blocks::BLACKSTONE_SLAB());
$this->mapStairs(Ids::BLACKSTONE_STAIRS, fn() => Blocks::BLACKSTONE_STAIRS());
$this->map(Ids::BLACKSTONE_WALL, fn(Reader $in) => Helper::decodeWall(Blocks::BLACKSTONE_WALL(), $in));
$this->map(Ids::BLACK_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::BLACK(), $in));
$this->map(Ids::BLAST_FURNACE, function(Reader $in) : Block{
return Blocks::BLAST_FURNACE()
->setFacing($in->readHorizontalFacing())
->setLit(false);
});
$this->map(Ids::BLUE_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::BLUE(), $in));
$this->map(Ids::BONE_BLOCK, function(Reader $in) : Block{
$in->ignored(StateNames::DEPRECATED);
return Blocks::BONE_BLOCK()->setAxis($in->readPillarAxis());
});
$this->map(Ids::BREWING_STAND, function(Reader $in) : Block{
return Blocks::BREWING_STAND()
->setSlot(BrewingStandSlot::EAST(), $in->readBool(StateNames::BREWING_STAND_SLOT_A_BIT))
->setSlot(BrewingStandSlot::SOUTHWEST(), $in->readBool(StateNames::BREWING_STAND_SLOT_B_BIT))
->setSlot(BrewingStandSlot::NORTHWEST(), $in->readBool(StateNames::BREWING_STAND_SLOT_C_BIT));
});
$this->mapStairs(Ids::BRICK_STAIRS, fn() => Blocks::BRICK_STAIRS());
$this->map(Ids::BROWN_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::BROWN(), $in));
$this->map(Ids::BROWN_MUSHROOM_BLOCK, fn(Reader $in) => Helper::decodeMushroomBlock(Blocks::BROWN_MUSHROOM_BLOCK(), $in));
$this->map(Ids::CACTUS, function(Reader $in) : Block{
return Blocks::CACTUS()
->setAge($in->readBoundedInt(StateNames::AGE, 0, 15));
});
$this->map(Ids::CAKE, function(Reader $in) : Block{
return Blocks::CAKE()
->setBites($in->readBoundedInt(StateNames::BITE_COUNTER, 0, 6));
});
$this->map(Ids::CARPET, function(Reader $in) : Block{
return Blocks::CARPET()
->setColor($in->readColor());
});
$this->map(Ids::CARROTS, fn(Reader $in) => Helper::decodeCrops(Blocks::CARROTS(), $in));
$this->map(Ids::CARVED_PUMPKIN, function(Reader $in) : Block{
return Blocks::CARVED_PUMPKIN()
->setFacing($in->readLegacyHorizontalFacing());
});
$this->map(Ids::CHEMISTRY_TABLE, function(Reader $in) : Block{
return (match($type = $in->readString(StateNames::CHEMISTRY_TABLE_TYPE)){
StringValues::CHEMISTRY_TABLE_TYPE_COMPOUND_CREATOR => Blocks::COMPOUND_CREATOR(),
StringValues::CHEMISTRY_TABLE_TYPE_ELEMENT_CONSTRUCTOR => Blocks::ELEMENT_CONSTRUCTOR(),
StringValues::CHEMISTRY_TABLE_TYPE_LAB_TABLE => Blocks::LAB_TABLE(),
StringValues::CHEMISTRY_TABLE_TYPE_MATERIAL_REDUCER => Blocks::MATERIAL_REDUCER(),
default => throw $in->badValueException(StateNames::CHEMISTRY_TABLE_TYPE, $type),
})->setFacing(Facing::opposite($in->readLegacyHorizontalFacing()));
});
$this->map(Ids::CHEST, function(Reader $in) : Block{
return Blocks::CHEST()
->setFacing($in->readHorizontalFacing());
});
$this->mapSlab(Ids::COBBLED_DEEPSLATE_SLAB, Ids::COBBLED_DEEPSLATE_DOUBLE_SLAB, fn() => Blocks::COBBLED_DEEPSLATE_SLAB());
$this->mapStairs(Ids::COBBLED_DEEPSLATE_STAIRS, fn() => Blocks::COBBLED_DEEPSLATE_STAIRS());
$this->map(Ids::COBBLED_DEEPSLATE_WALL, fn(Reader $in) => Helper::decodeWall(Blocks::COBBLED_DEEPSLATE_WALL(), $in));
$this->map(Ids::COBBLESTONE_WALL, fn(Reader $in) => Helper::mapLegacyWallType($in));
$this->map(Ids::COCOA, function(Reader $in) : Block{
return Blocks::COCOA_POD()
->setAge($in->readBoundedInt(StateNames::AGE, 0, 2))
->setFacing(Facing::opposite($in->readLegacyHorizontalFacing()));
});
$this->map(Ids::COLORED_TORCH_BP, function(Reader $in) : Block{
return $in->readBool(StateNames::COLOR_BIT) ?
Blocks::PURPLE_TORCH()->setFacing($in->readTorchFacing()) :
Blocks::BLUE_TORCH()->setFacing($in->readTorchFacing());
});
$this->map(Ids::COLORED_TORCH_RG, function(Reader $in) : Block{
return $in->readBool(StateNames::COLOR_BIT) ?
Blocks::GREEN_TORCH()->setFacing($in->readTorchFacing()) :
Blocks::RED_TORCH()->setFacing($in->readTorchFacing());
});
$this->map(Ids::CONCRETE, function(Reader $in) : Block{
return Blocks::CONCRETE()
->setColor($in->readColor());
});
$this->map(Ids::CONCRETE_POWDER, function(Reader $in) : Block{
return Blocks::CONCRETE_POWDER()
->setColor($in->readColor());
});
$this->map(Ids::COPPER_BLOCK, fn() => Helper::decodeCopper(Blocks::COPPER(), CopperOxidation::NONE()));
$this->map(Ids::CUT_COPPER, fn() => Helper::decodeCopper(Blocks::CUT_COPPER(), CopperOxidation::NONE()));
$this->mapSlab(Ids::CUT_COPPER_SLAB, Ids::DOUBLE_CUT_COPPER_SLAB, fn() => Helper::decodeCopper(Blocks::CUT_COPPER_SLAB(), CopperOxidation::NONE()));
$this->mapStairs(Ids::CUT_COPPER_STAIRS, fn() => Helper::decodeCopper(Blocks::CUT_COPPER_STAIRS(), CopperOxidation::NONE()));
$this->map(Ids::CORAL, function(Reader $in) : Block{
return Blocks::CORAL()
->setCoralType($in->readCoralType())
->setDead($in->readBool(StateNames::DEAD_BIT));
});
$this->map(Ids::CORAL_BLOCK, function(Reader $in) : Block{
return Blocks::CORAL_BLOCK()
->setCoralType($in->readCoralType())
->setDead($in->readBool(StateNames::DEAD_BIT));
});
$this->map(Ids::CORAL_FAN, fn(Reader $in) => Helper::decodeFloorCoralFan(Blocks::CORAL_FAN(), $in)
->setDead(false));
$this->map(Ids::CORAL_FAN_DEAD, fn(Reader $in) => Helper::decodeFloorCoralFan(Blocks::CORAL_FAN(), $in)
->setDead(true));
$this->map(Ids::CORAL_FAN_HANG, fn(Reader $in) => Helper::decodeWallCoralFan(Blocks::WALL_CORAL_FAN(), $in)
->setCoralType($in->readBool(StateNames::CORAL_HANG_TYPE_BIT) ? CoralType::BRAIN() : CoralType::TUBE()));
$this->map(Ids::CORAL_FAN_HANG2, fn(Reader $in) => Helper::decodeWallCoralFan(Blocks::WALL_CORAL_FAN(), $in)
->setCoralType($in->readBool(StateNames::CORAL_HANG_TYPE_BIT) ? CoralType::FIRE() : CoralType::BUBBLE()));
$this->map(Ids::CORAL_FAN_HANG3, function(Reader $in) : Block{
$in->ignored(StateNames::CORAL_HANG_TYPE_BIT); //the game always writes this, even though it's not used
return Helper::decodeWallCoralFan(Blocks::WALL_CORAL_FAN(), $in)
->setCoralType(CoralType::HORN());
});
$this->map(Ids::CRIMSON_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::CRIMSON_BUTTON(), $in));
$this->map(Ids::CRIMSON_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::CRIMSON_DOOR(), $in));
$this->mapSlab(Ids::CRIMSON_SLAB, Ids::CRIMSON_DOUBLE_SLAB, fn() => Blocks::CRIMSON_SLAB());
$this->map(Ids::CRIMSON_FENCE_GATE, fn(Reader $in) => Helper::decodeFenceGate(Blocks::CRIMSON_FENCE_GATE(), $in));
$this->map(Ids::CRIMSON_HYPHAE, fn(Reader $in) => Helper::decodeLog(Blocks::CRIMSON_HYPHAE(), false, $in));
$this->map(Ids::CRIMSON_PRESSURE_PLATE, fn(Reader $in) => Helper::decodeSimplePressurePlate(Blocks::CRIMSON_PRESSURE_PLATE(), $in));
$this->mapStairs(Ids::CRIMSON_STAIRS, fn() => Blocks::CRIMSON_STAIRS());
$this->map(Ids::CRIMSON_STANDING_SIGN, fn(Reader $in) => Helper::decodeFloorSign(Blocks::CRIMSON_SIGN(), $in));
$this->map(Ids::CRIMSON_STEM, fn(Reader $in) => Helper::decodeLog(Blocks::CRIMSON_STEM(), false, $in));
$this->map(Ids::CRIMSON_TRAPDOOR, fn(Reader $in) => Helper::decodeTrapdoor(Blocks::CRIMSON_TRAPDOOR(), $in));
$this->map(Ids::CRIMSON_WALL_SIGN, fn(Reader $in) => Helper::decodeWallSign(Blocks::CRIMSON_WALL_SIGN(), $in));
$this->map(Ids::CYAN_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::CYAN(), $in));
$this->map(Ids::DARK_OAK_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::DARK_OAK_BUTTON(), $in));
$this->map(Ids::DARK_OAK_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::DARK_OAK_DOOR(), $in));
$this->map(Ids::DARK_OAK_FENCE_GATE, fn(Reader $in) => Helper::decodeFenceGate(Blocks::DARK_OAK_FENCE_GATE(), $in));
$this->map(Ids::DARK_OAK_PRESSURE_PLATE, fn(Reader $in) => Helper::decodeSimplePressurePlate(Blocks::DARK_OAK_PRESSURE_PLATE(), $in));
$this->mapStairs(Ids::DARK_OAK_STAIRS, fn() => Blocks::DARK_OAK_STAIRS());
$this->map(Ids::DARK_OAK_TRAPDOOR, fn(Reader $in) => Helper::decodeTrapdoor(Blocks::DARK_OAK_TRAPDOOR(), $in));
$this->mapStairs(Ids::DARK_PRISMARINE_STAIRS, fn() => Blocks::DARK_PRISMARINE_STAIRS());
$this->map(Ids::DARKOAK_STANDING_SIGN, fn(Reader $in) => Helper::decodeFloorSign(Blocks::DARK_OAK_SIGN(), $in));
$this->map(Ids::DARKOAK_WALL_SIGN, fn(Reader $in) => Helper::decodeWallSign(Blocks::DARK_OAK_WALL_SIGN(), $in));
$this->map(Ids::DAYLIGHT_DETECTOR, fn(Reader $in) => Helper::decodeDaylightSensor(Blocks::DAYLIGHT_SENSOR(), $in)
->setInverted(false));
$this->map(Ids::DAYLIGHT_DETECTOR_INVERTED, fn(Reader $in) => Helper::decodeDaylightSensor(Blocks::DAYLIGHT_SENSOR(), $in)
->setInverted(true));
$this->map(Ids::DEEPSLATE, function(Reader $in) : Block{
return Blocks::DEEPSLATE()
->setAxis($in->readPillarAxis());
});
$this->mapSlab(Ids::DEEPSLATE_BRICK_SLAB, Ids::DEEPSLATE_BRICK_DOUBLE_SLAB, fn() => Blocks::DEEPSLATE_BRICK_SLAB());
$this->mapStairs(Ids::DEEPSLATE_BRICK_STAIRS, fn() => Blocks::DEEPSLATE_BRICK_STAIRS());
$this->map(Ids::DEEPSLATE_BRICK_WALL, fn(Reader $in) => Helper::decodeWall(Blocks::DEEPSLATE_BRICK_WALL(), $in));
$this->map(Ids::DEEPSLATE_REDSTONE_ORE, fn() => Blocks::DEEPSLATE_REDSTONE_ORE()->setLit(false));
$this->mapSlab(Ids::DEEPSLATE_TILE_SLAB, Ids::DEEPSLATE_TILE_DOUBLE_SLAB, fn() => Blocks::DEEPSLATE_TILE_SLAB());
$this->mapStairs(Ids::DEEPSLATE_TILE_STAIRS, fn() => Blocks::DEEPSLATE_TILE_STAIRS());
$this->map(Ids::DEEPSLATE_TILE_WALL, fn(Reader $in) => Helper::decodeWall(Blocks::DEEPSLATE_TILE_WALL(), $in));
$this->map(Ids::DETECTOR_RAIL, function(Reader $in) : Block{
return Blocks::DETECTOR_RAIL()
->setActivated($in->readBool(StateNames::RAIL_DATA_BIT))
->setShape($in->readBoundedInt(StateNames::RAIL_DIRECTION, 0, 5));
});
$this->mapStairs(Ids::DIORITE_STAIRS, fn() => Blocks::DIORITE_STAIRS());
$this->map(Ids::DIRT, function(Reader $in) : Block{
return Blocks::DIRT()
->setCoarse(match($value = $in->readString(StateNames::DIRT_TYPE)){
StringValues::DIRT_TYPE_NORMAL => false,
StringValues::DIRT_TYPE_COARSE => true,
default => throw $in->badValueException(StateNames::DIRT_TYPE, $value),
});
});
$this->map(Ids::DOUBLE_PLANT, function(Reader $in) : Block{
return (match($type = $in->readString(StateNames::DOUBLE_PLANT_TYPE)){
StringValues::DOUBLE_PLANT_TYPE_FERN => Blocks::LARGE_FERN(),
StringValues::DOUBLE_PLANT_TYPE_GRASS => Blocks::DOUBLE_TALLGRASS(),
StringValues::DOUBLE_PLANT_TYPE_PAEONIA => Blocks::PEONY(),
StringValues::DOUBLE_PLANT_TYPE_ROSE => Blocks::ROSE_BUSH(),
StringValues::DOUBLE_PLANT_TYPE_SUNFLOWER => Blocks::SUNFLOWER(),
StringValues::DOUBLE_PLANT_TYPE_SYRINGA => Blocks::LILAC(),
default => throw $in->badValueException(StateNames::DOUBLE_PLANT_TYPE, $type),
})->setTop($in->readBool(StateNames::UPPER_BLOCK_BIT));
});
$this->map(Ids::DOUBLE_STONE_BLOCK_SLAB, function(Reader $in) : Block{
$in->ignored(StateNames::TOP_SLOT_BIT); //useless for double slabs
return Helper::mapStoneSlab1Type($in)->setSlabType(SlabType::DOUBLE());
});
$this->map(Ids::DOUBLE_STONE_BLOCK_SLAB2, function(Reader $in) : Block{
$in->ignored(StateNames::TOP_SLOT_BIT); //useless for double slabs
return Helper::mapStoneSlab2Type($in)->setSlabType(SlabType::DOUBLE());
});
$this->map(Ids::DOUBLE_STONE_BLOCK_SLAB3, function(Reader $in) : Block{
$in->ignored(StateNames::TOP_SLOT_BIT); //useless for double slabs
return Helper::mapStoneSlab3Type($in)->setSlabType(SlabType::DOUBLE());
});
$this->map(Ids::DOUBLE_STONE_BLOCK_SLAB4, function(Reader $in) : Block{
$in->ignored(StateNames::TOP_SLOT_BIT); //useless for double slabs
return Helper::mapStoneSlab4Type($in)->setSlabType(SlabType::DOUBLE());
});
$this->map(Ids::DOUBLE_WOODEN_SLAB, function(Reader $in) : Block{
$in->ignored(StateNames::TOP_SLOT_BIT); //useless for double slabs
return Helper::mapWoodenSlabType($in)->setSlabType(SlabType::DOUBLE());
});
$this->mapStairs(Ids::END_BRICK_STAIRS, fn() => Blocks::END_STONE_BRICK_STAIRS());
$this->map(Ids::END_PORTAL_FRAME, function(Reader $in) : Block{ $this->map(Ids::END_PORTAL_FRAME, function(Reader $in) : Block{
return Blocks::END_PORTAL_FRAME() return Blocks::END_PORTAL_FRAME()
->setEye($in->readBool(StateNames::END_PORTAL_EYE_BIT)) ->setEye($in->readBool(StateNames::END_PORTAL_EYE_BIT))
@ -579,7 +661,6 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
return Blocks::END_ROD() return Blocks::END_ROD()
->setFacing($in->readEndRodFacingDirection()); ->setFacing($in->readEndRodFacingDirection());
}); });
$this->map(Ids::END_STONE, fn() => Blocks::END_STONE());
$this->map(Ids::ENDER_CHEST, function(Reader $in) : Block{ $this->map(Ids::ENDER_CHEST, function(Reader $in) : Block{
return Blocks::ENDER_CHEST() return Blocks::ENDER_CHEST()
->setFacing($in->readHorizontalFacing()); ->setFacing($in->readHorizontalFacing());
@ -608,7 +689,6 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
return Blocks::FIRE() return Blocks::FIRE()
->setAge($in->readBoundedInt(StateNames::AGE, 0, 15)); ->setAge($in->readBoundedInt(StateNames::AGE, 0, 15));
}); });
$this->map(Ids::FLETCHING_TABLE, fn() => Blocks::FLETCHING_TABLE());
$this->map(Ids::FLOWER_POT, function(Reader $in) : Block{ $this->map(Ids::FLOWER_POT, function(Reader $in) : Block{
$in->ignored(StateNames::UPDATE_BIT); $in->ignored(StateNames::UPDATE_BIT);
return Blocks::FLOWER_POT(); return Blocks::FLOWER_POT();
@ -625,28 +705,15 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
->setFacing($in->readHorizontalFacing()) ->setFacing($in->readHorizontalFacing())
->setLit(false); ->setLit(false);
}); });
$this->map(Ids::GILDED_BLACKSTONE, fn() => Blocks::GILDED_BLACKSTONE());
$this->map(Ids::GLASS, fn() => Blocks::GLASS());
$this->map(Ids::GLASS_PANE, fn() => Blocks::GLASS_PANE());
$this->map(Ids::GLOW_FRAME, fn(Reader $in) => Helper::decodeItemFrame($in, true)); $this->map(Ids::GLOW_FRAME, fn(Reader $in) => Helper::decodeItemFrame($in, true));
$this->map(Ids::GLOWINGOBSIDIAN, fn() => Blocks::GLOWING_OBSIDIAN());
$this->map(Ids::GLOWSTONE, fn() => Blocks::GLOWSTONE());
$this->map(Ids::GOLD_BLOCK, fn() => Blocks::GOLD());
$this->map(Ids::GOLD_ORE, fn() => Blocks::GOLD_ORE());
$this->map(Ids::GOLDEN_RAIL, function(Reader $in) : Block{ $this->map(Ids::GOLDEN_RAIL, function(Reader $in) : Block{
return Blocks::POWERED_RAIL() return Blocks::POWERED_RAIL()
->setPowered($in->readBool(StateNames::RAIL_DATA_BIT)) ->setPowered($in->readBool(StateNames::RAIL_DATA_BIT))
->setShape($in->readBoundedInt(StateNames::RAIL_DIRECTION, 0, 5)); ->setShape($in->readBoundedInt(StateNames::RAIL_DIRECTION, 0, 5));
}); });
$this->mapStairs(Ids::GRANITE_STAIRS, fn() => Blocks::GRANITE_STAIRS()); $this->mapStairs(Ids::GRANITE_STAIRS, fn() => Blocks::GRANITE_STAIRS());
$this->map(Ids::GRASS, fn() => Blocks::GRASS());
$this->map(Ids::GRASS_PATH, fn() => Blocks::GRASS_PATH());
$this->map(Ids::GRAVEL, fn() => Blocks::GRAVEL());
$this->map(Ids::GRAY_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::GRAY(), $in)); $this->map(Ids::GRAY_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::GRAY(), $in));
$this->map(Ids::GREEN_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::GREEN(), $in)); $this->map(Ids::GREEN_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::GREEN(), $in));
$this->map(Ids::HANGING_ROOTS, fn() => Blocks::HANGING_ROOTS());
$this->map(Ids::HARD_GLASS, fn() => Blocks::HARDENED_GLASS());
$this->map(Ids::HARD_GLASS_PANE, fn() => Blocks::HARDENED_GLASS_PANE());
$this->map(Ids::HARD_STAINED_GLASS, function(Reader $in) : Block{ $this->map(Ids::HARD_STAINED_GLASS, function(Reader $in) : Block{
return Blocks::STAINED_HARDENED_GLASS() return Blocks::STAINED_HARDENED_GLASS()
->setColor($in->readColor()); ->setColor($in->readColor());
@ -655,28 +722,18 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
return Blocks::STAINED_HARDENED_GLASS_PANE() return Blocks::STAINED_HARDENED_GLASS_PANE()
->setColor($in->readColor()); ->setColor($in->readColor());
}); });
$this->map(Ids::HARDENED_CLAY, fn() => Blocks::HARDENED_CLAY());
$this->map(Ids::HAY_BLOCK, function(Reader $in) : Block{ $this->map(Ids::HAY_BLOCK, function(Reader $in) : Block{
$in->ignored(StateNames::DEPRECATED); $in->ignored(StateNames::DEPRECATED);
return Blocks::HAY_BALE()->setAxis($in->readPillarAxis()); return Blocks::HAY_BALE()->setAxis($in->readPillarAxis());
}); });
$this->map(Ids::HEAVY_WEIGHTED_PRESSURE_PLATE, fn(Reader $in) => Helper::decodeWeightedPressurePlate(Blocks::WEIGHTED_PRESSURE_PLATE_HEAVY(), $in)); $this->map(Ids::HEAVY_WEIGHTED_PRESSURE_PLATE, fn(Reader $in) => Helper::decodeWeightedPressurePlate(Blocks::WEIGHTED_PRESSURE_PLATE_HEAVY(), $in));
$this->map(Ids::HONEYCOMB_BLOCK, fn() => Blocks::HONEYCOMB());
$this->map(Ids::HOPPER, function(Reader $in) : Block{ $this->map(Ids::HOPPER, function(Reader $in) : Block{
return Blocks::HOPPER() return Blocks::HOPPER()
->setFacing($in->readFacingWithoutUp()) ->setFacing($in->readFacingWithoutUp())
->setPowered($in->readBool(StateNames::TOGGLE_BIT)); ->setPowered($in->readBool(StateNames::TOGGLE_BIT));
}); });
$this->map(Ids::ICE, fn() => Blocks::ICE());
$this->map(Ids::INFO_UPDATE, fn() => Blocks::INFO_UPDATE());
$this->map(Ids::INFO_UPDATE2, fn() => Blocks::INFO_UPDATE2());
$this->map(Ids::INVISIBLE_BEDROCK, fn() => Blocks::INVISIBLE_BEDROCK());
$this->map(Ids::IRON_BARS, fn() => Blocks::IRON_BARS());
$this->map(Ids::IRON_BLOCK, fn() => Blocks::IRON());
$this->map(Ids::IRON_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::IRON_DOOR(), $in)); $this->map(Ids::IRON_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::IRON_DOOR(), $in));
$this->map(Ids::IRON_ORE, fn() => Blocks::IRON_ORE());
$this->map(Ids::IRON_TRAPDOOR, fn(Reader $in) => Helper::decodeTrapdoor(Blocks::IRON_TRAPDOOR(), $in)); $this->map(Ids::IRON_TRAPDOOR, fn(Reader $in) => Helper::decodeTrapdoor(Blocks::IRON_TRAPDOOR(), $in));
$this->map(Ids::JUKEBOX, fn() => Blocks::JUKEBOX());
$this->map(Ids::JUNGLE_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::JUNGLE_BUTTON(), $in)); $this->map(Ids::JUNGLE_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::JUNGLE_BUTTON(), $in));
$this->map(Ids::JUNGLE_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::JUNGLE_DOOR(), $in)); $this->map(Ids::JUNGLE_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::JUNGLE_DOOR(), $in));
$this->map(Ids::JUNGLE_FENCE_GATE, fn(Reader $in) => Helper::decodeFenceGate(Blocks::JUNGLE_FENCE_GATE(), $in)); $this->map(Ids::JUNGLE_FENCE_GATE, fn(Reader $in) => Helper::decodeFenceGate(Blocks::JUNGLE_FENCE_GATE(), $in));
@ -693,8 +750,6 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
return Blocks::LANTERN() return Blocks::LANTERN()
->setHanging($in->readBool(StateNames::HANGING)); ->setHanging($in->readBool(StateNames::HANGING));
}); });
$this->map(Ids::LAPIS_BLOCK, fn() => Blocks::LAPIS_LAZULI());
$this->map(Ids::LAPIS_ORE, fn() => Blocks::LAPIS_LAZULI_ORE());
$this->map(Ids::LAVA, fn(Reader $in) => Helper::decodeStillLiquid(Blocks::LAVA(), $in)); $this->map(Ids::LAVA, fn(Reader $in) => Helper::decodeStillLiquid(Blocks::LAVA(), $in));
$this->map(Ids::LEAVES, function(Reader $in) : Block{ $this->map(Ids::LEAVES, function(Reader $in) : Block{
return (match($type = $in->readString(StateNames::OLD_LEAF_TYPE)){ return (match($type = $in->readString(StateNames::OLD_LEAF_TYPE)){
@ -792,14 +847,11 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
->setFacing($in->readLegacyHorizontalFacing()); ->setFacing($in->readLegacyHorizontalFacing());
}); });
$this->map(Ids::MAGENTA_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::MAGENTA(), $in)); $this->map(Ids::MAGENTA_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::MAGENTA(), $in));
$this->map(Ids::MAGMA, fn() => Blocks::MAGMA());
$this->map(Ids::MANGROVE_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::MANGROVE_BUTTON(), $in)); $this->map(Ids::MANGROVE_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::MANGROVE_BUTTON(), $in));
$this->map(Ids::MANGROVE_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::MANGROVE_DOOR(), $in)); $this->map(Ids::MANGROVE_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::MANGROVE_DOOR(), $in));
$this->mapSlab(Ids::MANGROVE_SLAB, Ids::MANGROVE_DOUBLE_SLAB, fn() => Blocks::MANGROVE_SLAB()); $this->mapSlab(Ids::MANGROVE_SLAB, Ids::MANGROVE_DOUBLE_SLAB, fn() => Blocks::MANGROVE_SLAB());
$this->map(Ids::MANGROVE_FENCE, fn() => Blocks::MANGROVE_FENCE());
$this->map(Ids::MANGROVE_FENCE_GATE, fn(Reader $in) => Helper::decodeFenceGate(Blocks::MANGROVE_FENCE_GATE(), $in)); $this->map(Ids::MANGROVE_FENCE_GATE, fn(Reader $in) => Helper::decodeFenceGate(Blocks::MANGROVE_FENCE_GATE(), $in));
$this->map(Ids::MANGROVE_LOG, fn(Reader $in) => Helper::decodeLog(Blocks::MANGROVE_LOG(), false, $in)); $this->map(Ids::MANGROVE_LOG, fn(Reader $in) => Helper::decodeLog(Blocks::MANGROVE_LOG(), false, $in));
$this->map(Ids::MANGROVE_PLANKS, fn() => Blocks::MANGROVE_PLANKS());
$this->map(Ids::MANGROVE_PRESSURE_PLATE, fn(Reader $in) => Helper::decodeSimplePressurePlate(Blocks::MANGROVE_PRESSURE_PLATE(), $in)); $this->map(Ids::MANGROVE_PRESSURE_PLATE, fn(Reader $in) => Helper::decodeSimplePressurePlate(Blocks::MANGROVE_PRESSURE_PLATE(), $in));
$this->mapStairs(Ids::MANGROVE_STAIRS, fn() => Blocks::MANGROVE_STAIRS()); $this->mapStairs(Ids::MANGROVE_STAIRS, fn() => Blocks::MANGROVE_STAIRS());
$this->map(Ids::MANGROVE_STANDING_SIGN, fn(Reader $in) => Helper::decodeFloorSign(Blocks::MANGROVE_SIGN(), $in)); $this->map(Ids::MANGROVE_STANDING_SIGN, fn(Reader $in) => Helper::decodeFloorSign(Blocks::MANGROVE_SIGN(), $in));
@ -809,9 +861,7 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
$in->ignored(StateNames::STRIPPED_BIT); //this is also ignored by vanilla $in->ignored(StateNames::STRIPPED_BIT); //this is also ignored by vanilla
return Helper::decodeLog(Blocks::MANGROVE_WOOD(), false, $in); return Helper::decodeLog(Blocks::MANGROVE_WOOD(), false, $in);
}); });
$this->map(Ids::MELON_BLOCK, fn() => Blocks::MELON());
$this->map(Ids::MELON_STEM, fn(Reader $in) => Helper::decodeStem(Blocks::MELON_STEM(), $in)); $this->map(Ids::MELON_STEM, fn(Reader $in) => Helper::decodeStem(Blocks::MELON_STEM(), $in));
$this->map(Ids::MOB_SPAWNER, fn() => Blocks::MONSTER_SPAWNER());
$this->map(Ids::MONSTER_EGG, function(Reader $in) : Block{ $this->map(Ids::MONSTER_EGG, function(Reader $in) : Block{
return match($type = $in->readString(StateNames::MONSTER_EGG_STONE_TYPE)){ return match($type = $in->readString(StateNames::MONSTER_EGG_STONE_TYPE)){
StringValues::MONSTER_EGG_STONE_TYPE_CHISELED_STONE_BRICK => Blocks::INFESTED_CHISELED_STONE_BRICK(), StringValues::MONSTER_EGG_STONE_TYPE_CHISELED_STONE_BRICK => Blocks::INFESTED_CHISELED_STONE_BRICK(),
@ -823,36 +873,23 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
default => throw $in->badValueException(StateNames::MONSTER_EGG_STONE_TYPE, $type), default => throw $in->badValueException(StateNames::MONSTER_EGG_STONE_TYPE, $type),
}; };
}); });
$this->map(Ids::MOSSY_COBBLESTONE, fn() => Blocks::MOSSY_COBBLESTONE());
$this->mapStairs(Ids::MOSSY_COBBLESTONE_STAIRS, fn() => Blocks::MOSSY_COBBLESTONE_STAIRS()); $this->mapStairs(Ids::MOSSY_COBBLESTONE_STAIRS, fn() => Blocks::MOSSY_COBBLESTONE_STAIRS());
$this->mapStairs(Ids::MOSSY_STONE_BRICK_STAIRS, fn() => Blocks::MOSSY_STONE_BRICK_STAIRS()); $this->mapStairs(Ids::MOSSY_STONE_BRICK_STAIRS, fn() => Blocks::MOSSY_STONE_BRICK_STAIRS());
$this->map(Ids::MUD_BRICKS, fn() => Blocks::MUD_BRICKS());
$this->mapSlab(Ids::MUD_BRICK_SLAB, Ids::MUD_BRICK_DOUBLE_SLAB, fn() => Blocks::MUD_BRICK_SLAB()); $this->mapSlab(Ids::MUD_BRICK_SLAB, Ids::MUD_BRICK_DOUBLE_SLAB, fn() => Blocks::MUD_BRICK_SLAB());
$this->mapStairs(Ids::MUD_BRICK_STAIRS, fn() => Blocks::MUD_BRICK_STAIRS()); $this->mapStairs(Ids::MUD_BRICK_STAIRS, fn() => Blocks::MUD_BRICK_STAIRS());
$this->map(Ids::MUD_BRICK_WALL, fn(Reader $in) => Helper::decodeWall(Blocks::MUD_BRICK_WALL(), $in)); $this->map(Ids::MUD_BRICK_WALL, fn(Reader $in) => Helper::decodeWall(Blocks::MUD_BRICK_WALL(), $in));
$this->map(Ids::MYCELIUM, fn() => Blocks::MYCELIUM());
$this->map(Ids::NETHER_BRICK, fn() => Blocks::NETHER_BRICKS());
$this->map(Ids::NETHER_BRICK_FENCE, fn() => Blocks::NETHER_BRICK_FENCE());
$this->mapStairs(Ids::NETHER_BRICK_STAIRS, fn() => Blocks::NETHER_BRICK_STAIRS()); $this->mapStairs(Ids::NETHER_BRICK_STAIRS, fn() => Blocks::NETHER_BRICK_STAIRS());
$this->map(Ids::NETHER_GOLD_ORE, fn() => Blocks::NETHER_GOLD_ORE());
$this->map(Ids::NETHER_WART, function(Reader $in) : Block{ $this->map(Ids::NETHER_WART, function(Reader $in) : Block{
return Blocks::NETHER_WART() return Blocks::NETHER_WART()
->setAge($in->readBoundedInt(StateNames::AGE, 0, 3)); ->setAge($in->readBoundedInt(StateNames::AGE, 0, 3));
}); });
$this->map(Ids::NETHER_WART_BLOCK, fn() => Blocks::NETHER_WART_BLOCK());
$this->map(Ids::NETHERITE_BLOCK, fn() => Blocks::NETHERITE());
$this->map(Ids::NETHERRACK, fn() => Blocks::NETHERRACK());
$this->map(Ids::NETHERREACTOR, fn() => Blocks::NETHER_REACTOR_CORE());
$this->mapStairs(Ids::NORMAL_STONE_STAIRS, fn() => Blocks::STONE_STAIRS()); $this->mapStairs(Ids::NORMAL_STONE_STAIRS, fn() => Blocks::STONE_STAIRS());
$this->map(Ids::NOTEBLOCK, fn() => Blocks::NOTE_BLOCK());
$this->mapStairs(Ids::OAK_STAIRS, fn() => Blocks::OAK_STAIRS()); $this->mapStairs(Ids::OAK_STAIRS, fn() => Blocks::OAK_STAIRS());
$this->map(Ids::OBSIDIAN, fn() => Blocks::OBSIDIAN());
$this->map(Ids::ORANGE_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::ORANGE(), $in)); $this->map(Ids::ORANGE_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::ORANGE(), $in));
$this->map(Ids::OXIDIZED_COPPER, fn() => Helper::decodeCopper(Blocks::COPPER(), CopperOxidation::OXIDIZED())); $this->map(Ids::OXIDIZED_COPPER, fn() => Helper::decodeCopper(Blocks::COPPER(), CopperOxidation::OXIDIZED()));
$this->map(Ids::OXIDIZED_CUT_COPPER, fn() => Helper::decodeCopper(Blocks::CUT_COPPER(), CopperOxidation::OXIDIZED())); $this->map(Ids::OXIDIZED_CUT_COPPER, fn() => Helper::decodeCopper(Blocks::CUT_COPPER(), CopperOxidation::OXIDIZED()));
$this->mapSlab(Ids::OXIDIZED_CUT_COPPER_SLAB, Ids::OXIDIZED_DOUBLE_CUT_COPPER_SLAB, fn() => Helper::decodeCopper(Blocks::CUT_COPPER_SLAB(), CopperOxidation::OXIDIZED())); $this->mapSlab(Ids::OXIDIZED_CUT_COPPER_SLAB, Ids::OXIDIZED_DOUBLE_CUT_COPPER_SLAB, fn() => Helper::decodeCopper(Blocks::CUT_COPPER_SLAB(), CopperOxidation::OXIDIZED()));
$this->mapStairs(Ids::OXIDIZED_CUT_COPPER_STAIRS, fn() => Helper::decodeCopper(Blocks::CUT_COPPER_STAIRS(), CopperOxidation::OXIDIZED())); $this->mapStairs(Ids::OXIDIZED_CUT_COPPER_STAIRS, fn() => Helper::decodeCopper(Blocks::CUT_COPPER_STAIRS(), CopperOxidation::OXIDIZED()));
$this->map(Ids::PACKED_ICE, fn() => Blocks::PACKED_ICE());
$this->map(Ids::PINK_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::PINK(), $in)); $this->map(Ids::PINK_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::PINK(), $in));
$this->map(Ids::PLANKS, function(Reader $in) : Block{ $this->map(Ids::PLANKS, function(Reader $in) : Block{
return match($woodName = $in->readString(StateNames::WOOD_TYPE)){ return match($woodName = $in->readString(StateNames::WOOD_TYPE)){
@ -865,23 +902,19 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
default => throw $in->badValueException(StateNames::WOOD_TYPE, $woodName), default => throw $in->badValueException(StateNames::WOOD_TYPE, $woodName),
}; };
}); });
$this->map(Ids::PODZOL, fn() => Blocks::PODZOL());
$this->mapStairs(Ids::POLISHED_ANDESITE_STAIRS, fn() => Blocks::POLISHED_ANDESITE_STAIRS()); $this->mapStairs(Ids::POLISHED_ANDESITE_STAIRS, fn() => Blocks::POLISHED_ANDESITE_STAIRS());
$this->map(Ids::POLISHED_BASALT, function(Reader $in) : Block{ $this->map(Ids::POLISHED_BASALT, function(Reader $in) : Block{
return Blocks::POLISHED_BASALT() return Blocks::POLISHED_BASALT()
->setAxis($in->readPillarAxis()); ->setAxis($in->readPillarAxis());
}); });
$this->map(Ids::POLISHED_BLACKSTONE, fn() => Blocks::POLISHED_BLACKSTONE());
$this->map(Ids::POLISHED_BLACKSTONE_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::POLISHED_BLACKSTONE_BUTTON(), $in)); $this->map(Ids::POLISHED_BLACKSTONE_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::POLISHED_BLACKSTONE_BUTTON(), $in));
$this->mapSlab(Ids::POLISHED_BLACKSTONE_SLAB, Ids::POLISHED_BLACKSTONE_DOUBLE_SLAB, fn() => Blocks::POLISHED_BLACKSTONE_SLAB()); $this->mapSlab(Ids::POLISHED_BLACKSTONE_SLAB, Ids::POLISHED_BLACKSTONE_DOUBLE_SLAB, fn() => Blocks::POLISHED_BLACKSTONE_SLAB());
$this->map(Ids::POLISHED_BLACKSTONE_PRESSURE_PLATE, fn(Reader $in) => Helper::decodeSimplePressurePlate(Blocks::POLISHED_BLACKSTONE_PRESSURE_PLATE(), $in)); $this->map(Ids::POLISHED_BLACKSTONE_PRESSURE_PLATE, fn(Reader $in) => Helper::decodeSimplePressurePlate(Blocks::POLISHED_BLACKSTONE_PRESSURE_PLATE(), $in));
$this->mapStairs(Ids::POLISHED_BLACKSTONE_STAIRS, fn() => Blocks::POLISHED_BLACKSTONE_STAIRS()); $this->mapStairs(Ids::POLISHED_BLACKSTONE_STAIRS, fn() => Blocks::POLISHED_BLACKSTONE_STAIRS());
$this->map(Ids::POLISHED_BLACKSTONE_WALL, fn(Reader $in) => Helper::decodeWall(Blocks::POLISHED_BLACKSTONE_WALL(), $in)); $this->map(Ids::POLISHED_BLACKSTONE_WALL, fn(Reader $in) => Helper::decodeWall(Blocks::POLISHED_BLACKSTONE_WALL(), $in));
$this->map(Ids::POLISHED_BLACKSTONE_BRICKS, fn() => Blocks::POLISHED_BLACKSTONE_BRICKS());
$this->mapSlab(Ids::POLISHED_BLACKSTONE_BRICK_SLAB, Ids::POLISHED_BLACKSTONE_BRICK_DOUBLE_SLAB, fn() => Blocks::POLISHED_BLACKSTONE_BRICK_SLAB()); $this->mapSlab(Ids::POLISHED_BLACKSTONE_BRICK_SLAB, Ids::POLISHED_BLACKSTONE_BRICK_DOUBLE_SLAB, fn() => Blocks::POLISHED_BLACKSTONE_BRICK_SLAB());
$this->mapStairs(Ids::POLISHED_BLACKSTONE_BRICK_STAIRS, fn() => Blocks::POLISHED_BLACKSTONE_BRICK_STAIRS()); $this->mapStairs(Ids::POLISHED_BLACKSTONE_BRICK_STAIRS, fn() => Blocks::POLISHED_BLACKSTONE_BRICK_STAIRS());
$this->map(Ids::POLISHED_BLACKSTONE_BRICK_WALL, fn(Reader $in) => Helper::decodeWall(Blocks::POLISHED_BLACKSTONE_BRICK_WALL(), $in)); $this->map(Ids::POLISHED_BLACKSTONE_BRICK_WALL, fn(Reader $in) => Helper::decodeWall(Blocks::POLISHED_BLACKSTONE_BRICK_WALL(), $in));
$this->map(Ids::POLISHED_DEEPSLATE, fn() => Blocks::POLISHED_DEEPSLATE());
$this->mapSlab(Ids::POLISHED_DEEPSLATE_SLAB, Ids::POLISHED_DEEPSLATE_DOUBLE_SLAB, fn() => Blocks::POLISHED_DEEPSLATE_SLAB()); $this->mapSlab(Ids::POLISHED_DEEPSLATE_SLAB, Ids::POLISHED_DEEPSLATE_DOUBLE_SLAB, fn() => Blocks::POLISHED_DEEPSLATE_SLAB());
$this->mapStairs(Ids::POLISHED_DEEPSLATE_STAIRS, fn() => Blocks::POLISHED_DEEPSLATE_STAIRS()); $this->mapStairs(Ids::POLISHED_DEEPSLATE_STAIRS, fn() => Blocks::POLISHED_DEEPSLATE_STAIRS());
$this->map(Ids::POLISHED_DEEPSLATE_WALL, fn(Reader $in) => Helper::decodeWall(Blocks::POLISHED_DEEPSLATE_WALL(), $in)); $this->map(Ids::POLISHED_DEEPSLATE_WALL, fn(Reader $in) => Helper::decodeWall(Blocks::POLISHED_DEEPSLATE_WALL(), $in));
@ -947,16 +980,11 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
return throw $in->badValueException(StateNames::CHISEL_TYPE, $type); return throw $in->badValueException(StateNames::CHISEL_TYPE, $type);
} }
}); });
$this->map(Ids::QUARTZ_BRICKS, fn() => Blocks::QUARTZ_BRICKS());
$this->map(Ids::QUARTZ_ORE, fn() => Blocks::NETHER_QUARTZ_ORE());
$this->mapStairs(Ids::QUARTZ_STAIRS, fn() => Blocks::QUARTZ_STAIRS()); $this->mapStairs(Ids::QUARTZ_STAIRS, fn() => Blocks::QUARTZ_STAIRS());
$this->map(Ids::RAIL, function(Reader $in) : Block{ $this->map(Ids::RAIL, function(Reader $in) : Block{
return Blocks::RAIL() return Blocks::RAIL()
->setShape($in->readBoundedInt(StateNames::RAIL_DIRECTION, 0, 9)); ->setShape($in->readBoundedInt(StateNames::RAIL_DIRECTION, 0, 9));
}); });
$this->map(Ids::RAW_COPPER_BLOCK, fn() => Blocks::RAW_COPPER());
$this->map(Ids::RAW_GOLD_BLOCK, fn() => Blocks::RAW_GOLD());
$this->map(Ids::RAW_IRON_BLOCK, fn() => Blocks::RAW_IRON());
$this->map(Ids::RED_FLOWER, function(Reader $in) : Block{ $this->map(Ids::RED_FLOWER, function(Reader $in) : Block{
return match($type = $in->readString(StateNames::FLOWER_TYPE)){ return match($type = $in->readString(StateNames::FLOWER_TYPE)){
StringValues::FLOWER_TYPE_ALLIUM => Blocks::ALLIUM(), StringValues::FLOWER_TYPE_ALLIUM => Blocks::ALLIUM(),
@ -974,9 +1002,7 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
}; };
}); });
$this->map(Ids::RED_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::RED(), $in)); $this->map(Ids::RED_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::RED(), $in));
$this->map(Ids::RED_MUSHROOM, fn() => Blocks::RED_MUSHROOM());
$this->map(Ids::RED_MUSHROOM_BLOCK, fn(Reader $in) => Helper::decodeMushroomBlock(Blocks::RED_MUSHROOM_BLOCK(), $in)); $this->map(Ids::RED_MUSHROOM_BLOCK, fn(Reader $in) => Helper::decodeMushroomBlock(Blocks::RED_MUSHROOM_BLOCK(), $in));
$this->map(Ids::RED_NETHER_BRICK, fn() => Blocks::RED_NETHER_BRICKS());
$this->mapStairs(Ids::RED_NETHER_BRICK_STAIRS, fn() => Blocks::RED_NETHER_BRICK_STAIRS()); $this->mapStairs(Ids::RED_NETHER_BRICK_STAIRS, fn() => Blocks::RED_NETHER_BRICK_STAIRS());
$this->map(Ids::RED_SANDSTONE, function(Reader $in) : Block{ $this->map(Ids::RED_SANDSTONE, function(Reader $in) : Block{
return match($type = $in->readString(StateNames::SAND_STONE_TYPE)){ return match($type = $in->readString(StateNames::SAND_STONE_TYPE)){
@ -988,7 +1014,6 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
}; };
}); });
$this->mapStairs(Ids::RED_SANDSTONE_STAIRS, fn() => Blocks::RED_SANDSTONE_STAIRS()); $this->mapStairs(Ids::RED_SANDSTONE_STAIRS, fn() => Blocks::RED_SANDSTONE_STAIRS());
$this->map(Ids::REDSTONE_BLOCK, fn() => Blocks::REDSTONE());
$this->map(Ids::REDSTONE_LAMP, function() : Block{ $this->map(Ids::REDSTONE_LAMP, function() : Block{
return Blocks::REDSTONE_LAMP() return Blocks::REDSTONE_LAMP()
->setPowered(false); ->setPowered(false);
@ -1010,7 +1035,6 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
return Blocks::SUGARCANE() return Blocks::SUGARCANE()
->setAge($in->readBoundedInt(StateNames::AGE, 0, 15)); ->setAge($in->readBoundedInt(StateNames::AGE, 0, 15));
}); });
$this->map(Ids::RESERVED6, fn() => Blocks::RESERVED6());
$this->map(Ids::SAND, function(Reader $in) : Block{ $this->map(Ids::SAND, function(Reader $in) : Block{
return match($value = $in->readString(StateNames::SAND_TYPE)){ return match($value = $in->readString(StateNames::SAND_TYPE)){
StringValues::SAND_TYPE_NORMAL => Blocks::SAND(), StringValues::SAND_TYPE_NORMAL => Blocks::SAND(),
@ -1040,13 +1064,11 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
}) })
->setReady($in->readBool(StateNames::AGE_BIT)); ->setReady($in->readBool(StateNames::AGE_BIT));
}); });
$this->map(Ids::SEA_LANTERN, fn() => Blocks::SEA_LANTERN());
$this->map(Ids::SEA_PICKLE, function(Reader $in) : Block{ $this->map(Ids::SEA_PICKLE, function(Reader $in) : Block{
return Blocks::SEA_PICKLE() return Blocks::SEA_PICKLE()
->setCount($in->readBoundedInt(StateNames::CLUSTER_COUNT, 0, 3) + 1) ->setCount($in->readBoundedInt(StateNames::CLUSTER_COUNT, 0, 3) + 1)
->setUnderwater(!$in->readBool(StateNames::DEAD_BIT)); ->setUnderwater(!$in->readBool(StateNames::DEAD_BIT));
}); });
$this->map(Ids::SHROOMLIGHT, fn() => Blocks::SHROOMLIGHT());
$this->map(Ids::SHULKER_BOX, function(Reader $in) : Block{ $this->map(Ids::SHULKER_BOX, function(Reader $in) : Block{
return Blocks::DYED_SHULKER_BOX() return Blocks::DYED_SHULKER_BOX()
->setColor($in->readColor()); ->setColor($in->readColor());
@ -1056,19 +1078,14 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
return Blocks::MOB_HEAD() return Blocks::MOB_HEAD()
->setFacing($in->readFacingWithoutDown()); ->setFacing($in->readFacingWithoutDown());
}); });
$this->map(Ids::SLIME, fn() => Blocks::SLIME());
$this->map(Ids::SMITHING_TABLE, fn() => Blocks::SMITHING_TABLE());
$this->map(Ids::SMOKER, function(Reader $in) : Block{ $this->map(Ids::SMOKER, function(Reader $in) : Block{
return Blocks::SMOKER() return Blocks::SMOKER()
->setFacing($in->readHorizontalFacing()) ->setFacing($in->readHorizontalFacing())
->setLit(false); ->setLit(false);
}); });
$this->map(Ids::SMOOTH_BASALT, fn() => Blocks::SMOOTH_BASALT());
$this->mapStairs(Ids::SMOOTH_QUARTZ_STAIRS, fn() => Blocks::SMOOTH_QUARTZ_STAIRS()); $this->mapStairs(Ids::SMOOTH_QUARTZ_STAIRS, fn() => Blocks::SMOOTH_QUARTZ_STAIRS());
$this->mapStairs(Ids::SMOOTH_RED_SANDSTONE_STAIRS, fn() => Blocks::SMOOTH_RED_SANDSTONE_STAIRS()); $this->mapStairs(Ids::SMOOTH_RED_SANDSTONE_STAIRS, fn() => Blocks::SMOOTH_RED_SANDSTONE_STAIRS());
$this->mapStairs(Ids::SMOOTH_SANDSTONE_STAIRS, fn() => Blocks::SMOOTH_SANDSTONE_STAIRS()); $this->mapStairs(Ids::SMOOTH_SANDSTONE_STAIRS, fn() => Blocks::SMOOTH_SANDSTONE_STAIRS());
$this->map(Ids::SMOOTH_STONE, fn() => Blocks::SMOOTH_STONE());
$this->map(Ids::SNOW, fn() => Blocks::SNOW());
$this->map(Ids::SNOW_LAYER, function(Reader $in) : Block{ $this->map(Ids::SNOW_LAYER, function(Reader $in) : Block{
$in->ignored(StateNames::COVERED_BIT); //seems to be useless $in->ignored(StateNames::COVERED_BIT); //seems to be useless
return Blocks::SNOW_LAYER()->setLayers($in->readBoundedInt(StateNames::HEIGHT, 0, 7) + 1); return Blocks::SNOW_LAYER()->setLayers($in->readBoundedInt(StateNames::HEIGHT, 0, 7) + 1);
@ -1081,8 +1098,6 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
return Blocks::SOUL_LANTERN() return Blocks::SOUL_LANTERN()
->setHanging($in->readBool(StateNames::HANGING)); ->setHanging($in->readBool(StateNames::HANGING));
}); });
$this->map(Ids::SOUL_SAND, fn() => Blocks::SOUL_SAND());
$this->map(Ids::SOUL_SOIL, fn() => Blocks::SOUL_SOIL());
$this->map(Ids::SOUL_TORCH, function(Reader $in) : Block{ $this->map(Ids::SOUL_TORCH, function(Reader $in) : Block{
return Blocks::SOUL_TORCH() return Blocks::SOUL_TORCH()
->setFacing($in->readTorchFacing()); ->setFacing($in->readTorchFacing());
@ -1149,7 +1164,6 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
default => throw $in->badValueException(StateNames::STONE_BRICK_TYPE, $type), default => throw $in->badValueException(StateNames::STONE_BRICK_TYPE, $type),
}; };
}); });
$this->map(Ids::STONECUTTER, fn() => Blocks::LEGACY_STONECUTTER());
$this->map(Ids::STONECUTTER_BLOCK, function(Reader $in) : Block{ $this->map(Ids::STONECUTTER_BLOCK, function(Reader $in) : Block{
return Blocks::STONECUTTER() return Blocks::STONECUTTER()
->setFacing($in->readHorizontalFacing()); ->setFacing($in->readHorizontalFacing());
@ -1179,7 +1193,6 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
default => throw $in->badValueException(StateNames::TALL_GRASS_TYPE, $type), default => throw $in->badValueException(StateNames::TALL_GRASS_TYPE, $type),
}; };
}); });
$this->map(Ids::TINTED_GLASS, fn() => Blocks::TINTED_GLASS());
$this->map(Ids::TNT, function(Reader $in) : Block{ $this->map(Ids::TNT, function(Reader $in) : Block{
return Blocks::TNT() return Blocks::TNT()
->setUnstable($in->readBool(StateNames::EXPLODE_BIT)) ->setUnstable($in->readBool(StateNames::EXPLODE_BIT))
@ -1207,12 +1220,10 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
->setFacing($in->readLegacyHorizontalFacing()) ->setFacing($in->readLegacyHorizontalFacing())
->setPowered($in->readBool(StateNames::POWERED_BIT)); ->setPowered($in->readBool(StateNames::POWERED_BIT));
}); });
$this->map(Ids::TUFF, fn() => Blocks::TUFF());
$this->map(Ids::UNDERWATER_TORCH, function(Reader $in) : Block{ $this->map(Ids::UNDERWATER_TORCH, function(Reader $in) : Block{
return Blocks::UNDERWATER_TORCH() return Blocks::UNDERWATER_TORCH()
->setFacing($in->readTorchFacing()); ->setFacing($in->readTorchFacing());
}); });
$this->map(Ids::UNDYED_SHULKER_BOX, fn() => Blocks::SHULKER_BOX());
$this->map(Ids::UNLIT_REDSTONE_TORCH, function(Reader $in) : Block{ $this->map(Ids::UNLIT_REDSTONE_TORCH, function(Reader $in) : Block{
return Blocks::REDSTONE_TORCH() return Blocks::REDSTONE_TORCH()
->setFacing($in->readTorchFacing()) ->setFacing($in->readTorchFacing())
@ -1237,19 +1248,15 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
$this->map(Ids::WARPED_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::WARPED_BUTTON(), $in)); $this->map(Ids::WARPED_BUTTON, fn(Reader $in) => Helper::decodeButton(Blocks::WARPED_BUTTON(), $in));
$this->map(Ids::WARPED_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::WARPED_DOOR(), $in)); $this->map(Ids::WARPED_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::WARPED_DOOR(), $in));
$this->mapSlab(Ids::WARPED_SLAB, Ids::WARPED_DOUBLE_SLAB, fn() => Blocks::WARPED_SLAB()); $this->mapSlab(Ids::WARPED_SLAB, Ids::WARPED_DOUBLE_SLAB, fn() => Blocks::WARPED_SLAB());
$this->map(Ids::WARPED_FENCE, fn() => Blocks::WARPED_FENCE());
$this->map(Ids::WARPED_FENCE_GATE, fn(Reader $in) => Helper::decodeFenceGate(Blocks::WARPED_FENCE_GATE(), $in)); $this->map(Ids::WARPED_FENCE_GATE, fn(Reader $in) => Helper::decodeFenceGate(Blocks::WARPED_FENCE_GATE(), $in));
$this->map(Ids::WARPED_HYPHAE, fn(Reader $in) => Helper::decodeLog(Blocks::WARPED_HYPHAE(), false, $in)); $this->map(Ids::WARPED_HYPHAE, fn(Reader $in) => Helper::decodeLog(Blocks::WARPED_HYPHAE(), false, $in));
$this->map(Ids::WARPED_PLANKS, fn() => Blocks::WARPED_PLANKS());
$this->map(Ids::WARPED_PRESSURE_PLATE, fn(Reader $in) => Helper::decodeSimplePressurePlate(Blocks::WARPED_PRESSURE_PLATE(), $in)); $this->map(Ids::WARPED_PRESSURE_PLATE, fn(Reader $in) => Helper::decodeSimplePressurePlate(Blocks::WARPED_PRESSURE_PLATE(), $in));
$this->mapStairs(Ids::WARPED_STAIRS, fn() => Blocks::WARPED_STAIRS()); $this->mapStairs(Ids::WARPED_STAIRS, fn() => Blocks::WARPED_STAIRS());
$this->map(Ids::WARPED_STANDING_SIGN, fn(Reader $in) => Helper::decodeFloorSign(Blocks::WARPED_SIGN(), $in)); $this->map(Ids::WARPED_STANDING_SIGN, fn(Reader $in) => Helper::decodeFloorSign(Blocks::WARPED_SIGN(), $in));
$this->map(Ids::WARPED_STEM, fn(Reader $in) => Helper::decodeLog(Blocks::WARPED_STEM(), false, $in)); $this->map(Ids::WARPED_STEM, fn(Reader $in) => Helper::decodeLog(Blocks::WARPED_STEM(), false, $in));
$this->map(Ids::WARPED_TRAPDOOR, fn(Reader $in) => Helper::decodeTrapdoor(Blocks::WARPED_TRAPDOOR(), $in)); $this->map(Ids::WARPED_TRAPDOOR, fn(Reader $in) => Helper::decodeTrapdoor(Blocks::WARPED_TRAPDOOR(), $in));
$this->map(Ids::WARPED_WALL_SIGN, fn(Reader $in) => Helper::decodeWallSign(Blocks::WARPED_WALL_SIGN(), $in)); $this->map(Ids::WARPED_WALL_SIGN, fn(Reader $in) => Helper::decodeWallSign(Blocks::WARPED_WALL_SIGN(), $in));
$this->map(Ids::WARPED_WART_BLOCK, fn() => Blocks::WARPED_WART_BLOCK());
$this->map(Ids::WATER, fn(Reader $in) => Helper::decodeStillLiquid(Blocks::WATER(), $in)); $this->map(Ids::WATER, fn(Reader $in) => Helper::decodeStillLiquid(Blocks::WATER(), $in));
$this->map(Ids::WATERLILY, fn() => Blocks::LILY_PAD());
$this->map(Ids::WAXED_COPPER, fn() => Helper::decodeWaxedCopper(Blocks::COPPER(), CopperOxidation::NONE())); $this->map(Ids::WAXED_COPPER, fn() => Helper::decodeWaxedCopper(Blocks::COPPER(), CopperOxidation::NONE()));
$this->map(Ids::WAXED_CUT_COPPER, fn() => Helper::decodeWaxedCopper(Blocks::CUT_COPPER(), CopperOxidation::NONE())); $this->map(Ids::WAXED_CUT_COPPER, fn() => Helper::decodeWaxedCopper(Blocks::CUT_COPPER(), CopperOxidation::NONE()));
$this->mapSlab(Ids::WAXED_CUT_COPPER_SLAB, Ids::WAXED_DOUBLE_CUT_COPPER_SLAB, fn() => Helper::decodeWaxedCopper(Blocks::CUT_COPPER_SLAB(), CopperOxidation::NONE())); $this->mapSlab(Ids::WAXED_CUT_COPPER_SLAB, Ids::WAXED_DOUBLE_CUT_COPPER_SLAB, fn() => Helper::decodeWaxedCopper(Blocks::CUT_COPPER_SLAB(), CopperOxidation::NONE()));
@ -1270,10 +1277,8 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
$this->map(Ids::WEATHERED_CUT_COPPER, fn() => Helper::decodeCopper(Blocks::CUT_COPPER(), CopperOxidation::WEATHERED())); $this->map(Ids::WEATHERED_CUT_COPPER, fn() => Helper::decodeCopper(Blocks::CUT_COPPER(), CopperOxidation::WEATHERED()));
$this->mapSlab(Ids::WEATHERED_CUT_COPPER_SLAB, Ids::WEATHERED_DOUBLE_CUT_COPPER_SLAB, fn() => Helper::decodeCopper(Blocks::CUT_COPPER_SLAB(), CopperOxidation::WEATHERED())); $this->mapSlab(Ids::WEATHERED_CUT_COPPER_SLAB, Ids::WEATHERED_DOUBLE_CUT_COPPER_SLAB, fn() => Helper::decodeCopper(Blocks::CUT_COPPER_SLAB(), CopperOxidation::WEATHERED()));
$this->mapStairs(Ids::WEATHERED_CUT_COPPER_STAIRS, fn() => Helper::decodeCopper(Blocks::CUT_COPPER_STAIRS(), CopperOxidation::WEATHERED())); $this->mapStairs(Ids::WEATHERED_CUT_COPPER_STAIRS, fn() => Helper::decodeCopper(Blocks::CUT_COPPER_STAIRS(), CopperOxidation::WEATHERED()));
$this->map(Ids::WEB, fn() => Blocks::COBWEB());
$this->map(Ids::WHEAT, fn(Reader $in) => Helper::decodeCrops(Blocks::WHEAT(), $in)); $this->map(Ids::WHEAT, fn(Reader $in) => Helper::decodeCrops(Blocks::WHEAT(), $in));
$this->map(Ids::WHITE_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::WHITE(), $in)); $this->map(Ids::WHITE_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::WHITE(), $in));
$this->map(Ids::WITHER_ROSE, fn() => Blocks::WITHER_ROSE());
$this->map(Ids::WOOD, fn(Reader $in) : Block => Helper::decodeLog(match($woodType = $in->readString(StateNames::WOOD_TYPE)){ $this->map(Ids::WOOD, fn(Reader $in) : Block => Helper::decodeLog(match($woodType = $in->readString(StateNames::WOOD_TYPE)){
StringValues::WOOD_TYPE_ACACIA => Blocks::ACACIA_WOOD(), StringValues::WOOD_TYPE_ACACIA => Blocks::ACACIA_WOOD(),
StringValues::WOOD_TYPE_BIRCH => Blocks::BIRCH_WOOD(), StringValues::WOOD_TYPE_BIRCH => Blocks::BIRCH_WOOD(),
@ -1291,7 +1296,6 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
return Blocks::WOOL() return Blocks::WOOL()
->setColor($in->readColor()); ->setColor($in->readColor());
}); });
$this->map(Ids::YELLOW_FLOWER, fn() => Blocks::DANDELION());
$this->map(Ids::YELLOW_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::YELLOW(), $in)); $this->map(Ids::YELLOW_GLAZED_TERRACOTTA, fn(Reader $in) => Helper::decodeGlazedTerracotta(DyeColor::YELLOW(), $in));
} }