Adam Novák
📎 1 file 1,497 chars
📄
pasted-code-1793390121224.txt
txt 36 lines
▶
Create a complete and fully functional Minecraft Java Edition 26.3 datapack.

The datapack should be called **Dirt Gives OP Items**.

MAIN IDEA:
Whenever a player breaks a dirt block, it drops random items instead of normal dirt.

Create a progression system with 3 levels:

**LEVEL 1 – 0 to 249 dirt blocks broken**
- Wood, sticks, coal, stone tools, iron tools, food and other basic items.
- Mostly common items.

**LEVEL 2 – 250 to 999 dirt blocks broken**
- Diamonds, emeralds, gold, lapis lazuli, diamond tools, diamond armor, ender pearls, obsidian and golden apples.
- Better and rarer rewards.

**LEVEL 3 – 1000+ dirt blocks broken**
- Netherite equipment, enchanted tools and armor, elytra, totems of undying, beacons, netherite ingots and enchanted golden apples.
- Very powerful rewards.

REQUIREMENTS:
- Every broken dirt block must count toward progression.
- Randomize the drops.
- Show a bossbar at the top of the screen displaying the current level and progress.
- Automatically unlock the next level.
- Make the system work in singleplayer.
- Make sure multiple players can have separate progress.
- Do not require any mods or plugins.
- Use correct commands, loot tables, functions and file structure for Minecraft Java 26.3.
- Include all required files.
- Validate every JSON file and command.
- Do not use outdated Minecraft syntax.

IMPORTANT:
Generate a complete downloadable ZIP datapack, not just example code. Explain how to install it.
Kodari AI
KodariOct 30 at 7:58 pm 1
DirtGivesOPItems
A Minecraft Java datapack that replaces dirt block drops with random rewards. Breaking dirt increments a per-player counter tracked via scoreboard objectives. Three progression tiers unlock automatically at 0, 250, and 1000 blocks broken, each with distinct loot tables containing progressively rarer items from wood and coal up to netherite gear and enchanted golden apples. A bossbar displays the current tier and progress toward the next level for each player. All logic uses vanilla functions, loot tables, and scoreboard commands, requiring no mods or plugins. Works in singleplayer and multiplayer with separate progress per player.

This pack uses pack_format: 48 (Minecraft 1.21.1), so it is not confirmed compatible with Java 26.3. It tracks dirt broken separately for each player. Vanilla bossbars are shared rather than per-player, so this bar is shown to the player who most recently broke dirt; its progress reflects that player.

Download the ZIP using the export button, then extract dirt_gives_op_items into your world’s datapacks/ folder. Run /reload, verify it with /datapack list, and break dirt to test. You can also test the reward function with /execute as @p run function dirtop:on_dirt_broken.

Kodari can make mistakes. Review important code before using.
Files
dirt_gives_op_items
Code
9 95
dirt_gives_op_items/data/dirtop/function/on_dirt_broken.mcfunction
advancement revoke @s only dirtop:break_dirt
scoreboard players add @s dirt_count 1
execute store result score @s dirt_roll run random value 1..100
execute if score @s dirt_count matches ..249 run function dirtop:reward/level_1
execute if score @s dirt_count matches 250..999 run function dirtop:reward/level_2
execute if score @s dirt_count matches 1000.. run function dirtop:reward/level_3
bossbar set dirtop:progress players @s
bossbar set dirtop:progress visible true
execute if score @s dirt_count matches ..249 run bossbar set dirtop:progress max 250
execute if score @s dirt_count matches ..249 run bossbar set dirtop:progress name {"text":"Level 1 — progress to 250 dirt","color":"green"}
execute if score @s dirt_count matches ..249 run scoreboard players operation @s dirt_temp = @s dirt_count
execute if score @s dirt_count matches ..249 store result bossbar dirtop:progress value run scoreboard players get @s dirt_temp
execute if score @s dirt_count matches 250..999 run bossbar set dirtop:progress max 750
execute if score @s dirt_count matches 250..999 run bossbar set dirtop:progress name {"text":"Level 2 — progress to 1,000 dirt","color":"aqua"}
execute if score @s dirt_count matches 250..999 run scoreboard players operation @s dirt_temp = @s dirt_count
execute if score @s dirt_count matches 250..999 run scoreboard players remove @s dirt_temp 250
execute if score @s dirt_count matches 250..999 store result bossbar dirtop:progress value run scoreboard players get @s dirt_temp
execute if score @s dirt_count matches 1000.. run bossbar set dirtop:progress max 1000
execute if score @s dirt_count matches 1000.. run bossbar set dirtop:progress value 1000
execute if score @s dirt_count matches 1000.. run bossbar set dirtop:progress name {"text":"Level 3 — maximum level reached","color":"light_purple"}