Skip to content
This repository was archived by the owner on Apr 9, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions data/macro/function/entity/for_each_in_radius.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# ─────────────────────────────────────────────────────────────────
# macro:entity/for_each_in_radius
# Runs a function as every entity of a given type within radius
# of the named player.
#
# INPUT : $(player) → player name (origin)
# $(type) → entity type (e.g. "minecraft:zombie")
# $(radius) → search radius in blocks
# $(func) → function to run as each entity (at its position)
#
# EXAMPLE:
# function macro:entity/for_each_in_radius {player:"Steve",type:"minecraft:zombie",radius:10,func:"mypack:on_zombie"}
# ─────────────────────────────────────────────────────────────────

$execute as @a[name=$(player),limit=1] at @s run execute as @e[type=$(type),distance=..$(radius)] at @s run function $(func)
$tellraw @a[tag=macro.debug] ["",{"text":"[AME] ","color":"#00AAAA","bold":true},{"text":"entity/for_each_in_radius ","color":"aqua"},{"text":"$(player) r=$(radius) → ","color":"gray"},{"text":"$(type)","color":"aqua"}]
15 changes: 15 additions & 0 deletions data/macro/function/inv/offhand_item.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# ─────────────────────────────────────────────────────────────────
# macro:inv/offhand_item
# Runs a command/function for each player in @a whose offhand
# matches the given item id and custom data.
# Mirrors the pattern of macro:inv/selected_item (mainhand).
#
# INPUT : $(item) → item id (e.g. "minecraft:shield")
# $(customData) → custom_data compound to match (e.g. "{my_tag:1b}")
# $(invoke) → command to run as the matching player
#
# EXAMPLE:
# function macro:inv/offhand_item {item:"minecraft:shield",customData:"{my_tag:1b}",invoke:"function mypack:on_shield"}
# ─────────────────────────────────────────────────────────────────

$execute as @a at @s if items entity @s weapon.offhand $(item)[minecraft:custom_data=$(customData)] run $(invoke)
22 changes: 22 additions & 0 deletions data/macro/function/player/is_burning.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# ─────────────────────────────────────────────────────────────────
# macro:player/is_burning
# Checks whether a named player is currently on fire.
# Uses the macro:is_burning predicate (entity_flags).
#
# INPUT : $(player) → player name
# OUTPUT: macro:output result → 1b if burning, 0b otherwise
# macro:output found → 1b if player online, 0b otherwise
#
# EXAMPLE:
# function macro:player/is_burning {player:"Steve"}
# → macro:output result = 1b
# ─────────────────────────────────────────────────────────────────

data modify storage macro:output found set value 0b
data modify storage macro:output result set value 0b

$execute unless entity @a[name=$(player),limit=1] run return 0

data modify storage macro:output found set value 1b
$execute as @a[name=$(player),limit=1] if predicate macro:is_burning run data modify storage macro:output result set value 1b
$tellraw @a[tag=macro.debug] ["",{"text":"[AME] ","color":"#00AAAA","bold":true},{"text":"player/is_burning ","color":"aqua"},{"text":"$(player) → ","color":"gray"},{"storage":"macro:output","nbt":"result","color":"green"}]
22 changes: 22 additions & 0 deletions data/macro/function/player/is_on_ground.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# ─────────────────────────────────────────────────────────────────
# macro:player/is_on_ground
# Checks whether a named player is currently on the ground.
# Uses the macro:is_on_ground predicate (entity_flags).
#
# INPUT : $(player) → player name
# OUTPUT: macro:output result → 1b if on ground, 0b otherwise
# macro:output found → 1b if player online, 0b otherwise
#
# EXAMPLE:
# function macro:player/is_on_ground {player:"Steve"}
# → macro:output result = 1b
# ─────────────────────────────────────────────────────────────────

data modify storage macro:output found set value 0b
data modify storage macro:output result set value 0b

$execute unless entity @a[name=$(player),limit=1] run return 0

data modify storage macro:output found set value 1b
$execute as @a[name=$(player),limit=1] if predicate macro:is_on_ground run data modify storage macro:output result set value 1b
$tellraw @a[tag=macro.debug] ["",{"text":"[AME] ","color":"#00AAAA","bold":true},{"text":"player/is_on_ground ","color":"aqua"},{"text":"$(player) → ","color":"gray"},{"storage":"macro:output","nbt":"result","color":"green"}]
17 changes: 17 additions & 0 deletions data/macro/function/world/get_time.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# ─────────────────────────────────────────────────────────────────
# macro:world/get_time
# Reads the current world time and writes it to macro:output.
#
# OUTPUT: macro:output daytime → ticks within the current day (0–23999)
# macro:output total → total world age in ticks (never resets)
# macro:output day → current in-game day number
#
# EXAMPLE:
# function macro:world/get_time
# data get storage macro:output daytime
# ─────────────────────────────────────────────────────────────────

execute store result storage macro:output daytime int 1 run time query daytime
execute store result storage macro:output total int 1 run time query gametime
execute store result storage macro:output day int 1 run time query day
tellraw @a[tag=macro.debug] ["",{"text":"[AME] ","color":"#00AAAA","bold":true},{"text":"world/get_time ","color":"aqua"},{"text":"day=","color":"gray"},{"storage":"macro:output","nbt":"day","color":"green"},{"text":" daytime=","color":"gray"},{"storage":"macro:output","nbt":"daytime","color":"green"}]
Loading