Generate property-aware block stubs
Some checks failed
Build / build (push) Failing after 2m54s
Release Dry Run / release-dry-run (push) Successful in 4s
Codex Template Compliance / template-compliance (push) Successful in 4s

This commit is contained in:
Codex
2026-05-09 23:31:23 +02:00
parent aa95d64125
commit 05ca807325
2 changed files with 539 additions and 3 deletions

View File

@@ -1,4 +1,454 @@
{
"block_kinds": {
"active_robot_chute": "plain",
"advanced_alloy_block": "plain",
"after_burner": "horizontal",
"ai_mine": "plain",
"aimer_node": "plain",
"aluminum_ac_barrel": "horizontal",
"aluminum_ac_barrel_black": "horizontal",
"aluminum_ac_barrel_blue": "horizontal",
"aluminum_ac_barrel_brown": "horizontal",
"aluminum_ac_barrel_cyan": "horizontal",
"aluminum_ac_barrel_dark_gray": "horizontal",
"aluminum_ac_barrel_gray": "horizontal",
"aluminum_ac_barrel_green": "horizontal",
"aluminum_ac_barrel_light_blue": "horizontal",
"aluminum_ac_barrel_light_gray": "horizontal",
"aluminum_ac_barrel_lime": "horizontal",
"aluminum_ac_barrel_magenta": "horizontal",
"aluminum_ac_barrel_orange": "horizontal",
"aluminum_ac_barrel_pink": "horizontal",
"aluminum_ac_barrel_purple": "horizontal",
"aluminum_ac_barrel_red": "horizontal",
"aluminum_ac_barrel_white": "horizontal",
"aluminum_ac_barrel_yellow": "horizontal",
"aluminum_block": "plain",
"aluminum_plating": "plain",
"aluminum_plating_black": "plain",
"aluminum_plating_blue": "plain",
"aluminum_plating_brown": "plain",
"aluminum_plating_cyan": "plain",
"aluminum_plating_dark_gray": "plain",
"aluminum_plating_gray": "plain",
"aluminum_plating_green": "plain",
"aluminum_plating_light_blue": "plain",
"aluminum_plating_light_gray": "plain",
"aluminum_plating_lime": "plain",
"aluminum_plating_magenta": "plain",
"aluminum_plating_orange": "plain",
"aluminum_plating_pink": "plain",
"aluminum_plating_purple": "plain",
"aluminum_plating_red": "plain",
"aluminum_plating_slab": "slab",
"aluminum_plating_slab_black": "slab",
"aluminum_plating_slab_blue": "slab",
"aluminum_plating_slab_brown": "slab",
"aluminum_plating_slab_cyan": "slab",
"aluminum_plating_slab_dark_gray": "slab",
"aluminum_plating_slab_gray": "slab",
"aluminum_plating_slab_green": "slab",
"aluminum_plating_slab_light_blue": "slab",
"aluminum_plating_slab_light_gray": "slab",
"aluminum_plating_slab_lime": "slab",
"aluminum_plating_slab_magenta": "slab",
"aluminum_plating_slab_orange": "slab",
"aluminum_plating_slab_pink": "slab",
"aluminum_plating_slab_purple": "slab",
"aluminum_plating_slab_red": "slab",
"aluminum_plating_slab_white": "slab",
"aluminum_plating_slab_yellow": "slab",
"aluminum_plating_stairs": "stairs",
"aluminum_plating_stairs_black": "stairs",
"aluminum_plating_stairs_blue": "stairs",
"aluminum_plating_stairs_brown": "stairs",
"aluminum_plating_stairs_cyan": "stairs",
"aluminum_plating_stairs_dark_gray": "stairs",
"aluminum_plating_stairs_gray": "stairs",
"aluminum_plating_stairs_green": "stairs",
"aluminum_plating_stairs_light_blue": "stairs",
"aluminum_plating_stairs_light_gray": "stairs",
"aluminum_plating_stairs_lime": "stairs",
"aluminum_plating_stairs_magenta": "stairs",
"aluminum_plating_stairs_orange": "stairs",
"aluminum_plating_stairs_pink": "stairs",
"aluminum_plating_stairs_purple": "stairs",
"aluminum_plating_stairs_red": "stairs",
"aluminum_plating_stairs_white": "stairs",
"aluminum_plating_stairs_yellow": "stairs",
"aluminum_plating_trapdoor": "trapdoor",
"aluminum_plating_trapdoor_black": "trapdoor",
"aluminum_plating_trapdoor_blue": "trapdoor",
"aluminum_plating_trapdoor_brown": "trapdoor",
"aluminum_plating_trapdoor_cyan": "trapdoor",
"aluminum_plating_trapdoor_dark_gray": "trapdoor",
"aluminum_plating_trapdoor_gray": "trapdoor",
"aluminum_plating_trapdoor_green": "trapdoor",
"aluminum_plating_trapdoor_light_blue": "trapdoor",
"aluminum_plating_trapdoor_light_gray": "trapdoor",
"aluminum_plating_trapdoor_lime": "trapdoor",
"aluminum_plating_trapdoor_magenta": "trapdoor",
"aluminum_plating_trapdoor_orange": "trapdoor",
"aluminum_plating_trapdoor_pink": "trapdoor",
"aluminum_plating_trapdoor_purple": "trapdoor",
"aluminum_plating_trapdoor_red": "trapdoor",
"aluminum_plating_trapdoor_white": "trapdoor",
"aluminum_plating_trapdoor_yellow": "trapdoor",
"aluminum_plating_white": "plain",
"aluminum_plating_yellow": "plain",
"aluminum_side_panel": "horizontal",
"aluminum_side_panel_black": "horizontal",
"aluminum_side_panel_blue": "horizontal",
"aluminum_side_panel_brown": "horizontal",
"aluminum_side_panel_cyan": "horizontal",
"aluminum_side_panel_dark_gray": "horizontal",
"aluminum_side_panel_gray": "horizontal",
"aluminum_side_panel_green": "horizontal",
"aluminum_side_panel_light_blue": "horizontal",
"aluminum_side_panel_light_gray": "horizontal",
"aluminum_side_panel_lime": "horizontal",
"aluminum_side_panel_magenta": "horizontal",
"aluminum_side_panel_orange": "horizontal",
"aluminum_side_panel_pink": "horizontal",
"aluminum_side_panel_purple": "horizontal",
"aluminum_side_panel_red": "horizontal",
"aluminum_side_panel_white": "horizontal",
"aluminum_side_panel_yellow": "horizontal",
"ancient_light": "plain",
"ancient_well": "plain",
"artillery_autoloader": "horizontal",
"artillery_barrel": "horizontal",
"artillery_charge_loader": "horizontal",
"artillerybreech": "horizontal",
"asphalt": "plain",
"asphalt_slab": "slab",
"assembly_centrifuge_bottom": "horizontal",
"assembly_centrifuge_middle": "horizontal",
"assembly_centrifuge_top": "horizontal",
"assembly_circuit_fabricator": "horizontal",
"assembly_crusher": "horizontal",
"assembly_depot": "horizontal",
"assembly_furnace": "horizontal",
"assembly_machine": "horizontal",
"assembly_mechanical_fabricator": "horizontal",
"autocannon": "horizontal",
"autocannon_barrel": "horizontal",
"autocannon_drum": "horizontal",
"autoloader": "horizontal",
"battle_cannon_barrel": "horizontal",
"battle_cannon_breech": "horizontal",
"battle_cannon_mantlet": "horizontal",
"bauxite": "plain",
"bauxite_digester": "horizontal",
"beryllium_block": "plain",
"beryllium_ore": "plain",
"black_armor": "plain",
"black_armor_optic": "horizontal",
"black_armor_slab": "slab",
"black_armor_stairs": "stairs",
"black_armor_trapdoor": "trapdoor",
"blast_funnel": "plain",
"blast_furnace": "horizontal",
"blast_furnace_bricks": "plain",
"blue_armor": "plain",
"blue_armor_optic": "horizontal",
"blue_armor_slab": "slab",
"blue_armor_stairs": "stairs",
"blue_armor_trapdoor": "trapdoor",
"brass_block": "plain",
"breeder_reactor_core": "plain",
"breeder_reactor_interface": "plain",
"breeder_reactor_port": "plain",
"brown_armor": "plain",
"brown_armor_optic": "horizontal",
"brown_armor_slab": "slab",
"brown_armor_stairs": "stairs",
"brown_armor_trapdoor": "trapdoor",
"burntgrass": "plain",
"charred_block": "plain",
"chlorine_gas": "plain",
"cluster_of_bombs": "face_attached",
"compressed_air": "plain",
"concrete_wall": "plain",
"control_rod": "plain",
"conveyor": "horizontal",
"conveyor_splitter": "horizontal",
"countermeasure_dispenser": "horizontal",
"covered_flame_thrower_barrel": "horizontal",
"covered_machine_gun_barrel": "horizontal",
"cracked_concrete": "plain",
"cracked_concrete_wall": "plain",
"crude_oil": "plain",
"cyan_armor": "plain",
"cyan_armor_optic": "horizontal",
"cyan_armor_slab": "slab",
"cyan_armor_stairs": "stairs",
"cyan_armor_trapdoor": "trapdoor",
"damaged_concrete": "plain",
"damaged_concrete_wall": "plain",
"damagedfueltank": "horizontal",
"deepslate_lead_ore": "plain",
"defense_core": "plain",
"destroyed_concrete": "plain",
"destroyed_concrete_wall": "plain",
"diesel": "plain",
"drive_shaft": "horizontal",
"electric_firebox": "plain",
"empty_fuel_rods": "plain",
"empty_missile_hardpoint": "horizontal",
"energy_battery": "plain",
"energy_distribution_node": "plain",
"energy_node": "horizontal",
"engine_cyllinder": "horizontal",
"era_1": "horizontal",
"era_2": "horizontal",
"era_3": "horizontal",
"era_4": "horizontal",
"explosive_barrel": "face_attached",
"extension_shaft": "horizontal",
"fire_spear_missile_hardpoint": "horizontal",
"firebox": "plain",
"fission_bomb": "face_attached",
"flame_thrower": "horizontal",
"flame_thrower_barrel": "horizontal",
"foundry": "horizontal",
"fractured_concrete": "plain",
"fractured_concrete_wall": "plain",
"fuel_rods_1": "plain",
"fuel_rods_2": "plain",
"fuel_rods_3": "plain",
"fuel_rods_4": "plain",
"fuel_tank": "horizontal",
"fuel_tank_input": "horizontal",
"fuel_tank_module": "horizontal",
"fusion_bomb": "face_attached",
"gas_bomb": "face_attached",
"gas_dispenser": "horizontal",
"generator": "horizontal",
"giant_coil": "axis",
"glass_trapdoor": "trapdoor",
"gray_armor": "plain",
"gray_armor_optic": "horizontal",
"gray_armor_slab": "slab",
"gray_armor_stairs": "stairs",
"gray_armor_trapdoor": "trapdoor",
"green_armor": "plain",
"green_armor_optic": "horizontal",
"green_armor_slab": "slab",
"green_armor_stairs": "stairs",
"green_armor_trapdoor": "trapdoor",
"harddirt": "plain",
"heavy_machine_gun": "horizontal",
"hydrazine": "plain",
"item_incinerator": "plain",
"jet_compressor": "horizontal",
"jet_exhaust": "horizontal",
"jet_gearbox": "horizontal",
"jet_turbine": "horizontal",
"kerosene": "plain",
"land_mine": "plain",
"large_electric_motor": "horizontal",
"large_engine_smokestack": "horizontal",
"large_rocket_pod": "horizontal",
"large_rocket_pod_chamber": "horizontal",
"lead_block": "plain",
"lead_ore": "plain",
"light_autocannon": "horizontal",
"light_blue_armor": "plain",
"light_blue_armor_optic": "horizontal",
"light_blue_armor_slab": "slab",
"light_blue_armor_stairs": "stairs",
"light_blue_armor_trapdoor": "trapdoor",
"light_gray_armor": "plain",
"light_gray_armor_optic": "horizontal",
"light_gray_armor_slab": "slab",
"light_gray_armor_stairs": "stairs",
"light_gray_armor_trapdoor": "trapdoor",
"light_machine_gun": "horizontal",
"light_wood_block": "plain",
"light_wood_frame": "plain",
"light_wood_side_panel": "horizontal",
"light_wood_slab": "slab",
"light_wood_stairs": "stairs",
"light_wood_trapdoor": "trapdoor",
"lime_armor": "plain",
"lime_armor_optic": "horizontal",
"lime_armor_slab": "slab",
"lime_armor_stairs": "stairs",
"lime_armor_trapdoor": "trapdoor",
"liquid_hydrogen": "plain",
"liquid_oxygen": "plain",
"lithium_block": "plain",
"lithium_ore": "plain",
"loot_box": "plain",
"machine_gun": "horizontal",
"machine_gun_barrel": "horizontal",
"magenta_armor": "plain",
"magenta_armor_optic": "horizontal",
"magenta_armor_slab": "slab",
"magenta_armor_stairs": "stairs",
"magenta_armor_trapdoor": "trapdoor",
"manual_aimer": "horizontal",
"manual_crank": "horizontal",
"medium_diesel_engine": "horizontal",
"medium_petrol_engine": "horizontal",
"mineral_grinder": "plain",
"mini_gun_barrel": "horizontal",
"minigun": "horizontal",
"mortar": "horizontal",
"nickel_block": "plain",
"nickel_ore": "plain",
"niobium_block": "plain",
"nitrate_block": "plain",
"node_trigger": "horizontal",
"node_trigger_on": "horizontal",
"offset_era_1": "horizontal",
"offset_era_2": "horizontal",
"offset_era_3": "horizontal",
"offset_era_4": "horizontal",
"oil": "plain",
"oil_firebox": "plain",
"open_summonation": "plain",
"orange_armor": "plain",
"orange_armor_optic": "horizontal",
"orange_armor_slab": "slab",
"orange_armor_stairs": "stairs",
"orange_armor_trapdoor": "trapdoor",
"ordinance_cluster_warhead": "face_attached",
"ordinance_controller": "face_attached",
"ordinance_core": "face_attached",
"ordinance_fins": "face_attached",
"ordinance_fission_initiator_head": "face_attached",
"ordinance_heavy_warhead": "face_attached",
"ordinance_incendiary_warhead": "face_attached",
"ordinance_inline_fission_warhead": "face_attached",
"ordinance_inline_fusion_warhead_stage_1": "face_attached",
"ordinance_inline_fusion_warhead_stage_2": "face_attached",
"ordinance_inline_warhead": "face_attached",
"ordinance_ir_seeker_head": "face_attached",
"ordinance_kinetic_head": "face_attached",
"ordinance_relocator": "horizontal",
"ordinance_sarh_seeker": "face_attached",
"ordinance_thruster": "face_attached",
"overgrown_reenforced_concrete": "plain",
"passenger_seat": "horizontal",
"petrolium": "plain",
"phosphate_block": "plain",
"pink_armor": "plain",
"pink_armor_optic": "horizontal",
"pink_armor_slab": "slab",
"pink_armor_stairs": "stairs",
"pink_armor_trapdoor": "trapdoor",
"plutonium_block": "plain",
"polished_bauxite": "plain",
"polished_trinitite": "plain",
"power_reactor_interface": "plain",
"power_reactor_port": "plain",
"production_input": "horizontal",
"production_output": "horizontal",
"purple_armor": "plain",
"purple_armor_optic": "horizontal",
"purple_armor_slab": "slab",
"purple_armor_stairs": "stairs",
"purple_armor_trapdoor": "trapdoor",
"pyrochlore_block": "plain",
"pyrochlore_ore": "plain",
"rac_barrel": "horizontal",
"radar_spear_missile_hardpoint": "horizontal",
"radioactive_ash": "plain",
"radioactive_ash_full_block": "plain",
"raw_beryllium_block": "plain",
"raw_lead_block": "plain",
"raw_lithium_block": "plain",
"raw_nickel_block": "plain",
"raw_uranium_block": "plain",
"raw_zinc_block": "plain",
"razor_wire": "plain",
"reaction_chamber": "plain",
"reactor_casing": "plain",
"rebar": "plain",
"red_armor": "plain",
"red_armor_optic": "horizontal",
"red_armor_slab": "slab",
"red_armor_stairs": "stairs",
"red_armor_trapdoor": "trapdoor",
"redirector_shaft": "horizontal",
"redstone_tnt": "face_attached",
"reenforced_concrete": "plain",
"refinery": "horizontal",
"refinery_tower": "horizontal",
"reinforced_glass": "plain",
"reinforced_glass_stairs": "stairs",
"reinforced_glass_trapdoor": "trapdoor",
"robot_chute": "plain",
"rocket_pod": "horizontal",
"rocket_pod_chamber": "horizontal",
"rotary_auto_cannon": "horizontal",
"rusty_block": "plain",
"rusty_slab": "slab",
"rusty_stairs": "stairs",
"rusty_trapdoor": "trapdoor",
"sand_bags": "plain",
"scorch_dirt": "plain",
"seeker_spear_missile_hardpoint": "horizontal",
"sheet_metal": "plain",
"sheet_metal_pane": "plain",
"sheet_metal_slab": "slab",
"sheet_metal_stairs": "stairs",
"siren": "plain",
"small_bomb": "face_attached",
"small_diesel_engine": "horizontal",
"small_petrol_engine": "horizontal",
"smoke_bomb": "face_attached",
"smoke_launcher": "horizontal",
"solar_generator": "horizontal",
"steel_block": "plain",
"steel_door": "door",
"steel_optic": "horizontal",
"steel_plating": "plain",
"steel_plating_slab": "slab",
"steel_plating_stairs": "stairs",
"steel_trapdoor": "trapdoor",
"steel_truss": "axis",
"strike_spear_missile_hardpoint": "horizontal",
"structural_concrete": "plain",
"sulfur_block": "plain",
"sulfur_ore": "plain",
"sulfuric_acid": "plain",
"summonation": "plain",
"summonator": "plain",
"summonator_active": "plain",
"summonator_module": "plain",
"tar": "plain",
"thermal_furnace": "horizontal",
"thick_battle_cannon_barrel": "horizontal",
"tinted_glass_stairs": "stairs",
"tinted_glass_trapdoor": "trapdoor",
"torpedo_thruster": "face_attached",
"trinitite": "plain",
"trinitite_glass": "plain",
"trinitite_glass_stairs": "stairs",
"trinitite_glass_trapdoor": "trapdoor",
"type_1_bc_muzzle_brake": "horizontal",
"type_2_bc_muzzle_brake": "horizontal",
"uranium_depleted_block": "plain",
"uranium_enriched_block": "plain",
"uranium_neutral_block": "plain",
"uranium_ore": "plain",
"white_armor": "plain",
"white_armor_optic": "horizontal",
"white_armor_slab": "slab",
"white_armor_stairs": "stairs",
"white_armor_trapdoor": "trapdoor",
"wire_fence": "plain",
"yellow_armor": "plain",
"yellow_armor_optic": "horizontal",
"yellow_armor_slab": "slab",
"yellow_armor_stairs": "stairs",
"yellow_armor_trapdoor": "trapdoor",
"zinc_block": "plain",
"zinc_ore": "plain"
},
"blocks_from_blockstates": [
"active_robot_chute",
"advanced_alloy_block",

View File

@@ -21,6 +21,7 @@ def main() -> None:
with zipfile.ZipFile(jar) as archive:
names = archive.namelist()
block_names = sorted(stem(n) for n in names if n.startswith(f"assets/{MODID}/blockstates/") and n.endswith(".json"))
block_kinds = {name: block_kind(archive, name) for name in block_names}
item_model_names = sorted(stem(n) for n in names if n.startswith(f"assets/{MODID}/models/item/") and n.endswith(".json"))
standalone_items = sorted(name for name in item_model_names if name not in set(block_names))
@@ -32,6 +33,7 @@ def main() -> None:
"source_sha1": "528d81630a23fb4004e3abdd99b16bd225cd1e92",
"modid": MODID,
"blocks_from_blockstates": block_names,
"block_kinds": block_kinds,
"standalone_items_from_item_models": standalone_items,
"counts": {
"blockstates": len(block_names),
@@ -45,13 +47,39 @@ def main() -> None:
},
}
write_json(INVENTORY_DIR / "original-inventory.json", inventory)
write_generated_registries(block_names, standalone_items)
write_generated_registries(block_names, block_kinds, standalone_items)
def stem(path: str) -> str:
return Path(path).name.removesuffix(".json")
def block_kind(archive: zipfile.ZipFile, name: str) -> str:
with archive.open(f"assets/{MODID}/blockstates/{name}.json") as handle:
data = json.loads(handle.read().decode("utf-8"))
keys: set[str] = set()
for variant in data.get("variants", {}):
if not variant:
continue
for part in variant.split(","):
keys.add(part.split("=")[0])
if {"facing", "half", "hinge", "open"}.issubset(keys):
return "door"
if {"facing", "half", "open"}.issubset(keys):
return "trapdoor"
if {"facing", "half", "shape"}.issubset(keys):
return "stairs"
if "type" in keys:
return "slab"
if {"face", "facing"}.issubset(keys):
return "face_attached"
if "axis" in keys:
return "axis"
if "facing" in keys:
return "horizontal"
return "plain"
def extract_resources(archive: zipfile.ZipFile) -> None:
for info in archive.infolist():
if info.is_dir():
@@ -79,7 +107,7 @@ def migrate_data_path(path: str) -> str:
return path
def write_generated_registries(blocks: list[str], items: list[str]) -> None:
def write_generated_registries(blocks: list[str], block_kinds: dict[str, str], items: list[str]) -> None:
package_dir = GENERATED_JAVA / "net" / "mcreator" / "crustychunks" / "init"
package_dir.mkdir(parents=True, exist_ok=True)
used: set[str] = set()
@@ -87,6 +115,7 @@ def write_generated_registries(blocks: list[str], items: list[str]) -> None:
"package net.mcreator.crustychunks.init;",
"",
"import net.mcreator.crustychunks.CrustyChunksMod;",
"import net.minecraft.core.Direction;",
"import net.minecraft.core.registries.Registries;",
"import net.minecraft.network.chat.Component;",
"import net.minecraft.world.item.BlockItem;",
@@ -94,8 +123,21 @@ def write_generated_registries(blocks: list[str], items: list[str]) -> None:
"import net.minecraft.world.item.Item;",
"import net.minecraft.world.item.ItemStack;",
"import net.minecraft.world.item.Items;",
"import net.minecraft.world.item.context.BlockPlaceContext;",
"import net.minecraft.world.level.block.Block;",
"import net.minecraft.world.level.block.Blocks;",
"import net.minecraft.world.level.block.DoorBlock;",
"import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock;",
"import net.minecraft.world.level.block.HorizontalDirectionalBlock;",
"import net.minecraft.world.level.block.RotatedPillarBlock;",
"import net.minecraft.world.level.block.SlabBlock;",
"import net.minecraft.world.level.block.StairBlock;",
"import net.minecraft.world.level.block.TrapDoorBlock;",
"import net.minecraft.world.level.block.state.BlockState;",
"import net.minecraft.world.level.block.state.BlockBehaviour;",
"import net.minecraft.world.level.block.state.StateDefinition;",
"import net.minecraft.world.level.block.state.properties.AttachFace;",
"import net.minecraft.world.level.block.state.properties.BlockSetType;",
"import net.neoforged.bus.api.IEventBus;",
"import net.neoforged.neoforge.registries.DeferredHolder;",
"import net.neoforged.neoforge.registries.DeferredRegister;",
@@ -109,7 +151,8 @@ def write_generated_registries(blocks: list[str], items: list[str]) -> None:
for name in blocks:
ident = safe_java_identifier(name, used)
lines.append(f' public static final DeferredHolder<Block, Block> {ident} = BLOCKS.register("{name}", () -> new Block(BlockBehaviour.Properties.of().strength(2.0F, 6.0F)));')
kind = block_kinds.get(name, "plain")
lines.append(f' public static final DeferredHolder<Block, Block> {ident} = BLOCKS.register("{name}", () -> createBlock("{kind}"));')
lines.append(f' public static final DeferredHolder<Item, BlockItem> {ident}_ITEM = ITEMS.register("{name}", () -> new BlockItem({ident}.get(), new Item.Properties()));')
for name in items:
@@ -132,6 +175,49 @@ def write_generated_registries(blocks: list[str], items: list[str]) -> None:
" ITEMS.register(modBus);",
" CREATIVE_TABS.register(modBus);",
" }",
"",
" private static Block createBlock(String kind) {",
" BlockBehaviour.Properties properties = BlockBehaviour.Properties.of().strength(2.0F, 6.0F);",
" return switch (kind) {",
' case "axis" -> new RotatedPillarBlock(properties);',
' case "door" -> new DoorBlock(BlockSetType.IRON, properties);',
' case "face_attached" -> new GeneratedFaceAttachedHorizontalBlock(properties);',
' case "horizontal" -> new GeneratedHorizontalBlock(properties);',
' case "slab" -> new SlabBlock(properties);',
' case "stairs" -> new StairBlock(Blocks.STONE.defaultBlockState(), properties);',
' case "trapdoor" -> new TrapDoorBlock(BlockSetType.IRON, properties);',
" default -> new Block(properties);",
" };",
" }",
"",
" private static final class GeneratedHorizontalBlock extends HorizontalDirectionalBlock {",
" private GeneratedHorizontalBlock(BlockBehaviour.Properties properties) {",
" super(properties);",
" registerDefaultState(stateDefinition.any().setValue(FACING, Direction.NORTH));",
" }",
"",
" @Override",
" public BlockState getStateForPlacement(BlockPlaceContext context) {",
" return defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite());",
" }",
"",
" @Override",
" protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {",
" builder.add(FACING);",
" }",
" }",
"",
" private static final class GeneratedFaceAttachedHorizontalBlock extends FaceAttachedHorizontalDirectionalBlock {",
" private GeneratedFaceAttachedHorizontalBlock(BlockBehaviour.Properties properties) {",
" super(properties);",
" registerDefaultState(stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(FACE, AttachFace.FLOOR));",
" }",
"",
" @Override",
" protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {",
" builder.add(FACING, FACE);",
" }",
" }",
"}",
"",
])