diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/cb/cancel.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/cb/cancel.mcfunction index fe082ce..30f431d 100644 --- a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/cb/cancel.mcfunction +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/cb/cancel.mcfunction @@ -10,6 +10,11 @@ # function macroengine:api/cb/cancel # ───────────────────────────────────────────────────────────────── +# Security gate — see core/internal/security/check_all. +# No-op (always passes) unless flags.experimental.strict_gating is on. +scoreboard players set $cbc_gate macroengine.tmp 1 +execute store success score $cbc_gate macroengine.tmp run function macroengine:core/internal/security/check_all {required:"cmd_min_level"} +execute if score $cbc_gate macroengine.tmp matches 0 run return 0 data remove storage macroengine:engine cb_queue data modify storage macroengine:engine cb_queue set value [] diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/cb/run.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/cb/run.mcfunction index f0e0d94..e219e6c 100644 --- a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/cb/run.mcfunction +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/cb/run.mcfunction @@ -16,7 +16,11 @@ # function macroengine:api/cb/run # ───────────────────────────────────────────────────────────────── -# Security gate +# Security gate — see core/internal/security/check_all. +# No-op (always passes) unless flags.experimental.strict_gating is on. +scoreboard players set $cbr_gate macroengine.tmp 1 +execute store success score $cbr_gate macroengine.tmp run function macroengine:core/internal/security/check_all {required:"cmd_min_level"} +execute if score $cbr_gate macroengine.tmp matches 0 run return 0 # Verify required input execute unless data storage macroengine:input cb.cmd run tellraw @s [{"text":"[MACROENGINE/cb] ","color":"#00AAAA","bold":true},{"text":"cb.cmd not set","color":"red"}] diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/cb/run_delayed.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/cb/run_delayed.mcfunction index 156b8c1..6715ec4 100644 --- a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/cb/run_delayed.mcfunction +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/cb/run_delayed.mcfunction @@ -16,7 +16,11 @@ # function macroengine:api/cb/run_delayed # ───────────────────────────────────────────────────────────────── -# Security gate +# Security gate — see core/internal/security/check_all. +# No-op (always passes) unless flags.experimental.strict_gating is on. +scoreboard players set $cbrd_gate macroengine.tmp 1 +execute store success score $cbrd_gate macroengine.tmp run function macroengine:core/internal/security/check_all {required:"cmd_min_level"} +execute if score $cbrd_gate macroengine.tmp matches 0 run return 0 # Verify required inputs execute unless data storage macroengine:input cb.cmd run tellraw @s [{"text":"[MACROENGINE/cb] ","color":"#00AAAA","bold":true},{"text":"cb.cmd not set","color":"red"}] diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/cb/run_sequence.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/cb/run_sequence.mcfunction index 14571a7..52bab29 100644 --- a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/cb/run_sequence.mcfunction +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/cb/run_sequence.mcfunction @@ -17,7 +17,11 @@ # function macroengine:api/cb/run_sequence # ───────────────────────────────────────────────────────────────── -# Security gate +# Security gate — see core/internal/security/check_all. +# No-op (always passes) unless flags.experimental.strict_gating is on. +scoreboard players set $cbrs_gate macroengine.tmp 1 +execute store success score $cbrs_gate macroengine.tmp run function macroengine:core/internal/security/check_all {required:"cmd_min_level"} +execute if score $cbrs_gate macroengine.tmp matches 0 run return 0 # Verify required input execute unless data storage macroengine:input cb.cmds[0] run tellraw @s [{"text":"[MACROENGINE/cb] ","color":"#00AAAA","bold":true},{"text":"cb.cmds is empty or not set","color":"red"}] diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/toggle/experimental/false.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/toggle/experimental/false.mcfunction new file mode 100644 index 0000000..60634ca --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/toggle/experimental/false.mcfunction @@ -0,0 +1,11 @@ +# macroengine:api/toggle/experimental/false [MACRO] — Disable one experimental flag +# Called by the experimental flags menu, or directly: +# function macroengine:api/toggle/experimental/false {flag:"hologram"} +# Caller: macroengine.admin tag required + +execute unless entity @s[tag=macroengine.admin] run return 0 + +$function macroengine:systems/flag/experimental/set {flag:"$(flag)",value:"0b"} + +$tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"experimental/","color":"gray"},{"text":"$(flag)","color":"aqua"},{"text":" → ","color":"#555555"},{"text":"disabled","color":"red"}] +$tellraw @a[tag=macroengine.debug] ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"toggle/experimental ","color":"aqua"},{"text":"$(flag)","color":"white"},{"text":" → ","color":"#555555"},{"text":"false","color":"red"}] diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/toggle/experimental/show.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/toggle/experimental/show.mcfunction new file mode 100644 index 0000000..b9b5d1b --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/toggle/experimental/show.mcfunction @@ -0,0 +1,39 @@ +# macroengine:api/toggle/experimental/show +# Prints a clickable experimental-flag enable/disable menu. +# +# Usage: function macroengine:api/toggle/experimental/show +# Caller: macroengine.admin tag required +# +# Each button runs: +# /function macroengine:api/toggle/experimental/ {flag:""} +# +# Flags: +# strict_gating — enables core/internal/security/check_all enforcement +# (cmd_min_level / sandbox_cmd_min_level / admin_min_level). +# Turn this OFF immediately if permission checks start +# blocking things that should work — every threshold +# defaults to 0 (everyone passes) so it's safe to leave +# on, but it's the flag that previously caused problems +# and got removed, so it ships OFF by default. +# hologram — experimental/hologram/* (floating text display entities) +# particle_trail — experimental/particle_trail/* (player movement trails) +# crafting_ui — experimental/crafting_ui/* (custom crafting menu) +# waypoint — experimental/waypoint/* (set/track/compass waypoints) +# combat_tag — experimental/combat_tag/* (temporary PvP-tag on hit) +# scoreboard_hud — experimental/scoreboard_hud/* (sidebar HUD toggle) +# +# BACKPORT NOTE (1.21.2): same constraint as api/toggle/show.mcfunction — +# no `dialog show` (added 1.21.6 / pack format 80) available here, so this +# is a fixed clickable tellraw menu, not a native dialog screen. + +execute unless entity @s[tag=macroengine.admin] run return 0 + +tellraw @s ["",{"text":"═══════ ","color":"dark_gray"},{"text":"macroEngine — Experimental Flags","color":"aqua","bold":true},{"text":" ═══════","color":"dark_gray"}] +tellraw @s ["",{"text":"strict_gating ","color":"white"},{"text":"[ON] ","color":"green","bold":true,"clickEvent":{"action":"run_command","value":"/function macroengine:api/toggle/experimental/true {flag:\"strict_gating\"}"}},{"text":"[OFF]","color":"red","bold":true,"clickEvent":{"action":"run_command","value":"/function macroengine:api/toggle/experimental/false {flag:\"strict_gating\"}"}}] +tellraw @s ["",{"text":"hologram ","color":"white"},{"text":"[ON] ","color":"green","bold":true,"clickEvent":{"action":"run_command","value":"/function macroengine:api/toggle/experimental/true {flag:\"hologram\"}"}},{"text":"[OFF]","color":"red","bold":true,"clickEvent":{"action":"run_command","value":"/function macroengine:api/toggle/experimental/false {flag:\"hologram\"}"}}] +tellraw @s ["",{"text":"particle_trail ","color":"white"},{"text":"[ON] ","color":"green","bold":true,"clickEvent":{"action":"run_command","value":"/function macroengine:api/toggle/experimental/true {flag:\"particle_trail\"}"}},{"text":"[OFF]","color":"red","bold":true,"clickEvent":{"action":"run_command","value":"/function macroengine:api/toggle/experimental/false {flag:\"particle_trail\"}"}}] +tellraw @s ["",{"text":"crafting_ui ","color":"white"},{"text":"[ON] ","color":"green","bold":true,"clickEvent":{"action":"run_command","value":"/function macroengine:api/toggle/experimental/true {flag:\"crafting_ui\"}"}},{"text":"[OFF]","color":"red","bold":true,"clickEvent":{"action":"run_command","value":"/function macroengine:api/toggle/experimental/false {flag:\"crafting_ui\"}"}}] +tellraw @s ["",{"text":"waypoint ","color":"white"},{"text":"[ON] ","color":"green","bold":true,"clickEvent":{"action":"run_command","value":"/function macroengine:api/toggle/experimental/true {flag:\"waypoint\"}"}},{"text":"[OFF]","color":"red","bold":true,"clickEvent":{"action":"run_command","value":"/function macroengine:api/toggle/experimental/false {flag:\"waypoint\"}"}}] +tellraw @s ["",{"text":"combat_tag ","color":"white"},{"text":"[ON] ","color":"green","bold":true,"clickEvent":{"action":"run_command","value":"/function macroengine:api/toggle/experimental/true {flag:\"combat_tag\"}"}},{"text":"[OFF]","color":"red","bold":true,"clickEvent":{"action":"run_command","value":"/function macroengine:api/toggle/experimental/false {flag:\"combat_tag\"}"}}] +tellraw @s ["",{"text":"scoreboard_hud ","color":"white"},{"text":"[ON] ","color":"green","bold":true,"clickEvent":{"action":"run_command","value":"/function macroengine:api/toggle/experimental/true {flag:\"scoreboard_hud\"}"}},{"text":"[OFF]","color":"red","bold":true,"clickEvent":{"action":"run_command","value":"/function macroengine:api/toggle/experimental/false {flag:\"scoreboard_hud\"}"}}] +tellraw @s ["",{"text":"═════════════════════════════════════════","color":"dark_gray"}] diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/toggle/experimental/true.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/toggle/experimental/true.mcfunction new file mode 100644 index 0000000..25603a2 --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/toggle/experimental/true.mcfunction @@ -0,0 +1,11 @@ +# macroengine:api/toggle/experimental/true [MACRO] — Enable one experimental flag +# Called by the experimental flags menu, or directly: +# function macroengine:api/toggle/experimental/true {flag:"hologram"} +# Caller: macroengine.admin tag required + +execute unless entity @s[tag=macroengine.admin] run return 0 + +$function macroengine:systems/flag/experimental/set {flag:"$(flag)",value:"1b"} + +$tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"experimental/","color":"gray"},{"text":"$(flag)","color":"aqua"},{"text":" → ","color":"#555555"},{"text":"enabled","color":"green"}] +$tellraw @a[tag=macroengine.debug] ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"toggle/experimental ","color":"aqua"},{"text":"$(flag)","color":"white"},{"text":" → ","color":"#555555"},{"text":"true","color":"green"}] diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/toggle/show.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/toggle/show.mcfunction index 059acbe..f5d0981 100644 --- a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/toggle/show.mcfunction +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/api/toggle/show.mcfunction @@ -27,3 +27,4 @@ tellraw @s ["",{"text":"perm ","color":"white"},{"text":"[ON] ","color":"g tellraw @s ["",{"text":"wand ","color":"white"},{"text":"[ON] ","color":"green","bold":true,"clickEvent":{"action":"run_command","value":"/function macroengine:api/toggle/wand/true"}},{"text":"[OFF]","color":"red","bold":true,"clickEvent":{"action":"run_command","value":"/function macroengine:api/toggle/wand/false"}}] tellraw @s ["",{"text":"geo ","color":"white"},{"text":"[ON] ","color":"green","bold":true,"clickEvent":{"action":"run_command","value":"/function macroengine:api/toggle/geo/true"}},{"text":"[OFF]","color":"red","bold":true,"clickEvent":{"action":"run_command","value":"/function macroengine:api/toggle/geo/false"}}] tellraw @s ["",{"text":"cb ","color":"white"},{"text":"[ON] ","color":"green","bold":true,"clickEvent":{"action":"run_command","value":"/function macroengine:api/toggle/cb/true"}},{"text":"[OFF]","color":"red","bold":true,"clickEvent":{"action":"run_command","value":"/function macroengine:api/toggle/cb/false"}}] +tellraw @s ["",{"text":"› experimental flags","color":"yellow","italic":true,"clickEvent":{"action":"run_command","value":"/function macroengine:api/toggle/experimental/show"},"hoverEvent":{"action":"show_text","value":"Open the experimental feature-flag menu"}}] diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/config.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/config.mcfunction index 87b74ea..818200c 100644 --- a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/config.mcfunction +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/config.mcfunction @@ -30,8 +30,27 @@ execute unless data storage macroengine:engine config.namespace_allowlist run da execute if data storage macroengine:engine config{sandbox:1b} run data modify storage macroengine:engine sandbox set value 1b execute unless data storage macroengine:engine config{sandbox:1b} run data modify storage macroengine:engine sandbox set value 0b -# Admin min level storage (legacy readers; not enforced when gates removed) +# Admin/cmd/sandbox min level storage. Enforced by core/internal/security/check_all +# ONLY while flags.experimental.strict_gating is on (see below) — otherwise these +# are read but never compared against anything, same as before that flag existed. +# Threshold 0 = everyone passes even when strict_gating is on; raise these once +# you've confirmed strict_gating is stable for your server. execute unless data storage macroengine:engine security run data modify storage macroengine:engine security set value {} execute unless data storage macroengine:engine security.admin_min_level run data modify storage macroengine:engine security.admin_min_level set value 0 execute unless data storage macroengine:engine security.cmd_min_level run data modify storage macroengine:engine security.cmd_min_level set value 0 execute unless data storage macroengine:engine security.sandbox_cmd_min_level run data modify storage macroengine:engine security.sandbox_cmd_min_level set value 0 + +# ── Experimental feature flags (systems/flag/experimental/*) ────── +# All default OFF. Each gates one piece of new/previously-removed +# functionality so it can be toggled without editing files or /reload +# stripping intent. See systems/flag/experimental/list.mcfunction for +# the authoritative description of each flag. +execute unless data storage macroengine:engine flags run data modify storage macroengine:engine flags set value {} +execute unless data storage macroengine:engine flags.experimental run data modify storage macroengine:engine flags.experimental set value {} +execute unless data storage macroengine:engine flags.experimental.strict_gating run data modify storage macroengine:engine flags.experimental.strict_gating set value 0b +execute unless data storage macroengine:engine flags.experimental.hologram run data modify storage macroengine:engine flags.experimental.hologram set value 0b +execute unless data storage macroengine:engine flags.experimental.particle_trail run data modify storage macroengine:engine flags.experimental.particle_trail set value 0b +execute unless data storage macroengine:engine flags.experimental.crafting_ui run data modify storage macroengine:engine flags.experimental.crafting_ui set value 0b +execute unless data storage macroengine:engine flags.experimental.waypoint run data modify storage macroengine:engine flags.experimental.waypoint set value 0b +execute unless data storage macroengine:engine flags.experimental.combat_tag run data modify storage macroengine:engine flags.experimental.combat_tag set value 0b +execute unless data storage macroengine:engine flags.experimental.scoreboard_hud run data modify storage macroengine:engine flags.experimental.scoreboard_hud set value 0b diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/api/wand/call_cmd.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/api/wand/call_cmd.mcfunction index 0db79d7..428405d 100644 --- a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/api/wand/call_cmd.mcfunction +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/api/wand/call_cmd.mcfunction @@ -1,6 +1,13 @@ # macroengine:api/wand/internal/call_cmd [MACRO] -# SECURITY: central gate +# SECURITY: central gate — see core/internal/security/check_all. +# No-op (always passes) unless flags.experimental.strict_gating is on. +# NOTE: `function {args}` can only appear after `run` — it cannot +# sit in an `execute if/unless` condition with inline NBT args, so the +# call and the result check are two separate steps here. +scoreboard players set $wcc_gate macroengine.tmp 1 +execute store success score $wcc_gate macroengine.tmp run function macroengine:core/internal/security/check_all {required:"sandbox_cmd_min_level"} +execute if score $wcc_gate macroengine.tmp matches 0 run return 0 tellraw @a[tag=macroengine.admin] [{"selector":"@s","color":"gold"},{"text":" - command executed","color":"yellow"}] diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/experimental/crafting_ui/check_ingredients.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/experimental/crafting_ui/check_ingredients.mcfunction new file mode 100644 index 0000000..b920dcd --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/experimental/crafting_ui/check_ingredients.mcfunction @@ -0,0 +1,17 @@ +# macroengine:core/internal/experimental/crafting_ui/check_ingredients [MACRO] +# Called `with storage macroengine:engine _crafting_ui.active` — receives +# the recipe compound (ingredients, result) as macro context. Recursively +# checks each ingredient is present in sufficient count via +# `clear @s 0` (count-only, does not remove — see +# player/inv/count_item.mcfunction for the same trick used elsewhere). +# Sets _crafting_ui.ok to 0b on the first missing ingredient found. + +execute unless data storage macroengine:engine _crafting_ui.active.ingredients[0] run return 0 + +data modify storage macroengine:engine _cui_ing set from storage macroengine:engine _crafting_ui.active.ingredients[0] +data remove storage macroengine:engine _crafting_ui.active.ingredients[0] + +function macroengine:core/internal/experimental/crafting_ui/check_one_ingredient with storage macroengine:engine _cui_ing +data remove storage macroengine:engine _cui_ing + +execute if data storage macroengine:engine _crafting_ui.active.ingredients[0] run function macroengine:core/internal/experimental/crafting_ui/check_ingredients with storage macroengine:engine _crafting_ui.active diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/experimental/crafting_ui/check_one_ingredient.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/experimental/crafting_ui/check_one_ingredient.mcfunction new file mode 100644 index 0000000..7712115 --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/experimental/crafting_ui/check_one_ingredient.mcfunction @@ -0,0 +1,8 @@ +# macroengine:core/internal/experimental/crafting_ui/check_one_ingredient [MACRO] +# INPUT (macro): $(item) -> item id string, $(count) -> required count +# Uses `clear @s 0` (count-only probe, nothing removed) to read +# how many the caller holds, same trick as player/inv/count_item.mcfunction. + +scoreboard players set $cui_have macroengine.tmp 0 +$execute store result score $cui_have macroengine.tmp run clear @s $(item) 0 +$execute unless score $cui_have macroengine.tmp matches $(count).. run data modify storage macroengine:engine _crafting_ui.ok set value 0b diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/experimental/crafting_ui/consume_ingredients.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/experimental/crafting_ui/consume_ingredients.mcfunction new file mode 100644 index 0000000..d61c92d --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/experimental/crafting_ui/consume_ingredients.mcfunction @@ -0,0 +1,15 @@ +# macroengine:core/internal/experimental/crafting_ui/consume_ingredients [MACRO] +# Called `with storage macroengine:engine _crafting_ui.active` AFTER +# check_ingredients has already confirmed every ingredient is present — +# this file does not re-check, only removes. Recursive pop-front, +# same convention as check_ingredients.mcfunction. + +execute unless data storage macroengine:engine _crafting_ui.active.ingredients[0] run return 0 + +data modify storage macroengine:engine _cui_ing set from storage macroengine:engine _crafting_ui.active.ingredients[0] +data remove storage macroengine:engine _crafting_ui.active.ingredients[0] + +function macroengine:core/internal/experimental/crafting_ui/consume_one_ingredient with storage macroengine:engine _cui_ing +data remove storage macroengine:engine _cui_ing + +execute if data storage macroengine:engine _crafting_ui.active.ingredients[0] run function macroengine:core/internal/experimental/crafting_ui/consume_ingredients with storage macroengine:engine _crafting_ui.active diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/experimental/crafting_ui/consume_one_ingredient.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/experimental/crafting_ui/consume_one_ingredient.mcfunction new file mode 100644 index 0000000..8c146ff --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/experimental/crafting_ui/consume_one_ingredient.mcfunction @@ -0,0 +1,3 @@ +# macroengine:core/internal/experimental/crafting_ui/consume_one_ingredient [MACRO] +# INPUT (macro): $(item) -> item id string, $(count) -> amount to remove +$clear @s $(item) $(count) diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/experimental/crafting_ui/give_result.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/experimental/crafting_ui/give_result.mcfunction new file mode 100644 index 0000000..76631ff --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/experimental/crafting_ui/give_result.mcfunction @@ -0,0 +1,3 @@ +# macroengine:core/internal/experimental/crafting_ui/give_result [MACRO] +# INPUT (macro): $(item) -> item id string, $(count) -> amount to give +$give @s $(item) $(count) diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/experimental/waypoint/do_tp.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/experimental/waypoint/do_tp.mcfunction new file mode 100644 index 0000000..51561f0 --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/experimental/waypoint/do_tp.mcfunction @@ -0,0 +1,4 @@ +# macroengine:core/internal/experimental/waypoint/do_tp [MACRO] +# Called with the waypoint compound itself as macro context +# (x, y, z, dimension) — see experimental/waypoint/tp.mcfunction. +$tp @s $(x) $(y) $(z) diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/load/loader/scoreboards.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/load/loader/scoreboards.mcfunction index 69dc696..412b43f 100644 --- a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/load/loader/scoreboards.mcfunction +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/load/loader/scoreboards.mcfunction @@ -78,3 +78,17 @@ scoreboard objectives add macroengine.gamerule dummy # State scoreboard — per-player state machine (0=idle 1=combat 2=menu ...) scoreboard objectives add macroengine.state dummy + +# Permission level — read by core/internal/security/check_all against the +# security.cmd_min_level / sandbox_cmd_min_level / admin_min_level thresholds +# (only enforced while flags.experimental.strict_gating is on). +# Default: 1 (base user). macroengine.admin tag always bypasses this +# regardless of numeric value, so admins don't need it set manually. +scoreboard objectives add macroengine.perm_level dummy + +# experimental/combat_tag — damage_dealt delta detection (same +# stat-delta pattern as the hook_* objectives above), plus a countdown +# timer per tagged player. Self-contained: only touched while +# flags.experimental.combat_tag is on. +scoreboard objectives add macroengine.exp_dmg_dealt minecraft.custom:minecraft.damage_dealt +scoreboard objectives add macroengine.exp_combat_timer dummy diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/security/check_all.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/security/check_all.mcfunction new file mode 100644 index 0000000..6f4a2e1 --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/security/check_all.mcfunction @@ -0,0 +1,44 @@ +# ───────────────────────────────────────────────────────────────── +# macroengine:core/internal/security/check_all [MACRO] +# +# THE central permission gate for cmd/, cb/, and raw wand/trigger +# dispatch. This is the function `admin_min_level`, `cmd_min_level`, +# and `sandbox_cmd_min_level` have been documented as enforcing +# (via "(check_all)" / "SECURITY: caller must hold...") since v6.0.2, +# but the function never existed — nothing actually read +# macroengine.perm_level anywhere in the pack. This file closes that gap. +# +# Gated behind flags.experimental.strict_gating (systems/flag/experimental). +# Flag OFF -> always return 1 (pass), i.e. identical to current +# (unenforced) behavior. This is a real kill switch: if strict_gating +# causes problems again, disable the flag and every caller of this +# function silently no-ops back to "allow everyone", no code changes +# needed. Flag ON -> live perm_level enforcement below. +# +# Run `as ` — @s IS the caller. Matches the pack's existing +# convention (api/cmd/*, api/cb/* already assume @s is the executor). +# +# INPUT (macro, required): +# $(required) -> threshold key in `security` storage to check against: +# "cmd_min_level" | "sandbox_cmd_min_level" | "admin_min_level" +# +# OUTPUT: returns 1 if allowed, 0 if denied. +# On denial: runs core/fallback/no_permission as the same @s (tellraw + +# log), matching no_permission's own docstring ("perm_level below +# required threshold"). +# ───────────────────────────────────────────────────────────────── + +# Flag OFF -> unconditional pass (backward-compatible / kill-switch default) +execute unless data storage macroengine:engine flags.experimental{strict_gating:1b} run return 1 + +# admin tag always passes, regardless of numeric perm_level +execute if entity @s[tag=macroengine.admin] run return 1 + +scoreboard players set $ca_required macroengine.tmp -1 +$execute store result score $ca_required macroengine.tmp run data get storage macroengine:engine security.$(required) + +execute if score @s macroengine.perm_level >= $ca_required macroengine.tmp run return 1 + +# Denied +function macroengine:core/fallback/no_permission +return 0 diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/string/zprivate/init.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/string/zprivate/init.mcfunction index 5569d1a..31a52ca 100644 --- a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/string/zprivate/init.mcfunction +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/string/zprivate/init.mcfunction @@ -11,5 +11,5 @@ data modify storage macroengine:core/internal/string/zprivate data.CharMap.Full # Tellraw execute if score #StringLib.ShowLoadMessage StringLib matches 0 run return 0 -execute if score #StringLib.ShowLoadMessage StringLib matches 1 run tellraw @a [{text:"﹌ "},{text:"StringLib >> ",color:"#99EAD6"},{text:"Installed StringLib (v0.2.0)"}] -execute if score #StringLib.ShowLoadMessage StringLib matches 1 run tellraw @a [{text:"﹌ "},{text:"StringLib >> ",color:"#99EAD6"},{text:"Click here",bold:true,color:"yellow",click_event:{action:"run_command",command:"/function macroengine:core/internal/string/debug/toggle_load_message"},hover_event:{action:"show_text",value:["/function macroengine:core/internal/string/debug/toggle_load_message"]}},{text:" to toggle the load message"}] \ No newline at end of file +execute if score #StringLib.ShowLoadMessage StringLib matches 1 run tellraw @a ["",{"text":"﹌ "},{"text":"StringLib >> ","color":"#99EAD6"},{"text":"Installed StringLib (v0.2.0)"}] +execute if score #StringLib.ShowLoadMessage StringLib matches 1 run tellraw @a ["",{"text":"﹌ "},{"text":"StringLib >> ","color":"#99EAD6"},{"text":"Click here","bold":true,"color":"yellow","clickEvent":{"action":"run_command","value":"/function macroengine:core/internal/string/debug/toggle_load_message"},"hoverEvent":{"action":"show_text","value":"/function macroengine:core/internal/string/debug/toggle_load_message"}},{"text":" to toggle the load message"}] \ No newline at end of file diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/systems/hook/on_player_join.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/systems/hook/on_player_join.mcfunction index b0a5343..cd319a7 100644 --- a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/systems/hook/on_player_join.mcfunction +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/internal/systems/hook/on_player_join.mcfunction @@ -11,3 +11,7 @@ function #macroengine:events/on_join # get_name populates macroengine:names temp.NAME; init_from_name relays it to player/init function macroengine:player/get_name function macroengine:core/internal/player/init_from_name with storage macroengine:names temp + +# Default perm_level for check_all (only if not already set — respects +# any value set by an external permission plugin before this pack loads) +execute unless score @s macroengine.perm_level matches -2147483648..2147483647 run scoreboard players set @s macroengine.perm_level 1 diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/tick/hud_systems.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/tick/hud_systems.mcfunction index 4bb4d59..420f6bf 100644 --- a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/tick/hud_systems.mcfunction +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/tick/hud_systems.mcfunction @@ -1,3 +1,9 @@ execute if data storage macroengine:engine pb_obj run scoreboard players operation $pb_mod macroengine.tmp = $epoch macroengine.time execute if data storage macroengine:engine pb_obj run scoreboard players operation $pb_mod macroengine.tmp %= $pb_four macroengine.tmp execute if data storage macroengine:engine pb_obj run execute if score $pb_mod macroengine.tmp matches 0 run execute as @a run function macroengine:systems/string/progress_bar_self with storage macroengine:engine {} + +# experimental/scoreboard_hud — auto-hide if the flag was turned off +# while the HUD was showing, so disabling the flag actually removes it +# instead of leaving a stale sidebar. +execute if score #exp_hud_on macroengine.tmp matches 1 unless data storage macroengine:engine flags.experimental{scoreboard_hud:1b} run scoreboard objectives setdisplay sidebar +execute if score #exp_hud_on macroengine.tmp matches 1 unless data storage macroengine:engine flags.experimental{scoreboard_hud:1b} run scoreboard players set #exp_hud_on macroengine.tmp 0 diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/tick/player_systems.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/tick/player_systems.mcfunction index 83e7aa6..abdaca6 100644 --- a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/tick/player_systems.mcfunction +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/core/tick/player_systems.mcfunction @@ -22,4 +22,9 @@ function macroengine:core/internal/api/wand/tick_scan function macroengine:core/internal/systems/hook/tick_scan function macroengine:core/internal/systems/geo/region_watch/tick_scan -function macroengine:core/internal/api/cmd/freeze/tick \ No newline at end of file +function macroengine:core/internal/api/cmd/freeze/tick + +# Experimental features (see systems/flag/experimental) — each is a +# no-op unless its own flag is on, checked internally by the callee. +function macroengine:experimental/particle_trail/tick +function macroengine:experimental/combat_tag/tick \ No newline at end of file diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/debug/tools/trigger/execute.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/debug/tools/trigger/execute.mcfunction index 10e8388..7b437c4 100644 --- a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/debug/tools/trigger/execute.mcfunction +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/debug/tools/trigger/execute.mcfunction @@ -7,6 +7,11 @@ # # config:{silent:1} → suppress debug tellraw. +# Security gate — see core/internal/security/check_all. +# No-op (always passes) unless flags.experimental.strict_gating is on. +scoreboard players set $tte_gate macroengine.tmp 1 +execute store success score $tte_gate macroengine.tmp run function macroengine:core/internal/security/check_all {required:"admin_min_level"} +execute if score $tte_gate macroengine.tmp matches 0 run return 0 data modify storage macroengine:engine tools_trigger.data.uuid set from entity @s UUID diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/combat_tag/tick.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/combat_tag/tick.mcfunction new file mode 100644 index 0000000..6b32205 --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/combat_tag/tick.mcfunction @@ -0,0 +1,33 @@ +# macroengine:experimental/combat_tag/tick +# Runs every tick from core/tick/player_systems.mcfunction (only while +# flags.experimental.combat_tag is on). +# +# Detects "this player just dealt damage" via a stat-delta on +# macroengine.exp_dmg_dealt (same convention as the hook_* stat +# objectives in core/internal/systems/hook/tick_scan.mcfunction), +# tags the player macroengine.experimental.combat_tagged, and starts +# (or refreshes) a 15s (300 tick) countdown. On expiry the tag is +# removed and the player is notified. +# +# NOTE: uses damage_dealt, i.e. only the attacker gets tagged, not +# the victim — a deliberate simplification for a first experimental +# pass (a full implementation would also tag the victim via a +# damage-taken stat and correlate attacker/victim pairs). + +execute unless data storage macroengine:engine flags.experimental{combat_tag:1b} run return 0 + +# New damage dealt this tick -> (re)apply tag + reset timer to 300 +execute as @a[scores={macroengine.exp_dmg_dealt=1..}] run tag @s add macroengine.experimental.combat_tagged +execute as @a[scores={macroengine.exp_dmg_dealt=1..}] run scoreboard players set @s macroengine.exp_combat_timer 300 +execute as @a[scores={macroengine.exp_dmg_dealt=1..},tag=!macroengine.experimental._combat_notified] run tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"⚔ Combat tagged — 15s","color":"red"}] +execute as @a[scores={macroengine.exp_dmg_dealt=1..}] run tag @s add macroengine.experimental._combat_notified +scoreboard players set @a[scores={macroengine.exp_dmg_dealt=1..}] macroengine.exp_dmg_dealt 0 + +# Countdown for currently-tagged players +execute as @a[tag=macroengine.experimental.combat_tagged,scores={macroengine.exp_combat_timer=1..}] run scoreboard players remove @s macroengine.exp_combat_timer 1 + +# Expiry +execute as @a[tag=macroengine.experimental.combat_tagged,scores={macroengine.exp_combat_timer=0}] run tag @s remove macroengine.experimental.combat_tagged +execute as @a[tag=macroengine.experimental.combat_tagged,scores={macroengine.exp_combat_timer=0}] run tag @s remove macroengine.experimental._combat_notified +execute as @a[tag=!macroengine.experimental.combat_tagged,tag=macroengine.experimental._combat_notified,scores={macroengine.exp_combat_timer=0}] run tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"Combat tag expired","color":"gray"}] +execute as @a[tag=!macroengine.experimental.combat_tagged,tag=macroengine.experimental._combat_notified,scores={macroengine.exp_combat_timer=0}] run tag @s remove macroengine.experimental._combat_notified diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/crafting_ui/craft.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/crafting_ui/craft.mcfunction new file mode 100644 index 0000000..76fb62e --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/crafting_ui/craft.mcfunction @@ -0,0 +1,33 @@ +# macroengine:experimental/crafting_ui/craft [MACRO] +# Attempts to craft the given recipe id. Looks up the recipe definition +# from experimental/crafting_ui/recipes.mcfunction (storage-based table), +# checks the caller has every required ingredient in sufficient count, +# clears them, and gives the result. All-or-nothing — nothing is +# consumed if any ingredient is missing. +# +# Usage: function macroengine:experimental/crafting_ui/craft {recipe:"example"} +# Caller: any player + +execute unless data storage macroengine:engine flags.experimental{crafting_ui:1b} run return 0 + +function macroengine:experimental/crafting_ui/recipes + +$execute unless data storage macroengine:engine _crafting_ui.recipes.$(recipe) run tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"unknown recipe: ","color":"red"},{"text":"$(recipe)","color":"aqua"}] +$execute unless data storage macroengine:engine _crafting_ui.recipes.$(recipe) run return 0 + +$data modify storage macroengine:engine _crafting_ui.active set from storage macroengine:engine _crafting_ui.recipes.$(recipe) + +# Check every ingredient is present in sufficient count (all-or-nothing). +data modify storage macroengine:engine _crafting_ui.ok set value 1b +function macroengine:core/internal/experimental/crafting_ui/check_ingredients with storage macroengine:engine _crafting_ui.active + +execute unless data storage macroengine:engine _crafting_ui{ok:1b} run tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"missing ingredients.","color":"red"}] +execute unless data storage macroengine:engine _crafting_ui{ok:1b} run data remove storage macroengine:engine _crafting_ui +execute unless data storage macroengine:engine _crafting_ui{ok:1b} run return 0 + +# All present — consume then give. +function macroengine:core/internal/experimental/crafting_ui/consume_ingredients with storage macroengine:engine _crafting_ui.active +function macroengine:core/internal/experimental/crafting_ui/give_result with storage macroengine:engine _crafting_ui.active.result + +tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"crafted!","color":"green"}] +data remove storage macroengine:engine _crafting_ui diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/crafting_ui/recipes.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/crafting_ui/recipes.mcfunction new file mode 100644 index 0000000..b33aa19 --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/crafting_ui/recipes.mcfunction @@ -0,0 +1,14 @@ +# macroengine:experimental/crafting_ui/recipes [INTERNAL] +# Recipe definitions for experimental/crafting_ui. Each recipe is a +# compound under _crafting_ui.recipes. with: +# ingredients (list of {item, count}) +# result {item, count} +# +# Edit/add recipes here — this is the single source of truth, read by +# experimental/crafting_ui/craft.mcfunction. Example recipe included +# so the shortcut in show.mcfunction has something to actually craft. + +execute unless data storage macroengine:engine _crafting_ui run data modify storage macroengine:engine _crafting_ui set value {} +data modify storage macroengine:engine _crafting_ui.recipes set value {} + +data modify storage macroengine:engine _crafting_ui.recipes.example set value {ingredients:[{item:"minecraft:iron_ingot",count:2},{item:"minecraft:stick",count:1}],result:{item:"minecraft:shears",count:1}} diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/crafting_ui/show.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/crafting_ui/show.mcfunction new file mode 100644 index 0000000..14f2238 --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/crafting_ui/show.mcfunction @@ -0,0 +1,23 @@ +# macroengine:experimental/crafting_ui/show +# Prints a clickable "custom crafting" shortcut menu — each button gives +# the result item if the caller has the listed ingredients, consuming +# them. This is NOT a real crafting-table GUI (data packs can't add +# custom recipe UIs to the survival crafting grid) — it's a chat-menu +# shortcut for datapack-defined recipes that don't fit the vanilla +# 3x3 grid. Gated behind flags.experimental.crafting_ui. +# +# BACKPORT NOTE (1.21.2): same constraint as setup/open_screen.mcfunction — +# no `dialog show` / custom container screen available without a resource +# pack GUI + click-handling entity, out of scope for a first experimental +# pass. Chat-menu clickables instead. +# +# Usage: function macroengine:experimental/crafting_ui/show +# Caller: any player + +execute unless data storage macroengine:engine flags.experimental{crafting_ui:1b} run tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"experimental/crafting_ui is disabled.","color":"red"}] +execute unless data storage macroengine:engine flags.experimental{crafting_ui:1b} run return 0 + +tellraw @s ["",{"text":"═══════ ","color":"dark_gray"},{"text":"macroEngine — Custom Recipes","color":"aqua","bold":true},{"text":" ═══════","color":"dark_gray"}] +tellraw @s ["",{"text":"Recipes not shown in the vanilla grid. Click to attempt a craft (consumes ingredients if you have them).","color":"gray","italic":true}] +tellraw @s ["",{"text":"[Craft] ","color":"green","bold":true,"clickEvent":{"action":"run_command","value":"/function macroengine:experimental/crafting_ui/craft {recipe:\"example\"}"},"hoverEvent":{"action":"show_text","value":"See experimental/crafting_ui/recipes.mcfunction to define real recipes"}},{"text":"example — placeholder recipe","color":"white"}] +tellraw @s ["",{"text":"═════════════════════════════════════","color":"dark_gray"}] diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/hologram/create.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/hologram/create.mcfunction new file mode 100644 index 0000000..f9ac14e --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/hologram/create.mcfunction @@ -0,0 +1,14 @@ +# macroengine:experimental/hologram/create [MACRO] +# Spawns a floating text_display at the caller's position. +# Gated behind flags.experimental.hologram. +# +# Usage: function macroengine:experimental/hologram/create {text:"Hello"} +# Caller: macroengine.admin tag required + +execute unless entity @s[tag=macroengine.admin] run return 0 +execute unless data storage macroengine:engine flags.experimental{hologram:1b} run tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"experimental/hologram is disabled — enable via /function macroengine:api/toggle/experimental/true {flag:\"hologram\"}","color":"red"}] +execute unless data storage macroengine:engine flags.experimental{hologram:1b} run return 0 + +$execute positioned ~ ~1.5 ~ run summon minecraft:text_display ~ ~ ~ {Text:'{"text":"$(text)"}',billboard:"center",see_through:0b,alignment:"center",background:0,line_width:200,shadow:0b,Tags:["macroengine.experimental.hologram"]} + +tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"hologram created","color":"green"}] diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/hologram/remove.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/hologram/remove.mcfunction new file mode 100644 index 0000000..61780a9 --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/hologram/remove.mcfunction @@ -0,0 +1,11 @@ +# macroengine:experimental/hologram/remove +# Kills the nearest hologram entity to the caller (within 10 blocks). +# +# Usage: function macroengine:experimental/hologram/remove +# Caller: macroengine.admin tag required + +execute unless entity @s[tag=macroengine.admin] run return 0 + +execute as @e[tag=macroengine.experimental.hologram,sort=nearest,limit=1,distance=..10] run kill @s + +tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"nearest hologram removed","color":"yellow"}] diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/particle_trail/tick.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/particle_trail/tick.mcfunction new file mode 100644 index 0000000..0a69f3b --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/particle_trail/tick.mcfunction @@ -0,0 +1,14 @@ +# macroengine:experimental/particle_trail/tick +# Runs every tick from core/tick/player_systems.mcfunction (only while +# flags.experimental.particle_trail is on). Spawns a small particle burst +# under each player tagged macroengine.experimental.trail (set via +# experimental/particle_trail/toggle.mcfunction). +# +# Kept as a single unconditional particle command run `as @a[tag=...]` +# rather than a manual entity loop — matches the pack's existing style +# (e.g. core/tick/hud_systems.mcfunction) of letting selectors do the +# fan-out instead of hand-written iteration. + +execute unless data storage macroengine:engine flags.experimental{particle_trail:1b} run return 0 + +execute as @a[tag=macroengine.experimental.trail] at @s run particle minecraft:end_rod ~ ~0.1 ~ 0.1 0 0.1 0.01 2 force diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/particle_trail/toggle.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/particle_trail/toggle.mcfunction new file mode 100644 index 0000000..2654077 --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/particle_trail/toggle.mcfunction @@ -0,0 +1,17 @@ +# macroengine:experimental/particle_trail/toggle +# Toggles a per-player particle trail (spawns particles behind the +# player as they move). Gated behind flags.experimental.particle_trail. +# Tick loop hook lives in experimental/particle_trail/tick.mcfunction. +# +# Usage: function macroengine:experimental/particle_trail/toggle +# Caller: any player (self-toggle, no admin tag needed) + +execute unless data storage macroengine:engine flags.experimental{particle_trail:1b} run tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"experimental/particle_trail is disabled.","color":"red"}] +execute unless data storage macroengine:engine flags.experimental{particle_trail:1b} run return 0 + +execute if entity @s[tag=macroengine.experimental.trail] run tag @s remove macroengine.experimental.trail +execute if entity @s[tag=macroengine.experimental.trail] run return 0 +execute unless entity @s[tag=macroengine.experimental.trail] run tag @s add macroengine.experimental.trail + +execute if entity @s[tag=macroengine.experimental.trail] run tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"particle trail → ","color":"gray"},{"text":"on","color":"green"}] +execute unless entity @s[tag=macroengine.experimental.trail] run tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"particle trail → ","color":"gray"},{"text":"off","color":"red"}] diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/scoreboard_hud/hide.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/scoreboard_hud/hide.mcfunction new file mode 100644 index 0000000..7ed413d --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/scoreboard_hud/hide.mcfunction @@ -0,0 +1,4 @@ +# macroengine:experimental/scoreboard_hud/hide [INTERNAL] +scoreboard objectives setdisplay sidebar +scoreboard players set #exp_hud_on macroengine.tmp 0 +tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"scoreboard HUD → ","color":"gray"},{"text":"off","color":"red"}] diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/scoreboard_hud/show.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/scoreboard_hud/show.mcfunction new file mode 100644 index 0000000..0b65d26 --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/scoreboard_hud/show.mcfunction @@ -0,0 +1,4 @@ +# macroengine:experimental/scoreboard_hud/show [INTERNAL] +scoreboard objectives setdisplay sidebar macroengine.exp_combat_timer +scoreboard players set #exp_hud_on macroengine.tmp 1 +tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"scoreboard HUD → ","color":"gray"},{"text":"on","color":"green"}] diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/scoreboard_hud/toggle.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/scoreboard_hud/toggle.mcfunction new file mode 100644 index 0000000..ef07d9d --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/scoreboard_hud/toggle.mcfunction @@ -0,0 +1,17 @@ +# macroengine:experimental/scoreboard_hud/toggle +# Toggles a global sidebar scoreboard showing macroengine.perm_level and +# macroengine.exp_combat_timer for every online player (a small +# general-purpose status HUD, not tied to one specific feature). +# Gated behind flags.experimental.scoreboard_hud. +# +# Usage: function macroengine:experimental/scoreboard_hud/toggle +# Caller: macroengine.admin tag required (server-wide display, not per-player) + +execute unless entity @s[tag=macroengine.admin] run return 0 +execute unless data storage macroengine:engine flags.experimental{scoreboard_hud:1b} run tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"experimental/scoreboard_hud is disabled.","color":"red"}] +execute unless data storage macroengine:engine flags.experimental{scoreboard_hud:1b} run return 0 + +execute if score #exp_hud_on macroengine.tmp matches 1 run function macroengine:experimental/scoreboard_hud/hide +execute if score #exp_hud_on macroengine.tmp matches 1 run return 0 + +function macroengine:experimental/scoreboard_hud/show diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/waypoint/list.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/waypoint/list.mcfunction new file mode 100644 index 0000000..4e6a41a --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/waypoint/list.mcfunction @@ -0,0 +1,13 @@ +# macroengine:experimental/waypoint/list +# Prints all stored waypoint names. +# +# Usage: function macroengine:experimental/waypoint/list +# Caller: any player + +execute unless data storage macroengine:engine flags.experimental{waypoint:1b} run tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"experimental/waypoint is disabled.","color":"red"}] +execute unless data storage macroengine:engine flags.experimental{waypoint:1b} run return 0 + +tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"━━━ Waypoints ━━━━━━━━━━━━━━━","color":"#555555"}] +execute unless data storage macroengine:engine waypoints run tellraw @s ["",{"text":" (none set)","color":"gray","italic":true}] +tellraw @s ["",{"text":" ","color":"#555555"},{"plain":true,"storage":"macroengine:engine","nbt":"waypoints","interpret":false,"color":"yellow"}] +tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━","color":"#555555"}] diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/waypoint/set.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/waypoint/set.mcfunction new file mode 100644 index 0000000..033032d --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/waypoint/set.mcfunction @@ -0,0 +1,21 @@ +# macroengine:experimental/waypoint/set [MACRO] +# Stores a named waypoint at the caller's current position. +# Gated behind flags.experimental.waypoint. +# +# Usage: function macroengine:experimental/waypoint/set {name:"base"} +# Caller: any player + +execute unless data storage macroengine:engine flags.experimental{waypoint:1b} run tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"experimental/waypoint is disabled.","color":"red"}] +execute unless data storage macroengine:engine flags.experimental{waypoint:1b} run return 0 + +data modify storage macroengine:engine _waypoint_tmp set value {} +execute store result storage macroengine:engine _waypoint_tmp.x int 1 run data get entity @s Pos[0] +execute store result storage macroengine:engine _waypoint_tmp.y int 1 run data get entity @s Pos[1] +execute store result storage macroengine:engine _waypoint_tmp.z int 1 run data get entity @s Pos[2] +data modify storage macroengine:engine _waypoint_tmp.dimension set from entity @s Dimension + +execute unless data storage macroengine:engine waypoints run data modify storage macroengine:engine waypoints set value {} +$data modify storage macroengine:engine waypoints."$(name)" set from storage macroengine:engine _waypoint_tmp +data remove storage macroengine:engine _waypoint_tmp + +$tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"waypoint ","color":"gray"},{"text":"$(name)","color":"aqua"},{"text":" set","color":"green"}] diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/waypoint/tp.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/waypoint/tp.mcfunction new file mode 100644 index 0000000..11029a7 --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/experimental/waypoint/tp.mcfunction @@ -0,0 +1,16 @@ +# macroengine:experimental/waypoint/tp [MACRO] +# Teleports the caller to a stored waypoint (same-dimension only — +# does not cross-dimension teleport, kept out of scope for this +# first experimental pass). +# +# Usage: function macroengine:experimental/waypoint/tp {name:"base"} +# Caller: any player + +execute unless data storage macroengine:engine flags.experimental{waypoint:1b} run tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"experimental/waypoint is disabled.","color":"red"}] +execute unless data storage macroengine:engine flags.experimental{waypoint:1b} run return 0 + +$execute unless data storage macroengine:engine waypoints."$(name)" run tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"no waypoint named ","color":"red"},{"text":"$(name)","color":"aqua"}] +$execute unless data storage macroengine:engine waypoints."$(name)" run return 0 + +$tellraw @s ["",{"text":"[MACROENGINE] ","color":"#00AAAA","bold":true},{"text":"teleporting to ","color":"gray"},{"text":"$(name)","color":"aqua"}] +$function macroengine:core/internal/experimental/waypoint/do_tp with storage macroengine:engine waypoints.$(name) diff --git a/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/systems/flag/experimental/set.mcfunction b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/systems/flag/experimental/set.mcfunction new file mode 100644 index 0000000..63d6aba --- /dev/null +++ b/packs/macroEngine-Datapack-1.21.2/data/macroengine/function/systems/flag/experimental/set.mcfunction @@ -0,0 +1,11 @@ +# macroengine:systems/flag/experimental/set [MACRO] +# Enables or disables one experimental flag. Internal — called by +# api/toggle/experimental/true|false so admin-tag gating happens once, +# at the caller, not duplicated here. +# +# INPUT (macro): +# $(flag) -> one of: strict_gating, hologram, particle_trail, +# crafting_ui, waypoint, combat_tag, scoreboard_hud +# $(value) -> literal "1b" or "0b" (NBT byte literal, passed as string) + +$data modify storage macroengine:engine flags.experimental.$(flag) set value $(value)