This mod allows you to easily integrate and trigger custom commands within structures, making it simple to add special features or mechanics to your structures. This mod adds a new block that executes commands, enabling you to place it in your structures for automatic command execution. This block could work in world gen to but i have not tested.
Features:
command_executor_block through the BlockEntityTag./give @p command_executor_block:command_executor_block{BlockEntityTag:{Command:'summon minecraft:item_frame ~ ~ ~ {Item:{id:"minecraft:iron_sword",Count:1b},Facing:1b,Rotation:0b,Tags:["randomRotation"]}'}}
Important Notes: