From 043f70aa6ef8a6ae37d56ac63d284251cbecdfaf Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 16 Jun 2022 15:12:20 -0500 Subject: [PATCH] Fix for states that burger doesn't have --- .vscode/settings.json | 2 +- README.md | 2 +- azalea-block/src/blocks.rs | 553 ++++++++++++++++++++----------------- codegen/lib/code/blocks.py | 50 ++-- 4 files changed, 337 insertions(+), 270 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 3b614348..b0d07499 100755 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,3 @@ { - "editor.formatOnSave": true + "editor.formatOnSave": false } \ No newline at end of file diff --git a/README.md b/README.md index e57b4728..f0975733 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Azalea -A Rust crate for creating Minecraft bots. +A collection of Rust crates for creating Minecraft bots and other utilities.

Azalea diff --git a/azalea-block/src/blocks.rs b/azalea-block/src/blocks.rs index f2ce03dd..879f97f9 100644 --- a/azalea-block/src/blocks.rs +++ b/azalea-block/src/blocks.rs @@ -588,6 +588,10 @@ make_block_states! { _6, _7, }, + "berries" => True_False { + True, + False, + }, "in_wall" => InWall { True, False, @@ -1577,12 +1581,45 @@ make_block_states! { Up, Down, }, + "age" => _0__1__2__3__4__5__6__7__8__9__10__11__12__13__14__15__16__17__18__19__20__21__22__23__24__25 { + _0, + _1, + _2, + _3, + _4, + _5, + _6, + _7, + _8, + _9, + _10, + _11, + _12, + _13, + _14, + _15, + _16, + _17, + _18, + _19, + _20, + _21, + _22, + _23, + _24, + _25, + }, "tilt" => Tilt { None, Unstable, Partial, Full, }, + "axis" => X_Y_Z { + X, + Y, + Z, + }, }, Blocks => { air => BlockBehavior::default(), { @@ -1646,10 +1683,10 @@ make_block_states! { DarkOakSaplingStage=_0, }, mangrove_propagule => BlockBehavior::default(), { - MangrovePropaguleStage=_0, MangrovePropaguleAge=_0, - Waterlogged=False, Hanging=False, + MangrovePropaguleStage=_0, + Waterlogged=False, }, bedrock => BlockBehavior::default(), { }, @@ -1838,102 +1875,102 @@ make_block_states! { }, note_block => BlockBehavior::default(), { Instrument=Harp, - Powered=False, NoteBlockNote=_0, + Powered=False, }, white_bed => BlockBehavior::default(), { Facing=North, - Part=Foot, Occupied=False, + Part=Foot, }, orange_bed => BlockBehavior::default(), { Facing=North, - Part=Foot, Occupied=False, + Part=Foot, }, magenta_bed => BlockBehavior::default(), { Facing=North, - Part=Foot, Occupied=False, + Part=Foot, }, light_blue_bed => BlockBehavior::default(), { Facing=North, - Part=Foot, Occupied=False, + Part=Foot, }, yellow_bed => BlockBehavior::default(), { Facing=North, - Part=Foot, Occupied=False, + Part=Foot, }, lime_bed => BlockBehavior::default(), { Facing=North, - Part=Foot, Occupied=False, + Part=Foot, }, pink_bed => BlockBehavior::default(), { Facing=North, - Part=Foot, Occupied=False, + Part=Foot, }, gray_bed => BlockBehavior::default(), { Facing=North, - Part=Foot, Occupied=False, + Part=Foot, }, light_gray_bed => BlockBehavior::default(), { Facing=North, - Part=Foot, Occupied=False, + Part=Foot, }, cyan_bed => BlockBehavior::default(), { Facing=North, - Part=Foot, Occupied=False, + Part=Foot, }, purple_bed => BlockBehavior::default(), { Facing=North, - Part=Foot, Occupied=False, + Part=Foot, }, blue_bed => BlockBehavior::default(), { Facing=North, - Part=Foot, Occupied=False, + Part=Foot, }, brown_bed => BlockBehavior::default(), { Facing=North, - Part=Foot, Occupied=False, + Part=Foot, }, green_bed => BlockBehavior::default(), { Facing=North, - Part=Foot, Occupied=False, + Part=Foot, }, red_bed => BlockBehavior::default(), { Facing=North, - Part=Foot, Occupied=False, + Part=Foot, }, black_bed => BlockBehavior::default(), { Facing=North, - Part=Foot, Occupied=False, + Part=Foot, }, powered_rail => BlockBehavior::default(), { - Shape=NorthSouth, Powered=False, + Shape=NorthSouth, Waterlogged=False, }, detector_rail => BlockBehavior::default(), { - Shape=NorthSouth, Powered=False, + Shape=NorthSouth, Waterlogged=False, }, sticky_piston => BlockBehavior::default(), { - Facing=North, Extended=False, + Facing=North, }, cobweb => BlockBehavior::default(), { }, @@ -1949,12 +1986,12 @@ make_block_states! { Half=Lower, }, piston => BlockBehavior::default(), { - Facing=North, Extended=False, + Facing=North, }, piston_head => BlockBehavior::default(), { - Facing=North, Type=Normal, + Facing=North, Short=False, }, white_wool => BlockBehavior::default(), { @@ -1990,8 +2027,8 @@ make_block_states! { black_wool => BlockBehavior::default(), { }, moving_piston => BlockBehavior::default(), { - Facing=North, Type=Normal, + Facing=North, }, dandelion => BlockBehavior::default(), { }, @@ -2045,11 +2082,11 @@ make_block_states! { }, fire => BlockBehavior::default(), { FireAge=_0, - North=False, East=False, + North=False, South=False, - West=False, Up=False, + West=False, }, soul_fire => BlockBehavior::default(), { }, @@ -2062,16 +2099,16 @@ make_block_states! { Waterlogged=False, }, chest => BlockBehavior::default(), { - Facing=North, Type=Single, + Facing=North, Waterlogged=False, }, redstone_wire => BlockBehavior::default(), { - North=None, East=None, + North=None, + RedstoneWirePower=_0, South=None, West=None, - RedstoneWirePower=_0, }, diamond_ore => BlockBehavior::default(), { }, @@ -2120,10 +2157,10 @@ make_block_states! { Waterlogged=False, }, oak_door => BlockBehavior::default(), { - Half=Lower, Facing=North, - Open=False, + Half=Lower, Hinge=Left, + Open=False, Powered=False, }, ladder => BlockBehavior::default(), { @@ -2177,10 +2214,10 @@ make_block_states! { Powered=False, }, iron_door => BlockBehavior::default(), { - Half=Lower, Facing=North, - Open=False, + Half=Lower, Hinge=Left, + Open=False, Powered=False, }, oak_pressure_plate => BlockBehavior::default(), { @@ -2218,9 +2255,9 @@ make_block_states! { Lit=True, }, stone_button => BlockBehavior::default(), { + Face=Wall, Facing=North, Powered=False, - Face=Wall, }, snow => BlockBehavior::default(), { SnowLayers=_1, @@ -2241,11 +2278,11 @@ make_block_states! { HasRecord=False, }, oak_fence => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, pumpkin => BlockBehavior::default(), { }, @@ -2281,8 +2318,8 @@ make_block_states! { CakeBites=_0, }, repeater => BlockBehavior::default(), { - Facing=North, RepeaterDelay=_1, + Facing=North, Locked=False, Powered=False, }, @@ -2320,50 +2357,50 @@ make_block_states! { }, oak_trapdoor => BlockBehavior::default(), { Facing=North, - Open=False, Half=Bottom, + Open=False, Powered=False, Waterlogged=False, }, spruce_trapdoor => BlockBehavior::default(), { Facing=North, - Open=False, Half=Bottom, + Open=False, Powered=False, Waterlogged=False, }, birch_trapdoor => BlockBehavior::default(), { Facing=North, - Open=False, Half=Bottom, + Open=False, Powered=False, Waterlogged=False, }, jungle_trapdoor => BlockBehavior::default(), { Facing=North, - Open=False, Half=Bottom, + Open=False, Powered=False, Waterlogged=False, }, acacia_trapdoor => BlockBehavior::default(), { Facing=North, - Open=False, Half=Bottom, + Open=False, Powered=False, Waterlogged=False, }, dark_oak_trapdoor => BlockBehavior::default(), { Facing=North, - Open=False, Half=Bottom, + Open=False, Powered=False, Waterlogged=False, }, mangrove_trapdoor => BlockBehavior::default(), { Facing=North, - Open=False, Half=Bottom, + Open=False, Powered=False, Waterlogged=False, }, @@ -2392,46 +2429,46 @@ make_block_states! { infested_chiseled_stone_bricks => BlockBehavior::default(), { }, brown_mushroom_block => BlockBehavior::default(), { - Up=True, Down=True, - North=True, East=True, + North=True, South=True, + Up=True, West=True, }, red_mushroom_block => BlockBehavior::default(), { - Up=True, Down=True, - North=True, East=True, + North=True, South=True, + Up=True, West=True, }, mushroom_stem => BlockBehavior::default(), { - Up=True, Down=True, - North=True, East=True, + North=True, South=True, + Up=True, West=True, }, iron_bars => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, chain => BlockBehavior::default(), { - Waterlogged=False, Axis=Y, + Waterlogged=False, }, glass_pane => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, melon => BlockBehavior::default(), { }, @@ -2448,19 +2485,26 @@ make_block_states! { MelonStemAge=_0, }, vine => BlockBehavior::default(), { - Up=False, - North=False, East=False, + North=False, South=False, + Up=False, West=False, }, glow_lichen => BlockBehavior::default(), { + True_False=False, + True_False=False, + True_False=False, + True_False=False, + True_False=False, + True_False=False, + True_False=False, }, oak_fence_gate => BlockBehavior::default(), { Facing=North, + InWall=False, Open=False, Powered=False, - InWall=False, }, brick_stairs => BlockBehavior::default(), { Facing=North, @@ -2488,11 +2532,11 @@ make_block_states! { nether_bricks => BlockBehavior::default(), { }, nether_brick_fence => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, nether_brick_stairs => BlockBehavior::default(), { Facing=North, @@ -2523,8 +2567,8 @@ make_block_states! { end_portal => BlockBehavior::default(), { }, end_portal_frame => BlockBehavior::default(), { - Facing=North, HasEye=False, + Facing=North, }, end_stone => BlockBehavior::default(), { }, @@ -2534,8 +2578,8 @@ make_block_states! { Lit=False, }, cocoa => BlockBehavior::default(), { - Facing=North, CocoaAge=_0, + Facing=North, }, sandstone_stairs => BlockBehavior::default(), { Facing=North, @@ -2552,18 +2596,18 @@ make_block_states! { Waterlogged=False, }, tripwire_hook => BlockBehavior::default(), { + Attached=False, Facing=North, Powered=False, - Attached=False, }, tripwire => BlockBehavior::default(), { - Powered=False, Attached=False, Disarmed=False, - North=False, East=False, - West=False, + North=False, + Powered=False, South=False, + West=False, }, emerald_block => BlockBehavior::default(), { }, @@ -2586,26 +2630,26 @@ make_block_states! { Waterlogged=False, }, command_block => BlockBehavior::default(), { - Facing=North, Conditional=False, + Facing=North, }, beacon => BlockBehavior::default(), { }, cobblestone_wall => BlockBehavior::default(), { - Up=True, - NorthWall=None, EastWall=None, - WestWall=None, + NorthWall=None, SouthWall=None, + Up=True, Waterlogged=False, + WestWall=None, }, mossy_cobblestone_wall => BlockBehavior::default(), { - Up=True, - NorthWall=None, EastWall=None, - WestWall=None, + NorthWall=None, SouthWall=None, + Up=True, Waterlogged=False, + WestWall=None, }, flower_pot => BlockBehavior::default(), { }, @@ -2666,39 +2710,39 @@ make_block_states! { PotatoesAge=_0, }, oak_button => BlockBehavior::default(), { + Face=Wall, Facing=North, Powered=False, - Face=Wall, }, spruce_button => BlockBehavior::default(), { + Face=Wall, Facing=North, Powered=False, - Face=Wall, }, birch_button => BlockBehavior::default(), { + Face=Wall, Facing=North, Powered=False, - Face=Wall, }, jungle_button => BlockBehavior::default(), { + Face=Wall, Facing=North, Powered=False, - Face=Wall, }, acacia_button => BlockBehavior::default(), { + Face=Wall, Facing=North, Powered=False, - Face=Wall, }, dark_oak_button => BlockBehavior::default(), { + Face=Wall, Facing=North, Powered=False, - Face=Wall, }, mangrove_button => BlockBehavior::default(), { + Face=Wall, Facing=North, Powered=False, - Face=Wall, }, skeleton_skull => BlockBehavior::default(), { SkeletonSkullRotation=_0, @@ -2746,8 +2790,8 @@ make_block_states! { Facing=North, }, trapped_chest => BlockBehavior::default(), { - Facing=North, Type=Single, + Facing=North, Waterlogged=False, }, light_weighted_pressure_plate => BlockBehavior::default(), { @@ -2762,16 +2806,16 @@ make_block_states! { Powered=False, }, daylight_detector => BlockBehavior::default(), { - DaylightDetectorPower=_0, Inverted=False, + DaylightDetectorPower=_0, }, redstone_block => BlockBehavior::default(), { }, nether_quartz_ore => BlockBehavior::default(), { }, hopper => BlockBehavior::default(), { - Facing=Down, Enabled=True, + Facing=Down, }, quartz_block => BlockBehavior::default(), { }, @@ -2787,8 +2831,8 @@ make_block_states! { Waterlogged=False, }, activator_rail => BlockBehavior::default(), { - Shape=NorthSouth, Powered=False, + Shape=NorthSouth, Waterlogged=False, }, dropper => BlockBehavior::default(), { @@ -2828,116 +2872,116 @@ make_block_states! { black_terracotta => BlockBehavior::default(), { }, white_stained_glass_pane => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, orange_stained_glass_pane => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, magenta_stained_glass_pane => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, light_blue_stained_glass_pane => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, yellow_stained_glass_pane => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, lime_stained_glass_pane => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, pink_stained_glass_pane => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, gray_stained_glass_pane => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, light_gray_stained_glass_pane => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, cyan_stained_glass_pane => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, purple_stained_glass_pane => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, blue_stained_glass_pane => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, brown_stained_glass_pane => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, green_stained_glass_pane => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, red_stained_glass_pane => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, black_stained_glass_pane => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, acacia_stairs => BlockBehavior::default(), { Facing=North, @@ -2967,8 +3011,8 @@ make_block_states! { }, iron_trapdoor => BlockBehavior::default(), { Facing=North, - Open=False, Half=Bottom, + Open=False, Powered=False, Waterlogged=False, }, @@ -3271,134 +3315,134 @@ make_block_states! { }, spruce_fence_gate => BlockBehavior::default(), { Facing=North, + InWall=False, Open=False, Powered=False, - InWall=False, }, birch_fence_gate => BlockBehavior::default(), { Facing=North, + InWall=False, Open=False, Powered=False, - InWall=False, }, jungle_fence_gate => BlockBehavior::default(), { Facing=North, + InWall=False, Open=False, Powered=False, - InWall=False, }, acacia_fence_gate => BlockBehavior::default(), { Facing=North, + InWall=False, Open=False, Powered=False, - InWall=False, }, dark_oak_fence_gate => BlockBehavior::default(), { Facing=North, + InWall=False, Open=False, Powered=False, - InWall=False, }, mangrove_fence_gate => BlockBehavior::default(), { Facing=North, + InWall=False, Open=False, Powered=False, - InWall=False, }, spruce_fence => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, birch_fence => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, jungle_fence => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, acacia_fence => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, dark_oak_fence => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, mangrove_fence => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, spruce_door => BlockBehavior::default(), { - Half=Lower, Facing=North, - Open=False, + Half=Lower, Hinge=Left, + Open=False, Powered=False, }, birch_door => BlockBehavior::default(), { - Half=Lower, Facing=North, - Open=False, + Half=Lower, Hinge=Left, + Open=False, Powered=False, }, jungle_door => BlockBehavior::default(), { - Half=Lower, Facing=North, - Open=False, + Half=Lower, Hinge=Left, + Open=False, Powered=False, }, acacia_door => BlockBehavior::default(), { - Half=Lower, Facing=North, - Open=False, + Half=Lower, Hinge=Left, + Open=False, Powered=False, }, dark_oak_door => BlockBehavior::default(), { - Half=Lower, Facing=North, - Open=False, + Half=Lower, Hinge=Left, + Open=False, Powered=False, }, mangrove_door => BlockBehavior::default(), { - Half=Lower, Facing=North, - Open=False, + Half=Lower, Hinge=Left, + Open=False, Powered=False, }, end_rod => BlockBehavior::default(), { Facing=Up, }, chorus_plant => BlockBehavior::default(), { - North=False, - East=False, - South=False, - West=False, - Up=False, Down=False, + East=False, + North=False, + South=False, + Up=False, + West=False, }, chorus_flower => BlockBehavior::default(), { ChorusFlowerAge=_0, @@ -3424,12 +3468,12 @@ make_block_states! { end_gateway => BlockBehavior::default(), { }, repeating_command_block => BlockBehavior::default(), { - Facing=North, Conditional=False, + Facing=North, }, chain_command_block => BlockBehavior::default(), { - Facing=North, Conditional=False, + Facing=North, }, frosted_ice => BlockBehavior::default(), { FrostedIceAge=_0, @@ -3620,8 +3664,8 @@ make_block_states! { dried_kelp_block => BlockBehavior::default(), { }, turtle_egg => BlockBehavior::default(), { - TurtleEggHatch=_0, TurtleEggEggs=_1, + TurtleEggHatch=_0, }, dead_tube_coral_block => BlockBehavior::default(), { }, @@ -3905,113 +3949,113 @@ make_block_states! { Waterlogged=False, }, brick_wall => BlockBehavior::default(), { - Up=True, - NorthWall=None, EastWall=None, - WestWall=None, + NorthWall=None, SouthWall=None, + Up=True, Waterlogged=False, + WestWall=None, }, prismarine_wall => BlockBehavior::default(), { - Up=True, - NorthWall=None, EastWall=None, - WestWall=None, + NorthWall=None, SouthWall=None, + Up=True, Waterlogged=False, + WestWall=None, }, red_sandstone_wall => BlockBehavior::default(), { - Up=True, - NorthWall=None, EastWall=None, - WestWall=None, + NorthWall=None, SouthWall=None, + Up=True, Waterlogged=False, + WestWall=None, }, mossy_stone_brick_wall => BlockBehavior::default(), { - Up=True, - NorthWall=None, EastWall=None, - WestWall=None, + NorthWall=None, SouthWall=None, + Up=True, Waterlogged=False, + WestWall=None, }, granite_wall => BlockBehavior::default(), { - Up=True, - NorthWall=None, EastWall=None, - WestWall=None, + NorthWall=None, SouthWall=None, + Up=True, Waterlogged=False, + WestWall=None, }, stone_brick_wall => BlockBehavior::default(), { - Up=True, - NorthWall=None, EastWall=None, - WestWall=None, + NorthWall=None, SouthWall=None, + Up=True, Waterlogged=False, + WestWall=None, }, mud_brick_wall => BlockBehavior::default(), { - Up=True, - NorthWall=None, EastWall=None, - WestWall=None, + NorthWall=None, SouthWall=None, + Up=True, Waterlogged=False, + WestWall=None, }, nether_brick_wall => BlockBehavior::default(), { - Up=True, - NorthWall=None, EastWall=None, - WestWall=None, + NorthWall=None, SouthWall=None, + Up=True, Waterlogged=False, + WestWall=None, }, andesite_wall => BlockBehavior::default(), { - Up=True, - NorthWall=None, EastWall=None, - WestWall=None, + NorthWall=None, SouthWall=None, + Up=True, Waterlogged=False, + WestWall=None, }, red_nether_brick_wall => BlockBehavior::default(), { - Up=True, - NorthWall=None, EastWall=None, - WestWall=None, + NorthWall=None, SouthWall=None, + Up=True, Waterlogged=False, + WestWall=None, }, sandstone_wall => BlockBehavior::default(), { - Up=True, - NorthWall=None, EastWall=None, - WestWall=None, + NorthWall=None, SouthWall=None, + Up=True, Waterlogged=False, + WestWall=None, }, end_stone_brick_wall => BlockBehavior::default(), { - Up=True, - NorthWall=None, EastWall=None, - WestWall=None, + NorthWall=None, SouthWall=None, + Up=True, Waterlogged=False, + WestWall=None, }, diorite_wall => BlockBehavior::default(), { - Up=True, - NorthWall=None, EastWall=None, - WestWall=None, + NorthWall=None, SouthWall=None, + Up=True, Waterlogged=False, + WestWall=None, }, scaffolding => BlockBehavior::default(), { + Bottom=False, ScaffoldingDistance=_7, Waterlogged=False, - Bottom=False, }, loom => BlockBehavior::default(), { Facing=North, @@ -4033,13 +4077,13 @@ make_block_states! { fletching_table => BlockBehavior::default(), { }, grindstone => BlockBehavior::default(), { - Facing=North, Face=Wall, + Facing=North, }, lectern => BlockBehavior::default(), { Facing=North, - Powered=False, HasBook=False, + Powered=False, }, smithing_table => BlockBehavior::default(), { }, @@ -4047,8 +4091,8 @@ make_block_states! { Facing=North, }, bell => BlockBehavior::default(), { - Facing=North, Attachment=Floor, + Facing=North, Powered=False, }, lantern => BlockBehavior::default(), { @@ -4060,16 +4104,16 @@ make_block_states! { Waterlogged=False, }, campfire => BlockBehavior::default(), { + Facing=North, Lit=True, SignalFire=False, Waterlogged=False, - Facing=North, }, soul_campfire => BlockBehavior::default(), { + Facing=North, Lit=True, SignalFire=False, Waterlogged=False, - Facing=North, }, sweet_berry_bush => BlockBehavior::default(), { SweetBerryBushAge=_0, @@ -4145,44 +4189,44 @@ make_block_states! { Powered=False, }, crimson_fence => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, warped_fence => BlockBehavior::default(), { - North=False, East=False, - West=False, + North=False, South=False, Waterlogged=False, + West=False, }, crimson_trapdoor => BlockBehavior::default(), { Facing=North, - Open=False, Half=Bottom, + Open=False, Powered=False, Waterlogged=False, }, warped_trapdoor => BlockBehavior::default(), { Facing=North, - Open=False, Half=Bottom, + Open=False, Powered=False, Waterlogged=False, }, crimson_fence_gate => BlockBehavior::default(), { Facing=North, + InWall=False, Open=False, Powered=False, - InWall=False, }, warped_fence_gate => BlockBehavior::default(), { Facing=North, + InWall=False, Open=False, Powered=False, - InWall=False, }, crimson_stairs => BlockBehavior::default(), { Facing=North, @@ -4197,27 +4241,27 @@ make_block_states! { Waterlogged=False, }, crimson_button => BlockBehavior::default(), { + Face=Wall, Facing=North, Powered=False, - Face=Wall, }, warped_button => BlockBehavior::default(), { + Face=Wall, Facing=North, Powered=False, - Face=Wall, }, crimson_door => BlockBehavior::default(), { - Half=Lower, Facing=North, - Open=False, + Half=Lower, Hinge=Left, + Open=False, Powered=False, }, warped_door => BlockBehavior::default(), { - Half=Lower, Facing=North, - Open=False, + Half=Lower, Hinge=Left, + Open=False, Powered=False, }, crimson_sign => BlockBehavior::default(), { @@ -4249,12 +4293,12 @@ make_block_states! { TargetOutputPower=_0, }, bee_nest => BlockBehavior::default(), { - BeeNestHoneyLevel=_0, Facing=North, + BeeNestHoneyLevel=_0, }, beehive => BlockBehavior::default(), { - BeehiveHoneyLevel=_0, Facing=North, + BeehiveHoneyLevel=_0, }, honey_block => BlockBehavior::default(), { }, @@ -4288,12 +4332,12 @@ make_block_states! { Waterlogged=False, }, blackstone_wall => BlockBehavior::default(), { - Up=True, - NorthWall=None, EastWall=None, - WestWall=None, + NorthWall=None, SouthWall=None, + Up=True, Waterlogged=False, + WestWall=None, }, blackstone_slab => BlockBehavior::default(), { Type=Bottom, @@ -4318,12 +4362,12 @@ make_block_states! { Waterlogged=False, }, polished_blackstone_brick_wall => BlockBehavior::default(), { - Up=True, - NorthWall=None, EastWall=None, - WestWall=None, + NorthWall=None, SouthWall=None, + Up=True, Waterlogged=False, + WestWall=None, }, gilded_blackstone => BlockBehavior::default(), { }, @@ -4341,17 +4385,17 @@ make_block_states! { Powered=False, }, polished_blackstone_button => BlockBehavior::default(), { + Face=Wall, Facing=North, Powered=False, - Face=Wall, }, polished_blackstone_wall => BlockBehavior::default(), { - Up=True, - NorthWall=None, EastWall=None, - WestWall=None, + NorthWall=None, SouthWall=None, + Up=True, Waterlogged=False, + WestWall=None, }, chiseled_nether_bricks => BlockBehavior::default(), { }, @@ -4500,20 +4544,20 @@ make_block_states! { budding_amethyst => BlockBehavior::default(), { }, amethyst_cluster => BlockBehavior::default(), { - Waterlogged=False, Facing=Up, + Waterlogged=False, }, large_amethyst_bud => BlockBehavior::default(), { - Waterlogged=False, Facing=Up, + Waterlogged=False, }, medium_amethyst_bud => BlockBehavior::default(), { - Waterlogged=False, Facing=Up, + Waterlogged=False, }, small_amethyst_bud => BlockBehavior::default(), { - Waterlogged=False, Facing=Up, + Waterlogged=False, }, tuff => BlockBehavior::default(), { }, @@ -4524,21 +4568,28 @@ make_block_states! { powder_snow => BlockBehavior::default(), { }, sculk_sensor => BlockBehavior::default(), { - Phase=Inactive, SculkSensorPower=_0, + Phase=Inactive, Waterlogged=False, }, sculk => BlockBehavior::default(), { }, sculk_vein => BlockBehavior::default(), { + True_False=False, + True_False=False, + True_False=False, + True_False=False, + True_False=False, + True_False=False, + True_False=False, }, sculk_catalyst => BlockBehavior::default(), { Pulse=False, }, sculk_shrieker => BlockBehavior::default(), { + CanSummon=False, Shrieking=False, Waterlogged=False, - CanSummon=False, }, oxidized_copper => BlockBehavior::default(), { }, @@ -4662,15 +4713,18 @@ make_block_states! { Waterlogged=False, }, pointed_dripstone => BlockBehavior::default(), { - TipDirection=Up, Thickness=Tip, + TipDirection=Up, Waterlogged=False, }, dripstone_block => BlockBehavior::default(), { }, cave_vines => BlockBehavior::default(), { + _0__1__2__3__4__5__6__7__8__9__10__11__12__13__14__15__16__17__18__19__20__21__22__23__24__25=_0, + True_False=False, }, cave_vines_plant => BlockBehavior::default(), { + True_False=False, }, spore_blossom => BlockBehavior::default(), { }, @@ -4683,18 +4737,18 @@ make_block_states! { moss_block => BlockBehavior::default(), { }, big_dripleaf => BlockBehavior::default(), { - Waterlogged=False, Facing=North, Tilt=None, + Waterlogged=False, }, big_dripleaf_stem => BlockBehavior::default(), { - Waterlogged=False, Facing=North, + Waterlogged=False, }, small_dripleaf => BlockBehavior::default(), { + Facing=North, Half=Lower, Waterlogged=False, - Facing=North, }, hanging_roots => BlockBehavior::default(), { Waterlogged=False, @@ -4719,12 +4773,12 @@ make_block_states! { Waterlogged=False, }, cobbled_deepslate_wall => BlockBehavior::default(), { - Up=True, - NorthWall=None, EastWall=None, - WestWall=None, + NorthWall=None, SouthWall=None, + Up=True, Waterlogged=False, + WestWall=None, }, polished_deepslate => BlockBehavior::default(), { }, @@ -4739,12 +4793,12 @@ make_block_states! { Waterlogged=False, }, polished_deepslate_wall => BlockBehavior::default(), { - Up=True, - NorthWall=None, EastWall=None, - WestWall=None, + NorthWall=None, SouthWall=None, + Up=True, Waterlogged=False, + WestWall=None, }, deepslate_tiles => BlockBehavior::default(), { }, @@ -4759,12 +4813,12 @@ make_block_states! { Waterlogged=False, }, deepslate_tile_wall => BlockBehavior::default(), { - Up=True, - NorthWall=None, EastWall=None, - WestWall=None, + NorthWall=None, SouthWall=None, + Up=True, Waterlogged=False, + WestWall=None, }, deepslate_bricks => BlockBehavior::default(), { }, @@ -4779,12 +4833,12 @@ make_block_states! { Waterlogged=False, }, deepslate_brick_wall => BlockBehavior::default(), { - Up=True, - NorthWall=None, EastWall=None, - WestWall=None, + NorthWall=None, SouthWall=None, + Up=True, Waterlogged=False, + WestWall=None, }, chiseled_deepslate => BlockBehavior::default(), { }, @@ -4793,6 +4847,7 @@ make_block_states! { cracked_deepslate_tiles => BlockBehavior::default(), { }, infested_deepslate => BlockBehavior::default(), { + X_Y_Z=Y, }, smooth_basalt => BlockBehavior::default(), { }, diff --git a/codegen/lib/code/blocks.py b/codegen/lib/code/blocks.py index 9d1a5f30..4978da6f 100644 --- a/codegen/lib/code/blocks.py +++ b/codegen/lib/code/blocks.py @@ -1,3 +1,4 @@ +from typing import Optional from lib.utils import to_snake_case, upper_first_letter, get_dir_location, to_camel_case from ..mappings import Mappings import re @@ -18,7 +19,10 @@ def generate_blocks(blocks_burger: dict, blocks_report: dict, ordered_blocks: li new_make_block_states_macro_code = [] new_make_block_states_macro_code.append('make_block_states! {') - def get_property_struct_name(property: dict, block_data_burger: dict) -> str: + def get_property_struct_name(property: Optional[dict], block_data_burger: dict, property_variants: list[str]) -> str: + if property is None: + return '_'.join(map(to_camel_case, property_variants)) + property_name = None for class_name in [block_data_burger['class']] + block_data_burger['super']: property_name = mappings.get_field( @@ -42,24 +46,25 @@ def generate_blocks(blocks_burger: dict, blocks_report: dict, ordered_blocks: li block_data_report = blocks_report[f'minecraft:{block_id}'] block_properties = {} - for property_struct_name in list(block_data_report.get('properties', {}).keys()): + for property_name in list(block_data_report.get('properties', {}).keys()): property_burger = None - for property in block_data_burger['states']: - if property['name'] == property_struct_name: + for property in block_data_burger.get('states', []): + if property['name'] == property_name: property_burger = property break + + property_variants = block_data_report['properties'][property_name] + if property_burger is None: print( - 'Error: The reports have states for a block, but Burger doesn\'t!', block_data_burger) - continue - # assert property_burger is not None - property_variants = block_data_report['properties'][property_struct_name] + 'Warning: The reports have states for a block, but Burger doesn\'t!', block_data_burger) + property_struct_name = get_property_struct_name( - property_burger, block_data_burger) + property_burger, block_data_burger, property_variants) + # assert property_name == property_burger['name'] block_properties[property_struct_name] = property_variants - property_name = property_burger['name'] # if the name ends with _, remove that part ending = property_name.split('_')[-1] if ending.isdigit(): @@ -94,25 +99,32 @@ def generate_blocks(blocks_burger: dict, blocks_report: dict, ordered_blocks: li block_data_burger = blocks_burger[block_id] block_data_report = blocks_report['minecraft:' + block_id] - block_properties_burger = block_data_burger['states'] + block_properties = block_data_burger.get('states', []) + block_properties_burger = block_data_burger.get('states', []) default_property_variants: dict[str, str] = {} - for property in block_data_report['states']: - if property.get('default'): - default_property_variants = property.get('properties', {}) + for state in block_data_report['states']: + if state.get('default'): + default_property_variants = state.get('properties', {}) # TODO: use burger to generate the blockbehavior new_make_block_states_macro_code.append( f' {block_id} => BlockBehavior::default(), {{') - for property in block_properties_burger: - property_default = default_property_variants.get(property['name']) + for property_name in list(block_data_report.get('properties', {}).keys()): + property_burger = None + for property in block_data_burger.get('states', []): + if property['name'] == property_name: + property_burger = property + break + + property_default = default_property_variants.get(property_name) + property_variants = block_data_report['properties'][property_name] + property_struct_name = get_property_struct_name( - property, block_data_burger) + property_burger, block_data_burger, property_variants) assert property_default is not None new_make_block_states_macro_code.append( f' {property_struct_name}={to_camel_case(property_default)},') - # new_make_block_states_macro_code.append( - # f' {to_camel_case(state)}=TODO,') new_make_block_states_macro_code.append(' },') new_make_block_states_macro_code.append(' }') new_make_block_states_macro_code.append('}')