These use remove_attacks to stop players from hitting things.
Can't attack with a stick
{"action": "remove_attacks","items": ["minecraft:stick"]}
Can't attack with any sword or axe
{"action": "remove_attacks","patterns": ["/.*_sword/", "/.*_axe/"]}
Can't use one mod's weapons
{"action": "remove_attacks","mod": ["simplyswords"]}
Can't hurt villagers or iron golems
No items listed, so this applies to every item. (Punching with an empty hand still works.)
{"action": "remove_attacks","entities": ["minecraft:villager", "minecraft:iron_golem"]}
Zombies can't spawn with diamond swords
Players can still use them:
{"action": "remove","items": ["minecraft:diamond_sword"],"entities": ["minecraft:zombie"]}
Skeletons can't wear helmets
{"action": "remove","patterns": ["/.*_helmet/"],"entities": ["minecraft:skeleton"]}
No mob spawns with netherite gear
{"action": "remove_equipment","patterns": ["/minecraft:netherite_.*/"]}