pythonstarteruser

Make me a datapack for 1.17.1 that when i break any block or mine the datapack executes the /gravity randomise @a command

Kodari AI
KodariNov 8 at 7:55 am 1
GravityRandomizer
A Minecraft 1.17.1 datapack that triggers the /gravity randomise @a command whenever a player breaks or mines any block. The datapack uses a scoreboard objective to track block break events, then executes the gravity randomization effect on all players. It includes functions for initialization, event detection, and the gravity application, ensuring seamless integration with vanilla gameplay mechanics.

The advancement triggers for any mined block and is revoked after firing so it can trigger again. This runs the exact command you requested; it requires whatever provides the /gravity command to be installed.

Download the ZIP using the export button, then extract block_mine_randomise into your world’s datapacks/ folder. Run /reload, check /datapack list, and test in-game with /function block_mine_randomise:on_mine.

Kodari can make mistakes. Review important code before using.
Files
block_mine_randomise
Code
3 18
block_mine_randomise/data/block_mine_randomise/functions/on_mine.mcfunction
gravity randomise @a
advancement revoke @s only block_mine_randomise:on_mine