sulgodman

I have a Minecraft server with my friends where the storyline involves the sky being covered in obsidian with purple crystals growing on it. I would like an AI to create a datapack for Minecraft 1.21.1 that meets the following requirements:

Crystal Detection: Implement a feature that checks for the existence of crystals (purple crystals) hanging above the ground within a specified distance.

Random Drop Timing: After 10 hours of real time, the datapack should randomly decide whether a crystal will drop or stay in place.

Random Coordinates Selection: If a crystal is to drop, randomly select coordinates for its fall, within a range of 0 to 3500 for both X and Z coordinates.

Explosion and Block Distribution: When the crystal touches the ground, it should create a small explosion that scatters crystal blocks around it. Additionally, a chest with loot should spawn in the center of the blast.

Notification System: After the crystal has dropped, there should be an explosion sound, and all players must receive a chat message that an airdrop has occurred, including approximate coordinates (with a 200-block radius of randomness).

Chest Deletion: Once players retrieve items from the chest, the chest should disappear.

Kodari AI
KodariJun 1 at 10:34 am 45
CrystalAirdrop
A Minecraft 1.21.1 datapack for a custom story server with an obsidian sky. Detects purple amethyst crystals hanging from the ceiling, and after every 10 real-time hours randomly decides if a crystal will fall. Picks random X/Z coordinates (0–3500), summons a falling crystal at the sky ceiling, then on impact creates an explosion particle effect, scatters amethyst blocks, and spawns a loot chest. Broadcasts approximate coordinates to all players. The chest auto-deletes once fully looted.

Here’s the full datapack — 25 files covering every mechanic.

Setup: after loading, mark each crystal with: /summon minecraft:armor_stand ~ ~ ~ {Tags:["purple_crystal"],Invisible:1b,NoGravity:1b,Marker:1b}



How to install: drop the entire folder into your world’s datapacks/ directory and run /reload.

How each system works:

Feature
Implementation
Crystal detection
Checks every 200 ticks for
purple_crystal
-tagged armor stands
and
actual
amethyst_cluster
blocks at 4 heights (50/100/150/200 blocks) above each player
10-hour timer
#timer cd
increments every tick; fires at 720,000
Random drop roll
/random value 1..2
— 50 % chance each cycle
Random coords
/random value 0..3500
stored to scoreboard, pushed to data storage for macro
Falling crystal
falling_block
(amethyst_block) summoned at Y=249, tagged
cd_falling
; killed on impact
Landing effects
Explosion particles + scatter of amethyst blocks/clusters via
setblock
, no terrain destruction
Loot chest
Spawned via
setblock
with
LootTable
NBT;
crystal_drop:crystal_chest
loot table
Announcement
Macro injects ±200-offset coords into a
tellraw
; explosion sound broadcast at volume 100
Chest deletion
marker
entity watcher checks the chest every second; removes it once
Items:[]
and loot table tag is gone (chest opened & emptied)
sulgodman

А добавь систему управления всеми параметрами прямо в майнкрафте

Kodari AI
KodariJun 1 at 11:04 am 43

Good — I have the full file list. Now I’ll rewrite all parameterized core functions and create the entire admin subsystem.

Plan:

  1. init_scores — add settings scores + first-run guard

  2. set_defaults (new) — initial values

  3. tick — check #enabled, call crystal particles

  4. timer_tick — compare to #timer_max

  5. roll_for_drop + roll_for_drop_macro (new) — dynamic chance via macro

  6. start_drop + pick_coords_macro (new) — dynamic range via macro

  7. summon_fall_macro — keep macro, add announcement

  8. fall_tick, prepare_land, land_here, scatter_blocks — clean up land flow

  9. prepare_announce, announce_macro — playsound + tellraw

  10. chest_tick, check_chest_now, check_chest_block, remove_chest, reset_after_chest — chest monitor

  11. admin/menu (new) — full clickable chat UI

  12. admin/status, admin/toggle, admin/force_drop, admin/reset_timer (all new)


Now the admin subsystem:


Here’s a summary of every change and new feature:

What changed
How
Settings persist across /reload
#initialized
guard in
init_scores
— defaults only apply once
#timer_max
timer_tick
compares
#timer >= #timer_max
instead of hardcoded 720 000
#drop_chance
roll_for_drop
pushes it to storage →
roll_for_drop_macro
does
random value 1..$(drop_chance)
#coord_max
start_drop
pushes it to storage →
pick_coords_macro
does
random value 0..$(coord_max)
#enabled
tick
only runs the timer when
#enabled matches 1
Crystal particles
check_crystals_run
spawns
witch_magic
particles on every
purple_crystal
armor stand
Admin menu
/function crystal_drop:admin/menu
— clickable chat panel, all presets + custom inputs
Admin status
/function crystal_drop:admin/status
— live scoreboard values
Toggle
/function crystal_drop:admin/toggle
— on/off with server-wide broadcast
Force drop
/function crystal_drop:admin/force_drop
— skips timer, guards against double-drop
Reset timer
/function crystal_drop:admin/reset_timer
sulgodman

Ты не добавил функции и если их использовать в майнкрафте то пишет неизвестная функция "имя функции"

Kodari can make mistakes. Review important code before using.
Files
data
pack.mcmeta
Code
33 195
data/crystal_drop/functions/admin/menu.mcfunction
tellraw @s ["",{"text":"╔══════════════════════════════╗","color":"dark_purple"}]
tellraw @s ["",{"text":"  ✦ ","color":"dark_purple"},{"text":"CRYSTAL AIRDROP","color":"light_purple","bold":true},{"text":" CONFIG PANEL","color":"white","bold":true}]
tellraw @s ["",{"text":"╚══════════════════════════════╝","color":"dark_purple"}]
tellraw @s ["",{"text":"  Status: ","color":"gray"},{"score":{"name":"#enabled","objective":"cd"},"color":"yellow"},{"text":"   "},{"text":"[✔ ENABLE]","color":"green","bold":true,"clickEvent":{"action":"run_command","value":"/scoreboard players set #enabled cd 1"},"hoverEvent":{"action":"show_text","value":"§aEnable the crystal drop system"}},{"text":"  "},{"text":"[✖ DISABLE]","color":"red","bold":true,"clickEvent":{"action":"run_command","value":"/scoreboard players set #enabled cd 0"},"hoverEvent":{"action":"show_text","value":"§cDisable the crystal drop system"}}]
tellraw @s ["",{"text":"  Timer: ","color":"gray"},{"score":{"name":"#timer","objective":"cd"},"color":"aqua"},{"text":" / ","color":"dark_gray"},{"score":{"name":"#timer_max","objective":"cd"},"color":"yellow"},{"text":" ticks","color":"dark_gray"}]
tellraw @s ["",{"text":"  Set timer: ","color":"gray"},{"text":"[30m]","color":"aqua","clickEvent":{"action":"run_command","value":"/scoreboard players set #timer_max cd 36000"},"hoverEvent":{"action":"show_text","value":"30 minutes — 36,000 ticks"}},{"text":" "},{"text":"[1h]","color":"aqua","clickEvent":{"action":"run_command","value":"/scoreboard players set #timer_max cd 72000"},"hoverEvent":{"action":"show_text","value":"1 hour — 72,000 ticks"}},{"text":" "},{"text":"[5h]","color":"aqua","clickEvent":{"action":"run_command","value":"/scoreboard players set #timer_max cd 360000"},"hoverEvent":{"action":"show_text","value":"5 hours — 360,000 ticks"}},{"text":" "},{"text":"[10h]","color":"aqua","clickEvent":{"action":"run_command","value":"/scoreboard players set #timer_max cd 720000"},"hoverEvent":{"action":"show_text","value":"10 hours — 720,000 ticks"}},{"text":" "},{"text":"[24h]","color":"aqua","clickEvent":{"action":"run_command","value":"/scoreboard players set #timer_max cd 1728000"},"hoverEvent":{"action":"show_text","value":"24 hours — 1,728,000 ticks"}},{"text":" "},{"text":"[Custom…]","color":"gold","clickEvent":{"action":"suggest_command","value":"/scoreboard players set #timer_max cd "},"hoverEvent":{"action":"show_text","value":"§eType a custom value in ticks"}}]
tellraw @s ["",{"text":"  Drop chance: ","color":"gray"},{"text":"1 in ","color":"white"},{"score":{"name":"#drop_chance","objective":"cd"},"color":"yellow"}]
tellraw @s ["",{"text":"  Set chance: ","color":"gray"},{"text":"[100%]","color":"green","clickEvent":{"action":"run_command","value":"/scoreboard players set #drop_chance cd 1"},"hoverEvent":{"action":"show_text","value":"Guaranteed drop every cycle"}},{"text":" "},{"text":"[50%]","color":"aqua","clickEvent":{"action":"run_command","value":"/scoreboard players set #drop_chance cd 2"},"hoverEvent":{"action":"show_text","value":"50% chance — 1 in 2"}},{"text":" "},{"text":"[25%]","color":"aqua","clickEvent":{"action":"run_command","value":"/scoreboard players set #drop_chance cd 4"},"hoverEvent":{"action":"show_text","value":"25% chance — 1 in 4"}},{"text":" "},{"text":"[10%]","color":"gold","clickEvent":{"action":"run_command","value":"/scoreboard players set #drop_chance cd 10"},"hoverEvent":{"action":"show_text","value":"10% chance — 1 in 10"}},{"text":" "},{"text":"[5%]","color":"red","clickEvent":{"action":"run_command","value":"/scoreboard players set #drop_chance cd 20"},"hoverEvent":{"action":"show_text","value":"5% chance — 1 in 20"}},{"text":" "},{"text":"[Custom…]","color":"gold","clickEvent":{"action":"suggest_command","value":"/scoreboard players set #drop_chance cd "},"hoverEvent":{"action":"show_text","value":"§eType a custom 1-in-N value"}}]
tellraw @s ["",{"text":"  Coord range: ","color":"gray"},{"text":"0 — ","color":"dark_gray"},{"score":{"name":"#coord_max","objective":"cd"},"color":"yellow"}]
tellraw @s ["",{"text":"  Set range: ","color":"gray"},{"text":"[500]","color":"aqua","clickEvent":{"action":"run_command","value":"/scoreboard players set #coord_max cd 500"},"hoverEvent":{"action":"show_text","value":"Drop within 500 blocks of 0,0"}},{"text":" "},{"text":"[1000]","color":"aqua","clickEvent":{"action":"run_command","value":"/scoreboard players set #coord_max cd 1000"},"hoverEvent":{"action":"show_text","value":"Drop within 1000 blocks of 0,0"}},{"text":" "},{"text":"[2000]","color":"aqua","clickEvent":{"action":"run_command","value":"/scoreboard players set #coord_max cd 2000"},"hoverEvent":{"action":"show_text","value":"Drop within 2000 blocks of 0,0"}},{"text":" "},{"text":"[3500]","color":"aqua","clickEvent":{"action":"run_command","value":"/scoreboard players set #coord_max cd 3500"},"hoverEvent":{"action":"show_text","value":"Drop within 3500 blocks of 0,0"}},{"text":" "},{"text":"[5000]","color":"gold","clickEvent":{"action":"run_command","value":"/scoreboard players set #coord_max cd 5000"},"hoverEvent":{"action":"show_text","value":"Drop within 5000 blocks of 0,0"}},{"text":" "},{"text":"[Custom…]","color":"gold","clickEvent":{"action":"suggest_command","value":"/scoreboard players set #coord_max cd "},"hoverEvent":{"action":"show_text","value":"§eType a custom max coordinate"}}]
tellraw @s ["",{"text":"  "},{"text":"[⚡ Force Drop]","color":"yellow","bold":true,"clickEvent":{"action":"run_command","value":"/function crystal_drop:admin/force_drop"},"hoverEvent":{"action":"show_text","value":"§eForce a crystal drop right now"}},{"text":"   "},{"text":"[↺ Reset Timer]","color":"aqua","clickEvent":{"action":"run_command","value":"/function crystal_drop:admin/reset_timer"},"hoverEvent":{"action":"show_text","value":"Reset the drop timer to 0"}},{"text":"   "},{"text":"[◈ Toggle]","color":"light_purple","clickEvent":{"action":"run_command","value":"/function crystal_drop:admin/toggle"},"hoverEvent":{"action":"show_text","value":"Toggle the system on/off"}},{"text":"   "},{"text":"[📊 Status]","color":"green","clickEvent":{"action":"run_command","value":"/function crystal_drop:admin/status"},"hoverEvent":{"action":"show_text","value":"Show full status report"}}]
tellraw @s ["",{"text":"╔══════════════════════════════╗","color":"dark_purple"}]