Новогодняя мини-игра «Найди подарки»

Датапаки

Кто найдёт больше подарков за раундПодробнее

Вокруг игрока появляются подарки — кто найдёт больше за раунд, тот победил. За каждый подарок — очко и приз. Датапак для Minecraft 1.21.9 — 26.3, старт без прав оператора и без модов.

Моя игра выбрать версию

Запомним в этом браузере и подставим там, где доступна твоя версия. Настройки открытой ссылки важнее этого выбора; отметки версии в вики не меняются.

Подарки

Сколько подарков

Как далеко прятать

Как играть

Датапак · 1.21.9 — 26.3

Любой игрок пишет в чат

/trigger gifts
Подарков
20
Радиус
32
Раунд
5 мин
Скачать датапак
Что внутри архива — 16 файлов

data/minecraft/tags/function/load.json

Тег load: игра зовёт эти функции при загрузке мира и после /reload.

{
  "values": [
    "gifthunt:load"
  ]
}

data/minecraft/tags/function/tick.json

Тег tick: эти функции идут каждый тик — 20 раз в секунду.

{
  "values": [
    "gifthunt:tick"
  ]
}

data/gifthunt/function/load.mcfunction

При загрузке мира: счёт находок, служебный счёт и триггер старта.

scoreboard objectives add gifthunt dummy {"text":"Подарки","color":"red"}
scoreboard objectives add gifthunt_sys dummy
scoreboard objectives add gifts trigger "Начать поиск подарков"
execute if score #running gifthunt_sys matches 1 run function gifthunt:finish
tellraw @a ["",{"text":"Найди подарки загружена. Начать — "},{"text":"/trigger gifts","color":"gold","click_event":{"action":"run_command","command":"/trigger gifts"}},{"text":"."}]

data/gifthunt/function/tick.mcfunction

Каждый тик: старт по триггеру, какие подарки сломали, искры над оставшимися.

scoreboard players enable @a gifts
execute as @a[scores={gifts=1..}] run function gifthunt:start
execute if score #running gifthunt_sys matches 1 as @e[type=marker,tag=gifthunt_gift] at @s unless block ~ ~ ~ minecraft:player_head run function gifthunt:found
execute if score #hint gifthunt_sys matches 1 at @e[type=marker,tag=gifthunt_gift] run particle minecraft:happy_villager ~ ~0.6 ~ 0.2 0.3 0.2 0 1

data/gifthunt/function/round/start.mcfunction

Старт отсчёта: 300 с полосой босса.

bossbar remove gifthunt:round
bossbar add gifthunt:round {"text":"До конца поиска"}
bossbar set gifthunt:round color green
bossbar set gifthunt:round max 300
scoreboard players set #round gifthunt_sys 300
function gifthunt:round/second

data/gifthunt/function/round/second.mcfunction

Раз в секунду: полоса и надпись «мм:сс», по нулю — конец.

execute if score #round gifthunt_sys matches ..0 run return run function gifthunt:round/end
bossbar set gifthunt:round players @a
execute store result bossbar gifthunt:round value run scoreboard players get #round gifthunt_sys
scoreboard players operation #m gifthunt_sys = #round gifthunt_sys
scoreboard players operation #s gifthunt_sys = #round gifthunt_sys
scoreboard players set #60 gifthunt_sys 60
scoreboard players operation #m gifthunt_sys /= #60 gifthunt_sys
scoreboard players operation #s gifthunt_sys %= #60 gifthunt_sys
execute if score #s gifthunt_sys matches 10.. run bossbar set gifthunt:round name ["",{"text":"До конца поиска "},{"score":{"name":"#m","objective":"gifthunt_sys"}},{"text":":"},{"score":{"name":"#s","objective":"gifthunt_sys"}}]
execute if score #s gifthunt_sys matches ..9 run bossbar set gifthunt:round name ["",{"text":"До конца поиска "},{"score":{"name":"#m","objective":"gifthunt_sys"}},{"text":":0"},{"score":{"name":"#s","objective":"gifthunt_sys"}}]
scoreboard players remove #round gifthunt_sys 1
schedule function gifthunt:round/second 1s

data/gifthunt/function/round/end.mcfunction

Время вышло: полосу убрать, дальше — своё.

bossbar remove gifthunt:round
function gifthunt:finish

data/gifthunt/function/round/stop.mcfunction

Остановить отсчёт.

schedule clear gifthunt:round/second
bossbar remove gifthunt:round

data/gifthunt/function/start.mcfunction

Старт: 20 подарков вокруг игрока и отсчёт 5 мин.

