From b2f446c3c6e4ac147b1e1ecc1b9ceeee47e68759 Mon Sep 17 00:00:00 2001 From: runtoolkit-bot Date: Tue, 26 May 2026 07:13:24 +0000 Subject: [PATCH] feat: color API + fork_warn improvements (v5.1.2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add datalib:api/color/* — palette, gradient, validate, resolve, from_score, lerp - Add datalib:systems/color/init + internal helpers - Improve fork_warn: persistent flag, 2-tier notifications (debug + admin), upstream links - Update finalize to use fork_warn flag instead of rt_origin_verified check - Add color cleanup to cleanup.mcfunction - Bump version to v5.1.2 --- .../function/api/color/from_score.mcfunction | 37 +++++++++++++++++++ .../api/color/gradient_delete.mcfunction | 13 +++++++ .../api/color/gradient_set.mcfunction | 27 ++++++++++++++ .../function/api/color/lerp.mcfunction | 30 +++++++++++++++ .../api/color/palette_delete.mcfunction | 15 ++++++++ .../function/api/color/palette_get.mcfunction | 18 +++++++++ .../api/color/palette_list.mcfunction | 13 +++++++ .../function/api/color/palette_set.mcfunction | 19 ++++++++++ .../function/api/color/resolve.mcfunction | 30 +++++++++++++++ .../function/api/color/validate.mcfunction | 30 +++++++++++++++ .../function/systems/color/init.mcfunction | 30 +++++++++++++++ .../color/internal/lerp_exec.mcfunction | 4 ++ .../color/internal/resolve_exec.mcfunction | 8 ++++ .../color/internal/validate_exec.mcfunction | 5 +++ .../function/load/internal/cleanup.mcfunction | 8 ++++ .../load/internal/finalize.mcfunction | 7 +++- .../load/internal/fork_warn.mcfunction | 27 ++++++++++++-- .../load/internal/validate.mcfunction | 6 +-- .../load/internal/version_set.mcfunction | 2 +- .../load/internal/version_warn.mcfunction | 4 +- .../dl_load/function/load/storages.mcfunction | 7 ++++ version.json | 4 +- 22 files changed, 331 insertions(+), 13 deletions(-) create mode 100644 data/datalib/function/api/color/from_score.mcfunction create mode 100644 data/datalib/function/api/color/gradient_delete.mcfunction create mode 100644 data/datalib/function/api/color/gradient_set.mcfunction create mode 100644 data/datalib/function/api/color/lerp.mcfunction create mode 100644 data/datalib/function/api/color/palette_delete.mcfunction create mode 100644 data/datalib/function/api/color/palette_get.mcfunction create mode 100644 data/datalib/function/api/color/palette_list.mcfunction create mode 100644 data/datalib/function/api/color/palette_set.mcfunction create mode 100644 data/datalib/function/api/color/resolve.mcfunction create mode 100644 data/datalib/function/api/color/validate.mcfunction create mode 100644 data/datalib/function/systems/color/init.mcfunction create mode 100644 data/datalib/function/systems/color/internal/lerp_exec.mcfunction create mode 100644 data/datalib/function/systems/color/internal/resolve_exec.mcfunction create mode 100644 data/datalib/function/systems/color/internal/validate_exec.mcfunction diff --git a/data/datalib/function/api/color/from_score.mcfunction b/data/datalib/function/api/color/from_score.mcfunction new file mode 100644 index 0000000..3cf183c --- /dev/null +++ b/data/datalib/function/api/color/from_score.mcfunction @@ -0,0 +1,37 @@ +# datalib:api/color/from_score [MACRO] +# Maps an integer score range to a color using a threshold table. +# Useful for health bars, progress displays, danger indicators. +# +# Threshold logic (low → high): +# score < low_threshold → low_color +# score < mid_threshold → mid_color +# score >= mid_threshold → high_color +# +# Input (macro args): +# objective — scoreboard objective name +# player — fake player or selector name (@s not supported; use real name) +# low_threshold — score below this → low_color +# mid_threshold — score below this → mid_color (if >= low_threshold) +# low_color — color for low range (e.g. "red") +# mid_color — color for mid range (e.g. "yellow") +# high_color — color for high range (e.g. "green") +# +# Output → datalib:output result +# The matching color string. +# +# Usage: +# function datalib:api/color/from_score {objective:"health",player:"Steve",\ +# low_threshold:7,mid_threshold:14,\ +# low_color:"red",mid_color:"yellow",high_color:"green"} +# data get storage datalib:output result + +execute unless function datalib:core/security/cmd_gate run return 0 + +# Default: high_color +$data modify storage datalib:output result set value "$(high_color)" + +# Override with low or mid if score is below threshold +$execute if score #$(player) $(objective) matches ..$(low_threshold) run data modify storage datalib:output result set value "$(low_color)" +$execute if score #$(player) $(objective) matches $(low_threshold)..$(mid_threshold) run data modify storage datalib:output result set value "$(mid_color)" + +$tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"color/from_score ","color":"aqua"},{"text":"$(player) ","color":"white"},{"text":"→ ","color":"#555555"},{"storage":"datalib:output","nbt":"result","color":"green"}] diff --git a/data/datalib/function/api/color/gradient_delete.mcfunction b/data/datalib/function/api/color/gradient_delete.mcfunction new file mode 100644 index 0000000..6527a3d --- /dev/null +++ b/data/datalib/function/api/color/gradient_delete.mcfunction @@ -0,0 +1,13 @@ +# datalib:api/color/gradient_delete [MACRO] +# Removes a named gradient from storage. +# +# Input (macro args): +# name — gradient name to remove +# +# Usage: +# function datalib:api/color/gradient_delete {name:"health"} + +execute unless function datalib:core/security/cmd_gate run return 0 + +$data remove storage datalib:engine color.gradients.$(name) +$tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"color/gradient_delete ","color":"aqua"},{"text":"$(name)","color":"white"}] diff --git a/data/datalib/function/api/color/gradient_set.mcfunction b/data/datalib/function/api/color/gradient_set.mcfunction new file mode 100644 index 0000000..9500703 --- /dev/null +++ b/data/datalib/function/api/color/gradient_set.mcfunction @@ -0,0 +1,27 @@ +# datalib:api/color/gradient_set [MACRO] +# Registers a named gradient as an ordered list of color strings. +# Steps are accessed by index via datalib:api/color/lerp. +# +# Input (macro args): +# name — gradient name (e.g. "health", "sunset", "xp") +# colors — SNBT list of color strings, e.g. ["red","yellow","green"] +# or hex: ["#FF0000","#FFAA00","#00FF00"] +# Length is arbitrary; step 0 = first entry. +# +# Output → none +# +# Usage: +# function datalib:api/color/gradient_set {name:"health",\ +# colors:["red","yellow","green"]} +# +# function datalib:api/color/gradient_set {name:"xp",\ +# colors:["dark_green","green","#AAFF00","yellow"]} +# +# Note: SNBT list syntax requires quotes around string entries. +# This is a load-time operation — call from a load tag or init function. + +execute unless function datalib:core/security/cmd_gate run return 0 + +execute unless data storage datalib:engine color.gradients run data modify storage datalib:engine color.gradients set value {} +$data modify storage datalib:engine color.gradients.$(name) set value $(colors) +$tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"color/gradient_set ","color":"aqua"},{"text":"$(name)","color":"white"}] diff --git a/data/datalib/function/api/color/lerp.mcfunction b/data/datalib/function/api/color/lerp.mcfunction new file mode 100644 index 0000000..1ed8651 --- /dev/null +++ b/data/datalib/function/api/color/lerp.mcfunction @@ -0,0 +1,30 @@ +# datalib:api/color/lerp [MACRO] +# Looks up a precomputed lerp step from a named gradient table. +# Gradients are registered via datalib:api/color/gradient_set. +# +# This is NOT a real-time RGB interpolator — mcfunction cannot do +# per-channel arithmetic at runtime. Instead, callers pre-register +# a gradient as an ordered list of hex strings and this function +# returns the entry at the given step index. +# +# Input (macro args): +# gradient — gradient name registered via gradient_set +# step — integer index into the gradient list (0-based) +# +# Output → datalib:output result +# The color string at that step, or "" if out of range. +# +# Usage: +# # Register once (e.g. at load): +# function datalib:api/color/gradient_set {name:"sunset",\ +# colors:["#FF0000","#FF5500","#FFAA00","#FFD700","#FFFF00"]} +# +# # Retrieve at runtime: +# function datalib:api/color/lerp {gradient:"sunset",step:2} +# # → datalib:output result = "#FFAA00" + +execute unless function datalib:core/security/cmd_gate run return 0 + +data modify storage datalib:output result set value "" +$execute if data storage datalib:engine color.gradients.$(gradient) run function datalib:systems/color/internal/lerp_exec with storage datalib:input {} +$tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"color/lerp ","color":"aqua"},{"text":"$(gradient)[$(step)]","color":"white"},{"text":" → ","color":"#555555"},{"storage":"datalib:output","nbt":"result","color":"green"}] diff --git a/data/datalib/function/api/color/palette_delete.mcfunction b/data/datalib/function/api/color/palette_delete.mcfunction new file mode 100644 index 0000000..055c5f2 --- /dev/null +++ b/data/datalib/function/api/color/palette_delete.mcfunction @@ -0,0 +1,15 @@ +# datalib:api/color/palette_delete [MACRO] +# Removes a color alias from the runtime palette. +# +# Input (macro args): +# key — alias name to remove +# +# Output → none +# +# Usage: +# function datalib:api/color/palette_delete {key:"brand"} + +execute unless function datalib:core/security/cmd_gate run return 0 + +$data remove storage datalib:engine color.palette.$(key) +$tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"color/palette_delete ","color":"aqua"},{"text":"$(key)","color":"white"}] diff --git a/data/datalib/function/api/color/palette_get.mcfunction b/data/datalib/function/api/color/palette_get.mcfunction new file mode 100644 index 0000000..f06bb8d --- /dev/null +++ b/data/datalib/function/api/color/palette_get.mcfunction @@ -0,0 +1,18 @@ +# datalib:api/color/palette_get [MACRO] +# Reads a color alias from the runtime palette. +# +# Input (macro args): +# key — alias name (e.g. "brand") +# +# Output → datalib:output result +# The stored color value, or absent if key not found. +# +# Usage: +# function datalib:api/color/palette_get {key:"brand"} +# data get storage datalib:output result + +execute unless function datalib:core/security/cmd_gate run return 0 + +data modify storage datalib:output result set value "" +$execute if data storage datalib:engine color.palette.$(key) run data modify storage datalib:output result set from storage datalib:engine color.palette.$(key) +$tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"color/palette_get ","color":"aqua"},{"text":"$(key)","color":"white"},{"text":" → ","color":"#555555"},{"storage":"datalib:output","nbt":"result","color":"green"}] diff --git a/data/datalib/function/api/color/palette_list.mcfunction b/data/datalib/function/api/color/palette_list.mcfunction new file mode 100644 index 0000000..1f813c6 --- /dev/null +++ b/data/datalib/function/api/color/palette_list.mcfunction @@ -0,0 +1,13 @@ +# datalib:api/color/palette_list +# Prints all registered palette entries to the calling player. +# Requires datalib.admin tag. +# +# Usage: +# function datalib:api/color/palette_list + +execute unless entity @s[tag=datalib.admin] run return 0 + +tellraw @s ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"━━━ Color Palette ","color":"aqua"},{"text":"━━━━━━━━━━━","color":"#555555"}] +execute if data storage datalib:engine color.palette run tellraw @s ["",{"text":" ","color":"#555555"},{"storage":"datalib:engine","nbt":"color.palette","interpret":false,"color":"green"}] +execute unless data storage datalib:engine color.palette run tellraw @s ["",{"text":" ","color":"#555555"},{"text":"(palette is empty)","color":"gray","italic":true}] +tellraw @s ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━","color":"#555555"}] diff --git a/data/datalib/function/api/color/palette_set.mcfunction b/data/datalib/function/api/color/palette_set.mcfunction new file mode 100644 index 0000000..713a774 --- /dev/null +++ b/data/datalib/function/api/color/palette_set.mcfunction @@ -0,0 +1,19 @@ +# datalib:api/color/palette_set [MACRO] +# Registers a named color alias in the runtime palette. +# Existing key is overwritten. +# +# Input (macro args): +# key — alias name (e.g. "brand", "danger", "success") +# value — color value (named or hex, e.g. "#00AAAA", "red") +# +# Output → none +# +# Usage: +# function datalib:api/color/palette_set {key:"brand",value:"#00AAAA"} +# function datalib:api/color/palette_set {key:"danger",value:"red"} + +execute unless function datalib:core/security/cmd_gate run return 0 + +execute unless data storage datalib:engine color.palette run data modify storage datalib:engine color.palette set value {} +$data modify storage datalib:engine color.palette.$(key) set value "$(value)" +$tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"color/palette_set ","color":"aqua"},{"text":"$(key)","color":"white"},{"text":" → ","color":"#555555"},{"text":"$(value)","color":"green"}] diff --git a/data/datalib/function/api/color/resolve.mcfunction b/data/datalib/function/api/color/resolve.mcfunction new file mode 100644 index 0000000..5298c08 --- /dev/null +++ b/data/datalib/function/api/color/resolve.mcfunction @@ -0,0 +1,30 @@ +# datalib:api/color/resolve [MACRO] +# Looks up a named palette entry or returns the value as-is if not found. +# Use this to map short alias keys (e.g. "brand", "danger", "info") to hex. +# +# The palette is stored in datalib:engine color.palette as a compound: +# {brand:"#00AAAA", danger:"red", info:"aqua", ...} +# Populate via datalib:api/color/palette_set. +# +# Input (macro args): +# color — alias key or direct color value +# +# Output → datalib:output result +# The resolved color string (palette value if key found; input value otherwise). +# +# Usage: +# function datalib:api/color/resolve {color:"brand"} +# # → datalib:output result = "#00AAAA" (if palette has brand→#00AAAA) +# +# function datalib:api/color/resolve {color:"red"} +# # → datalib:output result = "red" (not in palette, returned as-is) + +execute unless function datalib:core/security/cmd_gate run return 0 + +# Default: return input value +$data modify storage datalib:output result set value "$(color)" + +# Override if palette has this key +$execute if data storage datalib:engine color.palette run function datalib:systems/color/internal/resolve_exec with storage datalib:engine color {} + +$tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"color/resolve ","color":"aqua"},{"text":"$(color)","color":"white"},{"text":" → ","color":"#555555"},{"storage":"datalib:output","nbt":"result","color":"green"}] diff --git a/data/datalib/function/api/color/validate.mcfunction b/data/datalib/function/api/color/validate.mcfunction new file mode 100644 index 0000000..072718c --- /dev/null +++ b/data/datalib/function/api/color/validate.mcfunction @@ -0,0 +1,30 @@ +# datalib:api/color/validate [MACRO] +# Checks whether a color string is a known named color or a valid hex code. +# +# Named colors accepted: +# black, dark_blue, dark_green, dark_aqua, dark_red, dark_purple, +# gold, gray, dark_gray, blue, green, aqua, red, light_purple, +# yellow, white +# +# Hex accepted: #RRGGBB format (stored as-is; format is not verified at +# mcfunction level — caller must supply a valid string). +# +# Input (macro args): +# color — color string to validate (e.g. "red", "#FF5500") +# +# Output → datalib:output result +# 1b = valid named color or hex-like string starting with # +# 0b = invalid / unrecognised +# +# Usage: +# function datalib:api/color/validate {color:"red"} +# data get storage datalib:output result +# +# Note: hex validation only checks that the value starts with "#". +# Full format validation (#RRGGBB) is not possible in mcfunction alone. + +execute unless function datalib:core/security/cmd_gate run return 0 + +data modify storage datalib:output result set value 0b +function datalib:systems/color/internal/validate_exec with storage datalib:input {} +$tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"color/validate ","color":"aqua"},{"text":"$(color)","color":"white"},{"text":" → ","color":"#555555"},{"storage":"datalib:output","nbt":"result","color":"green"}] diff --git a/data/datalib/function/systems/color/init.mcfunction b/data/datalib/function/systems/color/init.mcfunction new file mode 100644 index 0000000..1ce9431 --- /dev/null +++ b/data/datalib/function/systems/color/init.mcfunction @@ -0,0 +1,30 @@ +# datalib:systems/color/init +# Called during engine load. Populates the named color lookup table +# at datalib:engine color._names for O(1) validate checks. +# Also initializes the color namespace in storage. + +execute unless data storage datalib:engine color run data modify storage datalib:engine color set value {} +execute unless data storage datalib:engine color.palette run data modify storage datalib:engine color.palette set value {} +execute unless data storage datalib:engine color.gradients run data modify storage datalib:engine color.gradients set value {} + +# Named color allowlist — 16 Minecraft text colors +data modify storage datalib:engine color._names set value {\ + black:1b,\ + dark_blue:1b,\ + dark_green:1b,\ + dark_aqua:1b,\ + dark_red:1b,\ + dark_purple:1b,\ + gold:1b,\ + gray:1b,\ + dark_gray:1b,\ + blue:1b,\ + green:1b,\ + aqua:1b,\ + red:1b,\ + light_purple:1b,\ + yellow:1b,\ + white:1b\ +} + +tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"color/init ","color":"aqua"},{"text":"named color table loaded (16 entries)","color":"gray"}] diff --git a/data/datalib/function/systems/color/internal/lerp_exec.mcfunction b/data/datalib/function/systems/color/internal/lerp_exec.mcfunction new file mode 100644 index 0000000..25abf37 --- /dev/null +++ b/data/datalib/function/systems/color/internal/lerp_exec.mcfunction @@ -0,0 +1,4 @@ +# datalib:systems/color/internal/lerp_exec [MACRO] +# Internal — called by api/color/lerp. +# Reads datalib:engine color.gradients.$(gradient)[$(step)] into output. +$data modify storage datalib:output result set from storage datalib:engine color.gradients.$(gradient)[$(step)] diff --git a/data/datalib/function/systems/color/internal/resolve_exec.mcfunction b/data/datalib/function/systems/color/internal/resolve_exec.mcfunction new file mode 100644 index 0000000..31d0620 --- /dev/null +++ b/data/datalib/function/systems/color/internal/resolve_exec.mcfunction @@ -0,0 +1,8 @@ +# datalib:systems/color/internal/resolve_exec [MACRO] +# Called with storage datalib:engine color {} — reads palette.$(color). +# If the key exists in palette, copies it to datalib:output result. +# Uses the outer $(color) macro arg captured by api/color/resolve. +# NOTE: This file is called with `with storage datalib:engine color {}` +# so macro args come from the color compound (which contains "palette"). +# The $(color) arg is forwarded from the parent macro frame. +$execute if data storage datalib:engine color.palette.$(color) run data modify storage datalib:output result set from storage datalib:engine color.palette.$(color) diff --git a/data/datalib/function/systems/color/internal/validate_exec.mcfunction b/data/datalib/function/systems/color/internal/validate_exec.mcfunction new file mode 100644 index 0000000..65ff5d1 --- /dev/null +++ b/data/datalib/function/systems/color/internal/validate_exec.mcfunction @@ -0,0 +1,5 @@ +# datalib:systems/color/internal/validate_exec [MACRO] +# Internal — called by api/color/validate. +# Sets datalib:output result to 1b if $(color) is a known named color, +# or if it begins with "#" (hex shorthand detection). +$execute if data storage datalib:engine color._names{$(color):1b} run data modify storage datalib:output result set value 1b diff --git a/data/dl_load/function/load/internal/cleanup.mcfunction b/data/dl_load/function/load/internal/cleanup.mcfunction index 2c7f715..3bd55ad 100644 --- a/data/dl_load/function/load/internal/cleanup.mcfunction +++ b/data/dl_load/function/load/internal/cleanup.mcfunction @@ -127,3 +127,11 @@ data remove storage datalib:engine _uuid_cache # pid init temp cleanup data remove storage datalib:engine _pid_init_tmp + +# Color API cleanup +# palette and gradients are intentionally preserved (pack-owned data). +# _names is rebuilt each load by systems/color/init. +# fork_warn flags are transient — cleared on clean unload. +data remove storage datalib:engine color._names +data remove storage datalib:engine fork_warn +data remove storage datalib:engine fork_warn_tick diff --git a/data/dl_load/function/load/internal/finalize.mcfunction b/data/dl_load/function/load/internal/finalize.mcfunction index b924c2a..fb58edc 100644 --- a/data/dl_load/function/load/internal/finalize.mcfunction +++ b/data/dl_load/function/load/internal/finalize.mcfunction @@ -5,8 +5,11 @@ execute if score #dl.pre dl.pre_version matches 1.. run tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"ready · ","color":"#555555"},{"score":{"name":"#dl.major","objective":"dl.pre_version"},"color":"aqua"},{"text":".","color":"#555555"},{"score":{"name":"#dl.minor","objective":"dl.pre_version"},"color":"aqua"},{"text":".","color":"#555555"},{"score":{"name":"#dl.patch","objective":"dl.pre_version"},"color":"aqua"},{"text":"-pre","color":"#ff8800"},{"score":{"name":"#dl.pre","objective":"dl.pre_version"},"color":"#ff8800"}] execute if score #dl.pre dl.pre_version matches ..0 run tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"ready · ","color":"#555555"},{"score":{"name":"#dl.major","objective":"dl.pre_version"},"color":"aqua"},{"text":".","color":"#555555"},{"score":{"name":"#dl.minor","objective":"dl.pre_version"},"color":"aqua"},{"text":".","color":"#555555"},{"score":{"name":"#dl.patch","objective":"dl.pre_version"},"color":"aqua"}] -# Fork uyarısı (debug'a) -execute unless data storage datalib:engine global{rt_origin_verified:1b} run tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"⚠ ","color":"yellow"},{"text":"Modified fork detected — _rt_origin not verified.","color":"yellow"}] +# Fork uyarısı — debug tier (summary) +execute if data storage datalib:engine {fork_warn:1b} run tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"⚠ ","color":"yellow"},{"text":"Modified fork — _rt_origin not verified. ","color":"yellow"},{"text":"[details above]","color":"#555555","italic":true}] + +# Fork uyarısı — admin tier (compact reminder) +execute if data storage datalib:engine {fork_warn:1b} run tellraw @a[tag=datalib.admin] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"⚠ ","color":"yellow"},{"text":"Loaded with fork warning active.","color":"yellow"}] # Başarı mesajı — tüm oyunculara execute if score #dl.pre dl.pre_version matches 1.. run tellraw @a ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"✔ ","color":"green"},{"text":"v","color":"aqua"},{"score":{"name":"#dl.major","objective":"dl.pre_version"},"color":"aqua","bold":true},{"text":".","color":"aqua"},{"score":{"name":"#dl.minor","objective":"dl.pre_version"},"color":"aqua","bold":true},{"text":".","color":"aqua"},{"score":{"name":"#dl.patch","objective":"dl.pre_version"},"color":"aqua","bold":true},{"text":"-pre","color":"#ff8800"},{"score":{"name":"#dl.pre","objective":"dl.pre_version"},"color":"#ff8800","bold":true},{"text":" loaded.","color":"green"}] diff --git a/data/dl_load/function/load/internal/fork_warn.mcfunction b/data/dl_load/function/load/internal/fork_warn.mcfunction index f558119..f5eff69 100644 --- a/data/dl_load/function/load/internal/fork_warn.mcfunction +++ b/data/dl_load/function/load/internal/fork_warn.mcfunction @@ -1,13 +1,34 @@ # dl_load:load/internal/fork_warn # Called when rt_origin_verified is absent at load time. # Indicates _rt_origin.mcfunction was removed or pack is a modified fork. -# Load continues — this is a warning, not a hard block. +# Load continues — this is a WARNING, not a hard block. +# +# Notification tiers: +# 1. datalib.debug tag → full technical detail +# 2. @a[tag=datalib.admin] → admin-level alert with action guidance +# 3. datalib:engine fork_warn → persistent flag for runtime checks +# ── Persistent flag ────────────────────────────────────────────── +data modify storage datalib:engine fork_warn set value 1b +data modify storage datalib:engine fork_warn_tick set value 0 + +# ── Sound ──────────────────────────────────────────────────────── playsound datalib:ui.warn master @a ~ ~ ~ 0.5 0.9 -tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"⚠ ","color":"yellow"},{"text":"Modified fork detected.","color":"yellow"}] -tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"⚠ FORK ","color":"yellow","bold":true},{"text":"rt_origin_verified missing — _rt_origin.mcfunction removed or pack is modified.","color":"yellow"}] +# ── Debug tier — full technical context ────────────────────────── +tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"⚠ FORK ","color":"yellow","bold":true},{"text":"rt_origin_verified missing","color":"yellow"}] +tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":" cause ","color":"#555555"},{"text":"_rt_origin.mcfunction removed or overwritten","color":"#FFAA00"}] +tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":" action ","color":"#555555"},{"text":"Verify pack integrity. Compare against upstream.","color":"gray"}] +tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":" flag ","color":"#555555"},{"text":"datalib:engine fork_warn = 1b","color":"gray","italic":true}] + +# ── Admin tier — actionable alert with links ────────────────────── +tellraw @a[tag=datalib.admin] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"⚠ Fork Warning","color":"yellow","bold":true}] +tellraw @a[tag=datalib.admin] ["",{"text":" ","color":"#555555"},{"text":"This dataLib copy could not verify its origin.","color":"#FFCC00"}] +tellraw @a[tag=datalib.admin] ["",{"text":" ","color":"#555555"},{"text":"_rt_origin.mcfunction is missing or was altered.","color":"#FFCC00"}] +tellraw @a[tag=datalib.admin] ["",{"text":" ","color":"#555555"},{"text":"Load continues","color":"gray"},{"text":" — check pack integrity before trusting this build.","color":"#555555"}] +tellraw @a[tag=datalib.admin] ["",{"text":" ","color":"#555555"},{"text":"[view upstream]","color":"aqua","underlined":true,"click_event":{"action":"open_url","url":"https://github.com/runtoolkit/dataLib"}},{"text":" ","color":"#555555"},{"text":"[releases]","color":"gold","underlined":true,"click_event":{"action":"open_url","url":"https://github.com/runtoolkit/dataLib/releases"}},{"text":" ","color":"#555555"},{"text":"[issues]","color":"yellow","underlined":true,"click_event":{"action":"open_url","url":"https://github.com/runtoolkit/dataLib/issues"}}] +# ── Log system entry ────────────────────────────────────────────── data modify storage datalib:input message set value "[Load] fork_warn — rt_origin_verified not set, possible modified fork" function datalib:systems/log/warn with storage datalib:input {} data remove storage datalib:input message diff --git a/data/dl_load/function/load/internal/validate.mcfunction b/data/dl_load/function/load/internal/validate.mcfunction index a078ae7..f176755 100644 --- a/data/dl_load/function/load/internal/validate.mcfunction +++ b/data/dl_load/function/load/internal/validate.mcfunction @@ -3,8 +3,8 @@ # Returns 0 → validation failed, load aborted. # ── Init storage if fresh ──────────────────────────────────────── -execute unless data storage datalib:engine global run data modify storage datalib:engine global set value {version:"v5.1.1"} -data modify storage datalib:engine global.version set value "v5.1.1" +execute unless data storage datalib:engine global run data modify storage datalib:engine global set value {version:"v5.1.2"} +data modify storage datalib:engine global.version set value "v5.1.2" execute unless data storage datalib:engine log_display run data modify storage datalib:engine log_display set value [] execute unless score #dl.log_count dl.tmp matches 0.. run scoreboard players set #dl.log_count dl.tmp 0 @@ -18,7 +18,7 @@ scoreboard objectives add dl.pre_version dummy scoreboard players set #dl.mismatch dl.pre_version 0 execute if score #dl.ver_set dl.pre_version matches 1 run execute unless score #dl.major dl.pre_version matches 5 run scoreboard players set #dl.mismatch dl.pre_version 1 execute if score #dl.ver_set dl.pre_version matches 1 run execute unless score #dl.minor dl.pre_version matches 1 run scoreboard players set #dl.mismatch dl.pre_version 1 -execute if score #dl.ver_set dl.pre_version matches 1 run execute unless score #dl.patch dl.pre_version matches 1 run scoreboard players set #dl.mismatch dl.pre_version 1 +execute if score #dl.ver_set dl.pre_version matches 1 run execute unless score #dl.patch dl.pre_version matches 2 run scoreboard players set #dl.mismatch dl.pre_version 1 execute if score #dl.ver_set dl.pre_version matches 1 run execute if score #dl.pre dl.pre_version matches 1.. run scoreboard players set #dl.mismatch dl.pre_version 1 execute if score #dl.mismatch dl.pre_version matches 1 run function dl_load:load/internal/version_warn execute if score #dl.mismatch dl.pre_version matches 1 run return 0 diff --git a/data/dl_load/function/load/internal/version_set.mcfunction b/data/dl_load/function/load/internal/version_set.mcfunction index 9a99807..80f52b2 100644 --- a/data/dl_load/function/load/internal/version_set.mcfunction +++ b/data/dl_load/function/load/internal/version_set.mcfunction @@ -1,5 +1,5 @@ scoreboard players set #dl.major dl.pre_version 5 scoreboard players set #dl.minor dl.pre_version 1 -scoreboard players set #dl.patch dl.pre_version 1 +scoreboard players set #dl.patch dl.pre_version 2 scoreboard players set #dl.pre dl.pre_version 0 scoreboard players set #dl.ver_set dl.pre_version 1 diff --git a/data/dl_load/function/load/internal/version_warn.mcfunction b/data/dl_load/function/load/internal/version_warn.mcfunction index 85a8c6b..9c7aa94 100644 --- a/data/dl_load/function/load/internal/version_warn.mcfunction +++ b/data/dl_load/function/load/internal/version_warn.mcfunction @@ -4,8 +4,8 @@ playsound datalib:ui.error master @a ~ ~ ~ 0.7 0.8 -tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"✘ ","color":"red"},{"text":"Version mismatch — expected ","color":"red"},{"text":"v5.1.1","color":"aqua"},{"text":". Load aborted.","color":"red"}] -tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"DEBUG ","color":"aqua"},{"text":"expected: 5.1.1 · got: ","color":"#555555"},{"score":{"name":"#dl.major","objective":"dl.pre_version"},"color":"yellow"},{"text":".","color":"#555555"},{"score":{"name":"#dl.minor","objective":"dl.pre_version"},"color":"yellow"},{"text":".","color":"#555555"},{"score":{"name":"#dl.patch","objective":"dl.pre_version"},"color":"yellow"}] +tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"✘ ","color":"red"},{"text":"Version mismatch — expected ","color":"red"},{"text":"v5.1.2","color":"aqua"},{"text":". Load aborted.","color":"red"}] +tellraw @a[tag=datalib.debug] ["",{"text":"[DL] ","color":"#00AAAA","bold":true},{"text":"DEBUG ","color":"aqua"},{"text":"expected: 5.1.2 · got: ","color":"#555555"},{"score":{"name":"#dl.major","objective":"dl.pre_version"},"color":"yellow"},{"text":".","color":"#555555"},{"score":{"name":"#dl.minor","objective":"dl.pre_version"},"color":"yellow"},{"text":".","color":"#555555"},{"score":{"name":"#dl.patch","objective":"dl.pre_version"},"color":"yellow"}] data modify storage datalib:input message set value "[Load] version_warn — version mismatch, load aborted" function datalib:systems/log/error with storage datalib:input {} diff --git a/data/dl_load/function/load/storages.mcfunction b/data/dl_load/function/load/storages.mcfunction index a8b80c2..93f3d79 100644 --- a/data/dl_load/function/load/storages.mcfunction +++ b/data/dl_load/function/load/storages.mcfunction @@ -140,3 +140,10 @@ data remove storage datalib:engine _cb_last data remove storage datalib:engine _cb_work data remove storage datalib:engine _cb_entry execute unless data storage datalib:engine modules.cb run data modify storage datalib:engine modules.cb set value 1b + +# ───────────────────────────────────────────────────────────────── +# Color API init +# Populates named color lookup table and initializes color namespace. +# palette and gradients are preserved across reloads (unless data guards). +# ───────────────────────────────────────────────────────────────── +function datalib:systems/color/init diff --git a/version.json b/version.json index e414b29..9c13de5 100644 --- a/version.json +++ b/version.json @@ -1,9 +1,9 @@ { - "release": "v5.1.1", + "release": "v5.1.2", "semver": { "major": 5, "minor": 1, - "patch": 1, + "patch": 2, "pre": 0 }, "targets": [