scoreboard players set @s gifts 0
execute if score #running gifthunt_sys matches 1 run return run tellraw @s {"text":"Поиск уже идёт."}
execute at @s run function gifthunt:spread
execute if score #placed gifthunt_sys matches 0 run return run tellraw @s {"text":"Вокруг нет места для подарков — отойди от воды.","color":"red"}
scoreboard players reset * gifthunt
scoreboard players set @a gifthunt 0
scoreboard objectives setdisplay sidebar gifthunt
scoreboard players set #left gifthunt_sys 20
scoreboard players set #running gifthunt_sys 1
title @a title {"text":"Найди подарки!","color":"red"}
title @a subtitle {"text":"20 подарков в 32 блоках вокруг"}
function gifthunt:round/start
schedule function gifthunt:hint 240s

data/gifthunt/function/spread.mcfunction

Маркеры по местам — верхний блок, не вода и не лава, — и подарки на них.

summon minecraft:marker ~ ~ ~ {Tags:["gifthunt_gift","gifthunt_new"]}
summon minecraft:marker ~ ~ ~ {Tags:["gifthunt_gift","gifthunt_new"]}
summon minecraft:marker ~ ~ ~ {Tags:["gifthunt_gift","gifthunt_new"]}
summon minecraft:marker ~ ~ ~ {Tags:["gifthunt_gift","gifthunt_new"]}
summon minecraft:marker ~ ~ ~ {Tags:["gifthunt_gift","gifthunt_new"]}
summon minecraft:marker ~ ~ ~ {Tags:["gifthunt_gift","gifthunt_new"]}
summon minecraft:marker ~ ~ ~ {Tags:["gifthunt_gift","gifthunt_new"]}
summon minecraft:marker ~ ~ ~ {Tags:["gifthunt_gift","gifthunt_new"]}
summon minecraft:marker ~ ~ ~ {Tags:["gifthunt_gift","gifthunt_new"]}
summon minecraft:marker ~ ~ ~ {Tags:["gifthunt_gift","gifthunt_new"]}
summon minecraft:marker ~ ~ ~ {Tags:["gifthunt_gift","gifthunt_new"]}
summon minecraft:marker ~ ~ ~ {Tags:["gifthunt_gift","gifthunt_new"]}
summon minecraft:marker ~ ~ ~ {Tags:["gifthunt_gift","gifthunt_new"]}
summon minecraft:marker ~ ~ ~ {Tags:["gifthunt_gift","gifthunt_new"]}
summon minecraft:marker ~ ~ ~ {Tags:["gifthunt_gift","gifthunt_new"]}
summon minecraft:marker ~ ~ ~ {Tags:["gifthunt_gift","gifthunt_new"]}
summon minecraft:marker ~ ~ ~ {Tags:["gifthunt_gift","gifthunt_new"]}
summon minecraft:marker ~ ~ ~ {Tags:["gifthunt_gift","gifthunt_new"]}
summon minecraft:marker ~ ~ ~ {Tags:["gifthunt_gift","gifthunt_new"]}
summon minecraft:marker ~ ~ ~ {Tags:["gifthunt_gift","gifthunt_new"]}
execute store success score #placed gifthunt_sys run spreadplayers ~ ~ 3 32 false @e[type=marker,tag=gifthunt_new]
execute if score #placed gifthunt_sys matches 0 run return run kill @e[type=marker,tag=gifthunt_new]
execute as @e[type=marker,tag=gifthunt_new] at @s run function gifthunt:place

data/gifthunt/function/place.mcfunction

Подарок одного из четырёх цветов на месте маркера.

tag @s remove gifthunt_new
execute store result score #roll gifthunt_sys run random value 1..4
execute if score #roll gifthunt_sys matches 1 run setblock ~ ~ ~ minecraft:player_head{profile:{properties:[{name:"textures",value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHBzOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2JkN2E5ZjZlZDA4ZGQyMTdmZGYwOWY0NjUyYmY2YjdhZjYyMWUxZDVmODk2MzYwNTM0OWRhNzM5OThhNDQzIn19fQ=="}]}}
execute if score #roll gifthunt_sys matches 2 run setblock ~ ~ ~ minecraft:player_head{profile:{properties:[{name:"textures",value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHBzOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzY0YWJlODFlNmY0OTYxZTBmNmJkODJmMmQ0MTM1YjZiNWZjODQ1NzM5ZTcxY2ZlM2I4OTQzNTMxZDkyMWUifX19"}]}}
execute if score #roll gifthunt_sys matches 3 run setblock ~ ~ ~ minecraft:player_head{profile:{properties:[{name:"textures",value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHBzOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2Y1NjEyZGM3Yjg2ZDcxYWZjMTE5NzMwMWMxNWZkOTc5ZTlmMzllN2IxZjQxZDhmMWViZGY4MTE1NTc2ZTJlIn19fQ=="}]}}
execute if score #roll gifthunt_sys matches 4 run setblock ~ ~ ~ minecraft:player_head{profile:{properties:[{name:"textures",value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHBzOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2RkYzVlM2FmY2E2YTU4NzczNTBkNGUxMzVhMWIxZjZmZGZjN2Q5YTRjZmM5MzYxOGJlNTYzMzY5MTMyZTAifX19"}]}}

data/gifthunt/function/found.mcfunction

Подарок сломали: очко ближайшему игроку в 6 блоках.

scoreboard players remove #left gifthunt_sys 1
execute as @p[distance=..6,gamemode=!spectator] run function gifthunt:reward
kill @s
execute if score #left gifthunt_sys matches ..0 run function gifthunt:all_found

data/gifthunt/function/reward.mcfunction

Очко, случайный подарок из списка и звук находки.

scoreboard players add @s gifthunt 1
execute store result score #roll gifthunt_sys run random value 1..8
execute if score #roll gifthunt_sys matches 1 run give @s minecraft:cookie 3
execute if score #roll gifthunt_sys matches 2 run give @s minecraft:snowball 8
execute if score #roll gifthunt_sys matches 3 run give @s minecraft:firework_rocket 2
execute if score #roll gifthunt_sys matches 4 run give @s minecraft:golden_apple 1
execute if score #roll gifthunt_sys matches 5 run give @s minecraft:cake 1
execute if score #roll gifthunt_sys matches 6 run give @s minecraft:sweet_berries 5
execute if score #roll gifthunt_sys matches 7 run give @s minecraft:emerald 2
execute if score #roll gifthunt_sys matches 8 run give @s minecraft:diamond 1
playsound minecraft:entity.player.levelup player @s
title @s actionbar ["",{"text":"Подарок! ","color":"gold"},{"text":"Осталось: "},{"score":{"name":"#left","objective":"gifthunt_sys"}}]

data/gifthunt/function/hint.mcfunction

Последняя минута: над ненайденными подарками искры.

scoreboard players set #hint gifthunt_sys 1
title @a actionbar {"text":"Последняя минута — над подарками искры!","color":"yellow"}

data/gifthunt/function/all_found.mcfunction

Нашли все подарки — отсчёт остановить, подвести итог.

function gifthunt:round/stop
function gifthunt:finish

data/gifthunt/function/finish.mcfunction

Итог: кто нашёл больше всех; ненайденные подарки убираются.

scoreboard players set #running gifthunt_sys 0
scoreboard players set #hint gifthunt_sys 0
schedule clear gifthunt:hint
execute as @e[type=marker,tag=gifthunt_gift] at @s if block ~ ~ ~ minecraft:player_head run setblock ~ ~ ~ minecraft:air
kill @e[type=marker,tag=gifthunt_gift]
scoreboard players set #best gifthunt_sys 0
scoreboard players operation #best gifthunt_sys > @a gifthunt
title @a title {"text":"Поиск окончен!","color":"gold"}
execute if score #best gifthunt_sys matches 0 run tellraw @a {"text":"Никто не нашёл ни одного подарка."}
execute if score #best gifthunt_sys matches 1.. as @a if score @s gifthunt = #best gifthunt_sys run tellraw @a ["",{"selector":"@s"},{"text":" — больше всех: "},{"score":{"name":"#best","objective":"gifthunt_sys"}},{"text":"!"}]

Как поставить

  1. Скачай датапак

    Распаковывать не нужно: игра читает его прямо из zip.

  2. Положи в мир

    В одиночной игре — saves/<мир>/datapacks, на сервере — world/datapacks. Подойдёт любой мир: подарки встают на землю сами.

  3. Начни поиск

    /reload, потом /trigger gifts — подарки появятся вокруг того, кто начал. Режим игры — выживание: подарок нужно сломать.

Что в подарках

Каждый найденный подарок — один случайный приз из списка.

Что нужно знать

  • Место выбирает игра. Подарки встают на верхний блок — на землю, крыши и кроны деревьев, — но не на воду и лаву. Вокруг одна вода — поиск не начнётся, игра скажет почему.
  • Очко — тому, кто рядом. Подарок сломали — очко и приз получает ближайший игрок в 6 блоках. Проверено на сервере 26.3: игрок ломает подарок рукой, и очко приходит ему.
  • Конец — сам. Нашли все подарки или вышло время — в чате итог, у кого больше всех. Ненайденные подарки исчезают.
  • Без интернета. Подарки — головы с текстурой внутри блока: сервер не ходит к Mojang, пиратскому серверу это подходит.

Украсить мир к празднику — новогодний ресурспак и новогодний дом. Сервера с новогодними ивентами — в мониторинге.

Частые вопросы

Как сделать новогоднюю мини-игру в Майнкрафте?

Поставь датапак «Найди подарки» в мир и напиши /trigger gifts: вокруг появятся подарки. Кто найдёт больше за раунд, тот победил. Моды и права оператора не нужны.

Куда игра прячет подарки?

На верхний блок в выбранном радиусе: на землю, крыши и кроны деревьев, но не на воду и лаву. Подарки стоят не ближе трёх блоков друг к другу.

Кому достаётся подарок?

Тому, кто его сломал: очко и случайный приз получает ближайший игрок в шести блоках. Нашли все или вышло время — в чате итог.