From 9c5081e37da5b3ac42a05ee450688aa55db4b42c Mon Sep 17 00:00:00 2001 From: Legends11 <235496468+tickwarden@users.noreply.github.com> Date: Wed, 1 Jul 2026 16:32:19 +0000 Subject: [PATCH 1/3] v1.0.3 --- .devcontainer/setup.sh | 4 +- README.md | 37 +- RTWrapper-manager.patch | 708 ------------------ .../core/function/selector/detect.mcfunction | 14 +- .../function/api/testmode/off.mcfunction | 2 + .../function/api/testmode/on.mcfunction | 3 + .../rtwrapper/function/core/load.mcfunction | 5 + .../rtwrapper/function/core/tick.mcfunction | 4 + .../function/trigger/handle.mcfunction | 70 ++ .../function/trigger/run_request.mcfunction | 8 + .../rtwrapper/function/ui/batch.mcfunction | 2 + .../function/ui/list_commands.mcfunction | 8 + .../rtwrapper/function/ui/open.mcfunction | 10 + .../function/ui/open/render.mcfunction | 2 + .../function/ui/preset/batch.mcfunction | 3 + .../function/ui/preset/give.mcfunction | 3 + .../function/ui/preset/tp.mcfunction | 3 + .../rtwrapper/function/ui/selector.mcfunction | 2 + .../ui/selector/check_all_limited.mcfunction | 3 + .../selector/check_entity_player.mcfunction | 3 + .../ui/selector/check_player_name.mcfunction | 3 + .../ui/selector/check_self.mcfunction | 3 + .../function/ui/selector/render.mcfunction | 2 + .../rtwrapper/function/ui/settings.mcfunction | 2 + .../function/ui/settings/safe.mcfunction | 3 + .../advancement/packs/rtwrapper.json | 2 +- .../data/runtoolkit/function/dpman.mcfunction | 12 +- .../dpman/disable_rtwrapper.mcfunction | 2 + .../dpman/enable_rtwrapper.mcfunction | 2 + .../dpman/reload_rtwrapper.mcfunction | 2 + .../rtwrapper/check_dependencies.mcfunction | 16 +- .../packs/rtwrapper/disable.mcfunction | 14 +- .../packs/rtwrapper/enable.mcfunction | 9 +- .../function/packs/rtwrapper/list.mcfunction | 10 +- .../function/packs/rtwrapper/load.mcfunction | 18 +- .../packs/rtwrapper/register.mcfunction | 10 +- .../packs/rtwrapper/reload.mcfunction | 5 +- .../function/packs/rtwrapper/tick.mcfunction | 4 +- docs/API.md | 38 +- gradle.properties | 2 +- gradlew | 0 scripts/validate_datapack.py | 82 +- src/gametest/resources/fabric.mod.json | 2 +- 43 files changed, 376 insertions(+), 761 deletions(-) delete mode 100644 RTWrapper-manager.patch create mode 100644 datapack/RTWrapper-Datapack/data/rtwrapper/function/api/testmode/off.mcfunction create mode 100644 datapack/RTWrapper-Datapack/data/rtwrapper/function/api/testmode/on.mcfunction create mode 100644 datapack/RTWrapper-Datapack/data/rtwrapper/function/trigger/handle.mcfunction create mode 100644 datapack/RTWrapper-Datapack/data/rtwrapper/function/trigger/run_request.mcfunction create mode 100644 datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/batch.mcfunction create mode 100644 datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/list_commands.mcfunction create mode 100644 datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/open.mcfunction create mode 100644 datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/open/render.mcfunction create mode 100644 datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/preset/batch.mcfunction create mode 100644 datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/preset/give.mcfunction create mode 100644 datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/preset/tp.mcfunction create mode 100644 datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector.mcfunction create mode 100644 datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector/check_all_limited.mcfunction create mode 100644 datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector/check_entity_player.mcfunction create mode 100644 datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector/check_player_name.mcfunction create mode 100644 datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector/check_self.mcfunction create mode 100644 datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector/render.mcfunction create mode 100644 datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/settings.mcfunction create mode 100644 datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/settings/safe.mcfunction create mode 100644 datapack/RTWrapper-Datapack/data/runtoolkit/function/dpman/disable_rtwrapper.mcfunction create mode 100644 datapack/RTWrapper-Datapack/data/runtoolkit/function/dpman/enable_rtwrapper.mcfunction create mode 100644 datapack/RTWrapper-Datapack/data/runtoolkit/function/dpman/reload_rtwrapper.mcfunction mode change 100755 => 100644 gradlew diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh index 8fde66d..23954e6 100644 --- a/.devcontainer/setup.sh +++ b/.devcontainer/setup.sh @@ -1,7 +1,7 @@ echo "Starting..." cd /workspaces/RTWrapper sudo apt update -sdk install java 21.0.2-tem -sdk use java 21.0.2-tem +sdk install java 21.0.3-tem +sdk use java 21.0.3-tem chmod +x gradlew ./gradlew vscode \ No newline at end of file diff --git a/README.md b/README.md index 8f4c01b..4cc4077 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,17 @@ function runtoolkit:api/dump_registry function runtoolkit:dpman ``` +Manager state is stored under `storage runtoolkit:state packs.rtwrapper` and refreshed into `storage runtoolkit:runtime list.rtwrapper` by the list hook. The pack hooks are stateful: + +- `register` writes registry + state metadata. +- `check_dependencies` probes StringLib and records missing dependencies. +- `load` runs `rtwrapper:core/load`, updates loaded/status fields, and keeps dependency warnings separate. +- `enable` sets manager enabled state and runs load. +- `disable` clears manager loaded state, disables RTWrapper autotick, and clears the runtime queue. +- `reload` re-registers and reloads state. +- `tick` increments tick counters and runs `rtwrapper:core/tick` only when enabled + loaded. +- `list` refreshes `runtoolkit:runtime list.rtwrapper` before printing. + Manager enable/disable/reload controls Runtoolkit hooks, not vanilla `/datapack enable|disable`: ```mcfunction @@ -164,7 +175,31 @@ data modify storage runtoolkit:api request set value {id:"rtwrapper"} function runtoolkit:api/reload ``` -There is no RTWrapper dialog UI, no `rtwrapper.testMode` tag, and no `RTWrapper` trigger objective. +## Trigger menus + +The menu system is back and is gated by `rtwrapper.testMode` so normal gameplay is not affected. + +```mcfunction +function rtwrapper:api/testmode/on +trigger RTWrapper set 1 +``` + +Trigger values: + +```mcfunction +trigger RTWrapper set 1 # RTWrapper main menu +trigger RTWrapper set 2 # Run current request +trigger RTWrapper set 3 # List wrappers in chat +trigger RTWrapper set 4 # Runtoolkit manager menu +trigger RTWrapper set 5 # Batch request menu +trigger RTWrapper set 6 # core:selector tools menu +``` + +The menus use `rtw.temp` as success/cancel flag and use the current `core:selector/detect`, `runSafeMode`, and batch request APIs. The dialogs use input controls (`text`, `boolean`, `single_option`). Storage-backed menus render current defaults through macro functions, and every dialog action dispatches through `trigger RTWrapper set ...`; option ids use the `-0` form such as `-01`, `-010`, `-024`. Disable menu access: + +```mcfunction +function rtwrapper:api/testmode/off +``` ## Build diff --git a/RTWrapper-manager.patch b/RTWrapper-manager.patch deleted file mode 100644 index 2bd8264..0000000 --- a/RTWrapper-manager.patch +++ /dev/null @@ -1,708 +0,0 @@ -diff --git a/README.md b/README.md -index 0886332..ebf32f9 100644 ---- a/README.md -+++ b/README.md -@@ -4,14 +4,14 @@ RTWrapper is a Fabric mod + standalone datapack for Java Edition 26.2. The mod e - - ## Requirements - --| Component | Version | --|-------------------|-----------------------------------| --| Minecraft | 26.2 ("Chaos Cubed") | --| Java | 25 (JDK 25 toolchain required) | --| Fabric Loader | matches `fabric.mod.json` — verify against `build/libs` manifest before release | --| Fabric API | matches `fabric.mod.json` | --| Gradle | 9.5+ | --| Pack format | see `pack.mcmeta` in the datapack root — bump this in lockstep with `PACK_FORMAT` in `scripts/generate_wrappers.py` | -+| Component | Version | -+| --- | --- | -+| Minecraft | 26.2 ("Chaos Cubed") | -+| Java | 25 (JDK 25 toolchain required) | -+| Fabric Loader | matches `fabric.mod.json` — verify against `build/libs` manifest before release | -+| Fabric API | matches `fabric.mod.json` | -+| Gradle | 9.5+ | -+| Pack format | see `pack.mcmeta` in the datapack root — bump this in lockstep with `PACK_FORMAT` in `scripts/generate_wrappers.py` | - - RTWrapper is built and tested against 26.2 only. It has not been validated against 26.1 or 26.3 — see "Updating command wrappers" below before attempting cross-version use. - -@@ -36,6 +36,7 @@ src/gametest/ Fabric server GameTests - 4. Drop the jar into your `mods/` folder. - 5. Launch the game or server. The mod embeds its datapack automatically — no separate install step needed. - 6. In-world, run `/reload` once to ensure the embedded datapack functions are registered, then verify with: -+ - ```mcfunction - function runtoolkit:api/status - ``` -@@ -46,6 +47,7 @@ src/gametest/ Fabric server GameTests - 2. Place the zip into your world's `datapacks/` folder (`/datapacks/RTWrapper-Datapack-.zip`), or into `datapacks/` under your server root for a server. - 3. If the world is already running, run `/reload`. Otherwise this loads automatically on world start. - 4. Confirm the datapack is active — check **Advancements > Runtoolkit** in-game, or run: -+ - ```mcfunction - function runtoolkit:api/status - ``` -@@ -80,19 +82,18 @@ data modify storage rtwrapper:api params set value {target:"@s",item:"minecraft: - function rtwrapper:api/commands/give_item - ``` - --### `run` vs `enqueue`/autotick -+### `run` vs `enqueue` / autotick - - Two distinct execution paths exist — they are not interchangeable: - --- **`rtwrapper:api/run`** executes the request in `rtwrapper:api request` (or `rtwrapper:api params` for direct command wrappers) immediately, synchronously, in the current tick. Use this for one-off calls where you need the result available before your function continues. --- **`rtwrapper:api/enqueue`** + autotick pushes the request onto a queue that is drained one action per tick by `rtwrapper:api/autotick/on`. Use this when issuing many commands in a burst (e.g. spawning many entities, batch scoreboard writes) where spreading load across ticks avoids a single-tick lag spike. The tradeoff is latency: an enqueued action is not guaranteed to execute in the same tick it was queued. -- --Calling `rtwrapper:api/run` while autotick is on and the queue is non-empty performs a full immediate drain of the queue — see below. -+- **`rtwrapper:api/run`** executes the request in `rtwrapper:api request` immediately and drains the queue synchronously in the current tick. Use this for one-off calls where you need the result before your function continues. -+- **`rtwrapper:api/enqueue`** pushes the request onto a queue. With `rtwrapper:api/autotick/on`, the queue is processed one action per tick. Use this when issuing many commands in a burst where spreading load across ticks avoids a single-tick lag spike. - - Autotick usage: - - ```mcfunction - function rtwrapper:api/autotick/on -+ - data modify storage rtwrapper:api request set value {cmd:"say",params:{message:"queued hello"}} - function rtwrapper:api/enqueue - ``` -@@ -101,15 +102,71 @@ Autotick processes one queued action per tick. Use `function rtwrapper:api/run` - - See [`docs/API.md`](docs/API.md) for the full protocol and debug/silent controls. - -+## Runtoolkit manager / loaded-pack discovery -+ -+RTWrapper installs the shared `runtoolkit` namespace so Runtoolkit packs can be managed globally: -+ -+```text -+data/runtoolkit/function/ -+data/runtoolkit/tags/function/ -+data/runtoolkit/advancement/root.json -+data/runtoolkit/advancement/packs/rtwrapper.json -+``` -+ -+After `/reload`, players get a visible **Advancements > Runtoolkit** tab via the `minecraft:tick` advancement trigger. This is intentionally not revoked, so it can be used as a stable visual list of loaded Runtoolkit datapacks without reading a long `/datapack list` output. -+ -+Dynamic list/status: -+ -+```mcfunction -+function runtoolkit:api/status -+function runtoolkit:api/list -+function runtoolkit:api/dump_registry -+``` -+ -+Manager controls for one pack: -+ -+```mcfunction -+data modify storage runtoolkit:api request set value {id:"rtwrapper"} -+function runtoolkit:api/disable -+ -+data modify storage runtoolkit:api request set value {id:"rtwrapper"} -+function runtoolkit:api/enable -+ -+data modify storage runtoolkit:api request set value {id:"rtwrapper"} -+function runtoolkit:api/reload -+``` -+ -+Bulk manager hooks: -+ -+```mcfunction -+function runtoolkit:api/disable_all -+function runtoolkit:api/enable_all -+function runtoolkit:api/reload_all -+``` -+ -+This manager does not call vanilla `/datapack disable|enable`; it controls Runtoolkit-managed registration/load/tick hooks. Functions still exist when a pack is manager-disabled, but the global manager stops running that pack's managed hooks. -+ -+Other Runtoolkit projects can join the system by adding functions to these tags: -+ -+```text -+#runtoolkit:register -+#runtoolkit:load -+#runtoolkit:tick -+#runtoolkit:list -+#runtoolkit:enable -+#runtoolkit:disable -+#runtoolkit:reload -+``` -+ - ## `commands-26.2.json` - --This file is the single source of truth for what `generate_wrappers.py` emits — it is not just a manifest, it defines every wrapper function that exists under `rtwrapper:api/commands/`. Structure: -+This file is the single source of truth for what `generate_wrappers.py` emits: - --- Top-level: one entry per supported vanilla command (`tp`, `give`, `scoreboard`, etc.) --- Each entry lists ordered parameter names for that command's positional wrapper variant(s) — this is what determines the exact param order you must supply in `params:{...}` when calling that command's `_` variant. --- Named convenience wrappers (like `give_item`) are derived from this file per the macro syntax comment above their definition (e.g. `$give $(target) $(item)$(components) $(count)`). -+- Top-level command lists define supported vanilla commands (`tp`, `give`, `scoreboard`, etc.). -+- `command_params` lists ordered meaningful parameter names for each command. -+- Named convenience wrappers (like `give_item`) are generated alongside the vanilla command wrappers. - --If you add or change a command's parameters, edit this file first, then regenerate (see "Updating command wrappers" below) — hand-editing generated function files under `data/rtwrapper/function/api/commands/` directly will be overwritten on next generation. -+If you add or change a command's parameters, edit `scripts/generate_wrappers.py` first, regenerate, then validate. Hand-editing generated function files under `data/rtwrapper/function/api/commands/` directly will be overwritten on next generation. - - ## Build - -@@ -121,10 +178,11 @@ python3 scripts/validate_datapack.py - ``` - - Build outputs: -+ - - Fabric mod jar: `build/libs/rtwrapper-.jar` - - Standalone datapack zip: `build/libs/RTWrapper-Datapack-.zip` - --The `build` task also runs server GameTests through Fabric API's GameTest integration — these spin up a headless test server as part of the Gradle build itself (not a separate CI-only step) and will fail the build on test failure. Running `./gradlew build` locally runs the same GameTests that run in CI; there is no separate local/CI test split. To run only the GameTests without a full build, use: -+The `build` task also runs server GameTests through Fabric API's GameTest integration. These spin up a headless test server as part of the Gradle build and fail the build on test failure. To run only the GameTests without a full build, use: - - ```bash - ./gradlew runGametest -@@ -142,11 +200,11 @@ python3 scripts/validate_datapack.py - ./gradlew build - ``` - --Bumping `PACK_FORMAT` without updating every consuming datapack (including any `runtoolkit:` namespace dependents) will silently break `/reload` behavior on older packs — Minecraft does not always hard-error on a pack_format mismatch, it may just warn and load anyway with undefined wrapper behavior. Verify with `function runtoolkit:api/status` after any pack_format bump, don't assume silence means success. -+Bumping `PACK_FORMAT` without updating every consuming datapack (including any `runtoolkit:` namespace dependents) can break `/reload` behavior on older packs. Verify with `function runtoolkit:api/status` after any pack format bump; don't assume silence means success. - - ## License - --No license file is currently present in this repository. Until one is added, default copyright applies and no reuse, modification, or redistribution rights are granted to third parties beyond what's needed to view the source. If this repo is intended to be public or to accept external contributions, add a `LICENSE` file before relying on that assumption. -+MIT. See [`LICENSE`](LICENSE). - - ## Safety - -diff --git a/datapack/RTWrapper-Datapack/data/minecraft/tags/function/load.json b/datapack/RTWrapper-Datapack/data/minecraft/tags/function/load.json -index 6b11790..6ba7ba2 100644 ---- a/datapack/RTWrapper-Datapack/data/minecraft/tags/function/load.json -+++ b/datapack/RTWrapper-Datapack/data/minecraft/tags/function/load.json -@@ -1,6 +1,5 @@ - { - "values": [ -- "rtwrapper:core/load", - "runtoolkit:core/load" - ] - } -diff --git a/datapack/RTWrapper-Datapack/data/minecraft/tags/function/tick.json b/datapack/RTWrapper-Datapack/data/minecraft/tags/function/tick.json -index 4cda2d7..4ba576f 100644 ---- a/datapack/RTWrapper-Datapack/data/minecraft/tags/function/tick.json -+++ b/datapack/RTWrapper-Datapack/data/minecraft/tags/function/tick.json -@@ -1,6 +1,5 @@ - { - "values": [ -- "rtwrapper:core/tick", - "runtoolkit:core/tick" - ] - } -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/disable.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/disable.mcfunction -new file mode 100644 -index 0000000..5f19c7d ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/disable.mcfunction -@@ -0,0 +1,4 @@ -+# Disable one managed Runtoolkit pack. -+# Usage: data modify storage runtoolkit:api request set value {id:"rtwrapper"} -+# function runtoolkit:api/disable -+function runtoolkit:manager/disable with storage runtoolkit:api request -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/disable_all.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/disable_all.mcfunction -new file mode 100644 -index 0000000..d6f44b9 ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/disable_all.mcfunction -@@ -0,0 +1,2 @@ -+# Disable all registered Runtoolkit packs through their managed hooks. -+function #runtoolkit:disable -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/dump_registry.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/dump_registry.mcfunction -new file mode 100644 -index 0000000..9838ce1 ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/dump_registry.mcfunction -@@ -0,0 +1,2 @@ -+# Console-friendly raw registry dump. -+data get storage runtoolkit:registry packs -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/enable.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/enable.mcfunction -new file mode 100644 -index 0000000..7e403f0 ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/enable.mcfunction -@@ -0,0 +1,4 @@ -+# Enable one managed Runtoolkit pack. -+# Usage: data modify storage runtoolkit:api request set value {id:"rtwrapper"} -+# function runtoolkit:api/enable -+function runtoolkit:manager/enable with storage runtoolkit:api request -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/enable_all.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/enable_all.mcfunction -new file mode 100644 -index 0000000..a381174 ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/enable_all.mcfunction -@@ -0,0 +1,2 @@ -+# Enable all registered Runtoolkit packs through their managed hooks. -+function #runtoolkit:enable -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/list.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/list.mcfunction -new file mode 100644 -index 0000000..5e00960 ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/list.mcfunction -@@ -0,0 +1,3 @@ -+# Dynamic list of Runtoolkit-managed packs. -+tellraw @s [{"text":"[Runtoolkit] Managed packs","color":"gold","bold":true}] -+function #runtoolkit:list -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/reload.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/reload.mcfunction -new file mode 100644 -index 0000000..c4b06e6 ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/reload.mcfunction -@@ -0,0 +1,4 @@ -+# Reload one managed Runtoolkit pack. -+# Usage: data modify storage runtoolkit:api request set value {id:"rtwrapper"} -+# function runtoolkit:api/reload -+function runtoolkit:manager/reload with storage runtoolkit:api request -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/reload_all.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/reload_all.mcfunction -new file mode 100644 -index 0000000..7ac00f6 ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/reload_all.mcfunction -@@ -0,0 +1,7 @@ -+# Re-register and reload all enabled Runtoolkit packs without using /reload. -+data modify storage runtoolkit:registry packs set value {} -+data modify storage runtoolkit:runtime missing_dependencies set value [] -+scoreboard players set #dependency_errors rtk.status 0 -+scoreboard players add #manager_reloads rtk.status 1 -+function #runtoolkit:register -+function #runtoolkit:reload -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/require.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/require.mcfunction -new file mode 100644 -index 0000000..bf2f380 ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/require.mcfunction -@@ -0,0 +1,4 @@ -+# Dependency assertion helper for pack check hooks. -+# Usage: data modify storage runtoolkit:api request set value {id:"dependency_pack_id"} -+# function runtoolkit:api/require -+function runtoolkit:manager/require with storage runtoolkit:api request -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/status.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/status.mcfunction -index 4c7042e..99a925c 100644 ---- a/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/status.mcfunction -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/api/status.mcfunction -@@ -1,2 +1,2 @@ --# Lightweight status helper for Runtoolkit packs. --tellraw @s [{"text":"[Runtoolkit] Loaded registry: ","color":"gold"},{"text":"RTWrapper","color":"green"},{"text":". Open Advancements > Runtoolkit for the visual loaded-pack list.","color":"gray"}] -+# Alias for the dynamic list view. -+function runtoolkit:api/list -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/core/load.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/core/load.mcfunction -index 25b260c..23eac05 100644 ---- a/datapack/RTWrapper-Datapack/data/runtoolkit/function/core/load.mcfunction -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/core/load.mcfunction -@@ -1,5 +1,15 @@ --# Runtoolkit common registry bootstrap. --# This namespace is shared by Runtoolkit datapacks so loaded modules can be --# discovered without relying on /datapack list. -+# Runtoolkit global datapack manager bootstrap. -+# All Runtoolkit datapacks register through #runtoolkit:register, then the -+# manager runs enabled pack load hooks through #runtoolkit:load. -+scoreboard objectives add rtk.registered dummy -+scoreboard objectives add rtk.enabled dummy - scoreboard objectives add rtk.loaded dummy --function runtoolkit:packs/rtwrapper/register -+scoreboard objectives add rtk.status dummy -+ -+data modify storage runtoolkit:registry packs set value {} -+data modify storage runtoolkit:runtime missing_dependencies set value [] -+scoreboard players set #dependency_errors rtk.status 0 -+scoreboard players add #reloads rtk.status 1 -+ -+function #runtoolkit:register -+function #runtoolkit:load -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/core/tick.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/core/tick.mcfunction -index 3bda22e..6a9c701 100644 ---- a/datapack/RTWrapper-Datapack/data/runtoolkit/function/core/tick.mcfunction -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/core/tick.mcfunction -@@ -1,4 +1,4 @@ --# Runtoolkit common tick hook. --# Advancement completion is handled by advancement trigger minecraft:tick. --# Keep this function lightweight and do not revoke advancements here. --execute if score #rtwrapper rtk.loaded matches 1 run scoreboard players add #rtwrapper_ticks rtk.loaded 0 -+# Runtoolkit global datapack manager tick. -+# Managed packs should add a lightweight function to #runtoolkit:tick and gate -+# their own tick work behind their rtk.enabled score. -+function #runtoolkit:tick -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/manager/check.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/manager/check.mcfunction -new file mode 100644 -index 0000000..7b7892f ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/manager/check.mcfunction -@@ -0,0 +1,2 @@ -+# Macro dispatch to a pack dependency check hook. -+$function runtoolkit:packs/$(id)/check_dependencies -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/manager/disable.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/manager/disable.mcfunction -new file mode 100644 -index 0000000..fff3bfd ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/manager/disable.mcfunction -@@ -0,0 +1,2 @@ -+# Macro dispatch to a pack disable hook. -+$function runtoolkit:packs/$(id)/disable -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/manager/enable.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/manager/enable.mcfunction -new file mode 100644 -index 0000000..2046b72 ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/manager/enable.mcfunction -@@ -0,0 +1,2 @@ -+# Macro dispatch to a pack enable hook. -+$function runtoolkit:packs/$(id)/enable -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/manager/reload.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/manager/reload.mcfunction -new file mode 100644 -index 0000000..9222ffa ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/manager/reload.mcfunction -@@ -0,0 +1,2 @@ -+# Macro dispatch to a pack reload hook. -+$function runtoolkit:packs/$(id)/reload -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/manager/require.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/manager/require.mcfunction -new file mode 100644 -index 0000000..04f17e7 ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/manager/require.mcfunction -@@ -0,0 +1,4 @@ -+# Macro dependency check: a dependency is satisfied only when its rtk.enabled -+# score is 1 or greater. Missing dependencies are recorded in runtime storage. -+$execute unless score $(id) rtk.enabled matches 1.. run scoreboard players add #dependency_errors rtk.status 1 -+$execute unless score $(id) rtk.enabled matches 1.. run data modify storage runtoolkit:runtime missing_dependencies append value "$(id)" -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/check_dependencies.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/check_dependencies.mcfunction -new file mode 100644 -index 0000000..a1bf7ff ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/check_dependencies.mcfunction -@@ -0,0 +1,4 @@ -+# RTWrapper has no Runtoolkit dependencies. -+data modify storage runtoolkit:runtime missing_dependencies set value [] -+scoreboard players set #dependency_errors rtk.status 0 -+scoreboard players set rtwrapper rtk.loaded 0 -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/disable.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/disable.mcfunction -new file mode 100644 -index 0000000..ff5a6a7 ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/disable.mcfunction -@@ -0,0 +1,5 @@ -+# Disable RTWrapper manager hooks. Functions remain present, but the global -+# manager will stop running RTWrapper load/tick hooks. -+scoreboard players set rtwrapper rtk.enabled 0 -+scoreboard players set rtwrapper rtk.loaded 0 -+tellraw @a [{"text":"[Runtoolkit] Disabled RTWrapper manager hooks","color":"yellow"}] -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/enable.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/enable.mcfunction -new file mode 100644 -index 0000000..5c5b30b ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/enable.mcfunction -@@ -0,0 +1,5 @@ -+# Enable RTWrapper manager hooks. This does not run /datapack enable; it controls -+# Runtoolkit-managed execution hooks. -+scoreboard players set rtwrapper rtk.enabled 1 -+function runtoolkit:packs/rtwrapper/load -+tellraw @a [{"text":"[Runtoolkit] Enabled RTWrapper","color":"green"}] -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/list.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/list.mcfunction -new file mode 100644 -index 0000000..51162d5 ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/list.mcfunction -@@ -0,0 +1,3 @@ -+# Dynamic list row for RTWrapper. -+execute if score rtwrapper rtk.enabled matches 1.. run tellraw @s [{"text":" - RTWrapper ","color":"aqua"},{"text":"enabled","color":"green"},{"text":" v0.1.1+26.2","color":"gray"}] -+execute unless score rtwrapper rtk.enabled matches 1.. run tellraw @s [{"text":" - RTWrapper ","color":"aqua"},{"text":"disabled","color":"red"},{"text":" v0.1.1+26.2","color":"gray"}] -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/load.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/load.mcfunction -new file mode 100644 -index 0000000..f409cef ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/load.mcfunction -@@ -0,0 +1,5 @@ -+# Load RTWrapper only when enabled and dependency checks pass. -+execute if score rtwrapper rtk.enabled matches 1.. run function runtoolkit:packs/rtwrapper/check_dependencies -+execute if score rtwrapper rtk.enabled matches 1.. if score #dependency_errors rtk.status matches 0 run function rtwrapper:core/load -+execute if score rtwrapper rtk.enabled matches 1.. if score #dependency_errors rtk.status matches 0 run scoreboard players set rtwrapper rtk.loaded 1 -+execute if score rtwrapper rtk.enabled matches 1.. unless score #dependency_errors rtk.status matches 0 run tellraw @a [{"text":"[Runtoolkit] RTWrapper dependency check failed: ","color":"red"},{"nbt":"missing_dependencies","storage":"runtoolkit:runtime","color":"yellow"}] -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/register.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/register.mcfunction -index 1a95289..0e96585 100644 ---- a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/register.mcfunction -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/register.mcfunction -@@ -1,4 +1,10 @@ --# Registration hook for RTWrapper. Other Runtoolkit datapacks can mirror this pattern. -+# Register RTWrapper with the global Runtoolkit manager. -+scoreboard objectives add rtk.registered dummy -+scoreboard objectives add rtk.enabled dummy - scoreboard objectives add rtk.loaded dummy --scoreboard players set #rtwrapper rtk.loaded 1 --data modify storage runtoolkit:registry packs.rtwrapper set value {id:"rtwrapper",name:"RTWrapper",version:"0.1.1+26.2",kind:"datapack",advancement:"runtoolkit:packs/rtwrapper"} -+scoreboard objectives add rtk.status dummy -+ -+scoreboard players set rtwrapper rtk.registered 1 -+execute unless score rtwrapper rtk.enabled matches 0.. run scoreboard players set rtwrapper rtk.enabled 1 -+ -+data modify storage runtoolkit:registry packs.rtwrapper set value {id:"rtwrapper",name:"RTWrapper",version:"0.1.1+26.2",namespace:"rtwrapper",kind:"datapack",advancement:"runtoolkit:packs/rtwrapper",dependencies:[],hooks:{register:"runtoolkit:packs/rtwrapper/register",load:"runtoolkit:packs/rtwrapper/load",tick:"runtoolkit:packs/rtwrapper/tick",list:"runtoolkit:packs/rtwrapper/list",enable:"runtoolkit:packs/rtwrapper/enable",disable:"runtoolkit:packs/rtwrapper/disable",reload:"runtoolkit:packs/rtwrapper/reload",check_dependencies:"runtoolkit:packs/rtwrapper/check_dependencies"}} -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/reload.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/reload.mcfunction -new file mode 100644 -index 0000000..40a9fce ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/reload.mcfunction -@@ -0,0 +1,4 @@ -+# Reload RTWrapper through the manager. -+function runtoolkit:packs/rtwrapper/register -+function runtoolkit:packs/rtwrapper/load -+tellraw @a [{"text":"[Runtoolkit] Reloaded RTWrapper","color":"aqua"}] -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/tick.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/tick.mcfunction -new file mode 100644 -index 0000000..512eeb5 ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/tick.mcfunction -@@ -0,0 +1,2 @@ -+# Managed tick hook for RTWrapper. -+execute if score rtwrapper rtk.enabled matches 1.. run function rtwrapper:core/tick -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/tags/function/disable.json b/datapack/RTWrapper-Datapack/data/runtoolkit/tags/function/disable.json -new file mode 100644 -index 0000000..ca05425 ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/tags/function/disable.json -@@ -0,0 +1,5 @@ -+{ -+ "values": [ -+ "runtoolkit:packs/rtwrapper/disable" -+ ] -+} -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/tags/function/enable.json b/datapack/RTWrapper-Datapack/data/runtoolkit/tags/function/enable.json -new file mode 100644 -index 0000000..022dc73 ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/tags/function/enable.json -@@ -0,0 +1,5 @@ -+{ -+ "values": [ -+ "runtoolkit:packs/rtwrapper/enable" -+ ] -+} -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/tags/function/list.json b/datapack/RTWrapper-Datapack/data/runtoolkit/tags/function/list.json -new file mode 100644 -index 0000000..edc84d2 ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/tags/function/list.json -@@ -0,0 +1,5 @@ -+{ -+ "values": [ -+ "runtoolkit:packs/rtwrapper/list" -+ ] -+} -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/tags/function/load.json b/datapack/RTWrapper-Datapack/data/runtoolkit/tags/function/load.json -new file mode 100644 -index 0000000..8a064db ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/tags/function/load.json -@@ -0,0 +1,5 @@ -+{ -+ "values": [ -+ "runtoolkit:packs/rtwrapper/load" -+ ] -+} -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/tags/function/register.json b/datapack/RTWrapper-Datapack/data/runtoolkit/tags/function/register.json -new file mode 100644 -index 0000000..1df6417 ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/tags/function/register.json -@@ -0,0 +1,5 @@ -+{ -+ "values": [ -+ "runtoolkit:packs/rtwrapper/register" -+ ] -+} -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/tags/function/reload.json b/datapack/RTWrapper-Datapack/data/runtoolkit/tags/function/reload.json -new file mode 100644 -index 0000000..1d2a982 ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/tags/function/reload.json -@@ -0,0 +1,5 @@ -+{ -+ "values": [ -+ "runtoolkit:packs/rtwrapper/reload" -+ ] -+} -diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/tags/function/tick.json b/datapack/RTWrapper-Datapack/data/runtoolkit/tags/function/tick.json -new file mode 100644 -index 0000000..6e510ee ---- /dev/null -+++ b/datapack/RTWrapper-Datapack/data/runtoolkit/tags/function/tick.json -@@ -0,0 +1,5 @@ -+{ -+ "values": [ -+ "runtoolkit:packs/rtwrapper/tick" -+ ] -+} -diff --git a/docs/API.md b/docs/API.md -index b9c37b7..e25c35e 100644 ---- a/docs/API.md -+++ b/docs/API.md -@@ -99,33 +99,123 @@ function rtwrapper:api/commands/give_item - - For `give_item`, `components:""` is allowed because it is concatenated directly to `item`, not appended as a separate trailing token. - --## Runtoolkit loaded-pack registry -+## Runtoolkit global datapack manager - --RTWrapper includes a shared `runtoolkit` namespace for Runtoolkit datapack discovery: -+RTWrapper includes a shared `runtoolkit` namespace that behaves like a lightweight manager for Runtoolkit datapacks/modules. It does not run vanilla `/datapack enable|disable`; instead it manages Runtoolkit pack registration, dependency checks, load/tick hooks, dynamic listing, and manager-level enable/disable/reload. -+ -+Core files: - - ```text - data/runtoolkit/function/core/load.mcfunction - data/runtoolkit/function/core/tick.mcfunction --data/runtoolkit/function/api/status.mcfunction -+data/runtoolkit/function/api/*.mcfunction -+data/runtoolkit/function/manager/*.mcfunction - data/runtoolkit/advancement/root.json - data/runtoolkit/advancement/packs/rtwrapper.json - ``` - --The visual registry uses advancements with the `minecraft:tick` trigger and does not revoke them. After `/reload`, open **Advancements > Runtoolkit** to see loaded Runtoolkit packs/modules. -+Function tags used by the manager: -+ -+```text -+#runtoolkit:register -+#runtoolkit:load -+#runtoolkit:tick -+#runtoolkit:list -+#runtoolkit:enable -+#runtoolkit:disable -+#runtoolkit:reload -+``` -+ -+The Minecraft `load` and `tick` tags call only the Runtoolkit manager entrypoints. The manager then dispatches the registered pack hooks. - --Status helper: -+### Visual loaded-pack list -+ -+The visual registry uses advancements with the `minecraft:tick` trigger and does not revoke them. After `/reload`, open **Advancements > Runtoolkit** to see loaded Runtoolkit packs/modules. - - ```mcfunction - function runtoolkit:api/status -+function runtoolkit:api/list -+``` -+ -+For console-friendly raw storage output: -+ -+```mcfunction -+function runtoolkit:api/dump_registry -+``` -+ -+### Manager enable / disable / reload -+ -+```mcfunction -+# Disable RTWrapper manager hooks -+data modify storage runtoolkit:api request set value {id:"rtwrapper"} -+function runtoolkit:api/disable -+ -+# Enable RTWrapper manager hooks -+data modify storage runtoolkit:api request set value {id:"rtwrapper"} -+function runtoolkit:api/enable -+ -+# Reload RTWrapper through the manager -+data modify storage runtoolkit:api request set value {id:"rtwrapper"} -+function runtoolkit:api/reload -+``` -+ -+Bulk hooks: -+ -+```mcfunction -+function runtoolkit:api/disable_all -+function runtoolkit:api/enable_all -+function runtoolkit:api/reload_all -+``` -+ -+### Dependency management -+ -+Packs define their metadata in their register hook and can provide a `check_dependencies` hook. Dependency checks should call `runtoolkit:api/require` for each dependency: -+ -+```mcfunction -+data modify storage runtoolkit:api request set value {id:"required_pack_id"} -+function runtoolkit:api/require -+``` -+ -+`api/require` increments `#dependency_errors rtk.status` and appends to `storage runtoolkit:runtime missing_dependencies` when the dependency is not enabled. -+ -+### How another Runtoolkit pack registers -+ -+A Runtoolkit pack should add functions to the manager tags, for example: -+ -+```json -+{ -+ "values": [ -+ "runtoolkit:packs/my_pack/register" -+ ] -+} -+``` -+ -+under: -+ -+```text -+data/runtoolkit/tags/function/register.json -+``` -+ -+Recommended pack hook layout: -+ -+```text -+data/runtoolkit/function/packs/my_pack/register.mcfunction -+data/runtoolkit/function/packs/my_pack/load.mcfunction -+data/runtoolkit/function/packs/my_pack/tick.mcfunction -+data/runtoolkit/function/packs/my_pack/list.mcfunction -+data/runtoolkit/function/packs/my_pack/enable.mcfunction -+data/runtoolkit/function/packs/my_pack/disable.mcfunction -+data/runtoolkit/function/packs/my_pack/reload.mcfunction -+data/runtoolkit/function/packs/my_pack/check_dependencies.mcfunction - ``` - --Other Runtoolkit datapacks can add themselves by including a child advancement under the shared namespace, for example: -+The pack should also add a child advancement under the shared namespace: - - ```text - data/runtoolkit/advancement/packs/my_pack.json - ``` - --Use this pattern: -+Use `minecraft:tick` as the trigger: - - ```json - { -diff --git a/scripts/validate_datapack.py b/scripts/validate_datapack.py -index b510fc8..ce01276 100644 ---- a/scripts/validate_datapack.py -+++ b/scripts/validate_datapack.py -@@ -49,8 +49,8 @@ def main() -> None: - fail('pack.mcmeta must declare min_format=[107, 1] and max_format=[107, 1] for the 26.2 target') - - required_tag_values = { -- 'load': {'rtwrapper:core/load', 'runtoolkit:core/load'}, -- 'tick': {'rtwrapper:core/tick', 'runtoolkit:core/tick'}, -+ 'load': {'runtoolkit:core/load'}, -+ 'tick': {'runtoolkit:core/tick'}, - } - for tag, required_values in required_tag_values.items(): - data = load_json(PACK / 'data' / 'minecraft' / 'tags' / 'function' / f'{tag}.json') -@@ -58,6 +58,25 @@ def main() -> None: - if not required_values.issubset(values): - fail(f'{tag}.json missing values: {sorted(required_values - values)}') - -+ for tag in ['register', 'load', 'tick', 'list', 'enable', 'disable', 'reload']: -+ tag_path = PACK / 'data' / 'runtoolkit' / 'tags' / 'function' / f'{tag}.json' -+ if not tag_path.exists(): -+ fail(f'missing runtoolkit function tag {tag_path.relative_to(ROOT)}') -+ values = set(load_json(tag_path).get('values', [])) -+ expected_value = f'runtoolkit:packs/rtwrapper/{tag}' -+ if expected_value not in values: -+ fail(f'{tag_path.relative_to(ROOT)} missing {expected_value}') -+ -+ for function in [ -+ PACK / 'data' / 'runtoolkit' / 'function' / 'api' / 'enable.mcfunction', -+ PACK / 'data' / 'runtoolkit' / 'function' / 'api' / 'disable.mcfunction', -+ PACK / 'data' / 'runtoolkit' / 'function' / 'api' / 'reload.mcfunction', -+ PACK / 'data' / 'runtoolkit' / 'function' / 'api' / 'list.mcfunction', -+ PACK / 'data' / 'runtoolkit' / 'function' / 'manager' / 'require.mcfunction', -+ ]: -+ if not function.exists(): -+ fail(f'missing Runtoolkit manager function {function.relative_to(ROOT)}') -+ - for advancement in [ - PACK / 'data' / 'runtoolkit' / 'advancement' / 'root.json', - PACK / 'data' / 'runtoolkit' / 'advancement' / 'packs' / 'rtwrapper.json', diff --git a/datapack/RTWrapper-Datapack/data/core/function/selector/detect.mcfunction b/datapack/RTWrapper-Datapack/data/core/function/selector/detect.mcfunction index 9995723..5e7e3ec 100644 --- a/datapack/RTWrapper-Datapack/data/core/function/selector/detect.mcfunction +++ b/datapack/RTWrapper-Datapack/data/core/function/selector/detect.mcfunction @@ -17,13 +17,13 @@ data modify storage core:selector result set value {valid:0b,kind:"rejected",rea execute if entity @s run scoreboard players set @s rtw.temp 0 # Exact allowed selector forms. -execute if data storage core:selector input {value:"@s"} run function core:selector/private/accept_self -execute if data storage core:selector input {value:"@a[limit=1]"} run function core:selector/private/accept_limited_all -execute if data storage core:selector input {value:"@a[sort=nearest,limit=1]"} run function core:selector/private/accept_limited_all -execute if data storage core:selector input {value:"@a[limit=1,sort=nearest]"} run function core:selector/private/accept_limited_all -execute if data storage core:selector input {value:"@e[type=player,limit=1]"} run function core:selector/private/accept_limited_entity_player -execute if data storage core:selector input {value:"@e[type=player,sort=nearest,limit=1]"} run function core:selector/private/accept_limited_entity_player -execute if data storage core:selector input {value:"@e[type=player,limit=1,sort=nearest]"} run function core:selector/private/accept_limited_entity_player +execute if data storage core:selector input{value:"@s"} run function core:selector/private/accept_self +execute if data storage core:selector input{value:"@a[limit=1]"} run function core:selector/private/accept_limited_all +execute if data storage core:selector input{value:"@a[sort=nearest,limit=1]"} run function core:selector/private/accept_limited_all +execute if data storage core:selector input{value:"@a[limit=1,sort=nearest]"} run function core:selector/private/accept_limited_all +execute if data storage core:selector input{value:"@e[type=player,limit=1]"} run function core:selector/private/accept_limited_entity_player +execute if data storage core:selector input{value:"@e[type=player,sort=nearest,limit=1]"} run function core:selector/private/accept_limited_entity_player +execute if data storage core:selector input{value:"@e[type=player,limit=1,sort=nearest]"} run function core:selector/private/accept_limited_entity_player execute if score #valid core.selector matches 1.. run return 1 # Player-name validation needs StringLib. If StringLib is not detected, fail safely. diff --git a/datapack/RTWrapper-Datapack/data/rtwrapper/function/api/testmode/off.mcfunction b/datapack/RTWrapper-Datapack/data/rtwrapper/function/api/testmode/off.mcfunction new file mode 100644 index 0000000..1eb3030 --- /dev/null +++ b/datapack/RTWrapper-Datapack/data/rtwrapper/function/api/testmode/off.mcfunction @@ -0,0 +1,2 @@ +tag @s remove rtwrapper.testMode +tellraw @s [{"text":"[RTWrapper] testMode disabled","color":"gold"}] diff --git a/datapack/RTWrapper-Datapack/data/rtwrapper/function/api/testmode/on.mcfunction b/datapack/RTWrapper-Datapack/data/rtwrapper/function/api/testmode/on.mcfunction new file mode 100644 index 0000000..29ae66c --- /dev/null +++ b/datapack/RTWrapper-Datapack/data/rtwrapper/function/api/testmode/on.mcfunction @@ -0,0 +1,3 @@ +tag @s add rtwrapper.testMode +scoreboard players enable @s RTWrapper +tellraw @s [{"text":"[RTWrapper] testMode enabled. Use ","color":"gold"},{"text":"/trigger RTWrapper set 1","color":"yellow"},{"text":" for menus.","color":"gold"}] diff --git a/datapack/RTWrapper-Datapack/data/rtwrapper/function/core/load.mcfunction b/datapack/RTWrapper-Datapack/data/rtwrapper/function/core/load.mcfunction index 66094f5..5930fcc 100644 --- a/datapack/RTWrapper-Datapack/data/rtwrapper/function/core/load.mcfunction +++ b/datapack/RTWrapper-Datapack/data/rtwrapper/function/core/load.mcfunction @@ -4,6 +4,7 @@ scoreboard objectives add rtw.config dummy scoreboard objectives add rtw.status dummy scoreboard objectives add rtw.test dummy scoreboard objectives add rtw.temp dummy +scoreboard objectives add RTWrapper trigger execute unless score #debug rtw.config matches 0.. run scoreboard players set #debug rtw.config 0 execute unless score #silent rtw.config matches 0.. run scoreboard players set #silent rtw.config 1 @@ -20,7 +21,11 @@ execute unless data storage rtwrapper:runtime queue run data modify storage rtwr execute unless data storage rtwrapper:runtime current run data modify storage rtwrapper:runtime current set value {} execute unless data storage rtwrapper:runtime selector run data modify storage rtwrapper:runtime selector set value {found:0b} execute unless data storage rtwrapper:settings datapack run data modify storage rtwrapper:settings datapack set value {manager:"runtoolkit"} +execute unless data storage rtwrapper:ui menu run data modify storage rtwrapper:ui menu set value {target:"@s",item:"minecraft:stone",count:"1",x:"0",y:"80",z:"0",selector:"@s",batch_note:"RTWrapper batch",safe:"1b"} +execute unless data storage rtwrapper:ui selector run data modify storage rtwrapper:ui selector set value {value:"@s"} +execute unless data storage rtwrapper:settings menu run data modify storage rtwrapper:settings menu set value {mode:"dialog",columns:2} execute unless data storage rtwrapper:api request run data modify storage rtwrapper:api request set value {} execute unless data storage rtwrapper:api params run data modify storage rtwrapper:api params set value {} +scoreboard players enable @a RTWrapper execute if score #debug rtw.config matches 1.. run tellraw @a[tag=rtwrapper.debug] [{"text":"[RTWrapper] load complete","color":"gold"}] diff --git a/datapack/RTWrapper-Datapack/data/rtwrapper/function/core/tick.mcfunction b/datapack/RTWrapper-Datapack/data/rtwrapper/function/core/tick.mcfunction index cb60be0..208c3ea 100644 --- a/datapack/RTWrapper-Datapack/data/rtwrapper/function/core/tick.mcfunction +++ b/datapack/RTWrapper-Datapack/data/rtwrapper/function/core/tick.mcfunction @@ -1,3 +1,7 @@ +# Trigger UI is opt-in and gated by rtwrapper.testMode. +scoreboard players enable @a RTWrapper +execute as @a[scores={RTWrapper=1..}] run function rtwrapper:trigger/handle + # Disabled by default. Enable with: function rtwrapper:api/autotick/on # Autotick intentionally processes only one action per tick. Use rtwrapper:api/run # when you explicitly want to drain the whole queue immediately. diff --git a/datapack/RTWrapper-Datapack/data/rtwrapper/function/trigger/handle.mcfunction b/datapack/RTWrapper-Datapack/data/rtwrapper/function/trigger/handle.mcfunction new file mode 100644 index 0000000..79626a7 --- /dev/null +++ b/datapack/RTWrapper-Datapack/data/rtwrapper/function/trigger/handle.mcfunction @@ -0,0 +1,70 @@ +# RTWrapper trigger dispatcher. +# rtw.temp: 1 accepted/success, 0 canceled/error. +scoreboard players set @s rtw.temp 0 +execute unless entity @s[tag=rtwrapper.testMode] run tellraw @s [{"text":"[RTWrapper] Trigger canceled: ","color":"red"},{"text":"rtwrapper.testMode required. Run function rtwrapper:api/testmode/on","color":"yellow"}] + +# Positive button values. +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 1 run function rtwrapper:ui/open +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 2 run function rtwrapper:trigger/run_request +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 3 run function rtwrapper:ui/list_commands +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 4 run function runtoolkit:dpman +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 5 run function rtwrapper:ui/batch +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 6 run function rtwrapper:ui/selector +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 7 run function rtwrapper:ui/preset/give +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 8 run function rtwrapper:ui/preset/tp +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 9 run function rtwrapper:ui/settings +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 10 run function rtwrapper:api/debug/on +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 11 run function rtwrapper:api/debug/off +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 12 run function rtwrapper:api/silent/on +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 13 run function rtwrapper:api/silent/off +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 14 run function rtwrapper:api/autotick/on +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 15 run function rtwrapper:api/autotick/off +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 16 run function rtwrapper:ui/settings/safe +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 17 run function rtwrapper:api/testmode/off +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 18 run function rtwrapper:ui/preset/batch +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 19 run function rtwrapper:api/run_many +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 20 run function rtwrapper:ui/selector/check_self +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 21 run function rtwrapper:ui/selector/check_all_limited +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 22 run function rtwrapper:ui/selector/check_entity_player +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 23 run function rtwrapper:ui/selector/check_player_name +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 24 run function runtoolkit:dpman/enable_rtwrapper +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 25 run function runtoolkit:dpman/disable_rtwrapper +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 26 run function runtoolkit:dpman/reload_rtwrapper +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 27 run function runtoolkit:api/list +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 28 run function runtoolkit:api/dump_registry +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches 29 run function runtoolkit:api/reload_all + +# Negative option values from dialog single_option inputs (-01, -010, -018...). +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -1 run function rtwrapper:trigger/run_request +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -2 run function rtwrapper:ui/list_commands +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -3 run function runtoolkit:dpman +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -4 run function rtwrapper:ui/batch +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -5 run function rtwrapper:ui/selector +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -6 run function rtwrapper:ui/settings +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -7 run function rtwrapper:ui/preset/give +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -8 run function rtwrapper:ui/preset/tp +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -10 run function rtwrapper:api/debug/on +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -11 run function rtwrapper:api/debug/off +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -12 run function rtwrapper:api/silent/on +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -13 run function rtwrapper:api/silent/off +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -14 run function rtwrapper:api/autotick/on +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -15 run function rtwrapper:api/autotick/off +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -16 run function rtwrapper:ui/settings/safe +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -17 run function rtwrapper:api/testmode/off +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -18 run function rtwrapper:ui/preset/batch +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -19 run function rtwrapper:api/run_many +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -20 run function rtwrapper:ui/selector/check_self +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -21 run function rtwrapper:ui/selector/check_all_limited +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -22 run function rtwrapper:ui/selector/check_entity_player +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -23 run function rtwrapper:ui/selector/check_player_name +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -24 run function runtoolkit:dpman/enable_rtwrapper +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -25 run function runtoolkit:dpman/disable_rtwrapper +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -26 run function runtoolkit:dpman/reload_rtwrapper +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -27 run function runtoolkit:api/list +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -28 run function runtoolkit:api/dump_registry +execute if entity @s[tag=rtwrapper.testMode] if score @s RTWrapper matches -29 run function runtoolkit:api/reload_all + +execute if entity @s[tag=rtwrapper.testMode] unless score @s RTWrapper matches -29..29 run tellraw @s [{"text":"[RTWrapper] Unknown trigger value.","color":"red"}] +execute if score @s rtw.temp matches 0 run tellraw @s [{"text":"[RTWrapper] Operation ended with rtw.temp=0 (canceled/error).","color":"red"}] +scoreboard players set @s RTWrapper 0 +scoreboard players enable @s RTWrapper diff --git a/datapack/RTWrapper-Datapack/data/rtwrapper/function/trigger/run_request.mcfunction b/datapack/RTWrapper-Datapack/data/rtwrapper/function/trigger/run_request.mcfunction new file mode 100644 index 0000000..2468567 --- /dev/null +++ b/datapack/RTWrapper-Datapack/data/rtwrapper/function/trigger/run_request.mcfunction @@ -0,0 +1,8 @@ +# Trigger value 2: run the current RTWrapper API request. +scoreboard players set @s rtw.temp 0 +execute if data storage rtwrapper:api request.cmd run scoreboard players set @s rtw.temp 1 +execute unless data storage rtwrapper:api request.cmd if data storage rtwrapper:api request.type run scoreboard players set @s rtw.temp 1 +execute if score @s rtw.temp matches 1 if data storage rtwrapper:api request.params.target run data modify storage core:selector input.value set from storage rtwrapper:api request.params.target +execute if score @s rtw.temp matches 1 if data storage rtwrapper:api request.params.target store success score @s rtw.temp run function core:selector/detect +execute if score @s rtw.temp matches 1 run function rtwrapper:api/run +execute unless score @s rtw.temp matches 1 run tellraw @s [{"text":"[RTWrapper] Request missing or selector check failed.","color":"red"}] diff --git a/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/batch.mcfunction b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/batch.mcfunction new file mode 100644 index 0000000..3c00fb5 --- /dev/null +++ b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/batch.mcfunction @@ -0,0 +1,2 @@ +dialog show @s {type:"minecraft:multi_action",title:{text:"RTWrapper Batch",color:"light_purple",bold:true},body:[{type:"minecraft:plain_message",contents:{text:"Batch helpers use trigger actions and run_many."}}],inputs:[{type:"minecraft:boolean",key:"safe",label:{text:"Safe mode"},initial:true,on_true:"1b",on_false:"0b"},{type:"minecraft:single_option",key:"batch_action",label:{text:"Batch action"},options:[{id:"-018",display:{text:"Preset batch"},initial:true},{id:"-019",display:{text:"Run many"}},{id:"-014",display:{text:"Enable autotick"}}]}],columns:2,actions:[{label:{text:"Submit selected option",color:"green"},action:{type:"dynamic/run_command",template:"trigger RTWrapper set $(batch_action)"}},{label:{text:"Preset batch",color:"green"},action:{type:"run_command",command:"trigger RTWrapper set 18"}},{label:{text:"Run many",color:"gold"},action:{type:"run_command",command:"trigger RTWrapper set 19"}},{label:{text:"Enable autotick",color:"yellow"},action:{type:"run_command",command:"trigger RTWrapper set 14"}},{label:{text:"Back",color:"aqua"},action:{type:"run_command",command:"trigger RTWrapper set 1"}}],exit_action:{label:{text:"Close"}}} +scoreboard players set @s rtw.temp 1 diff --git a/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/list_commands.mcfunction b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/list_commands.mcfunction new file mode 100644 index 0000000..e02e4fc --- /dev/null +++ b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/list_commands.mcfunction @@ -0,0 +1,8 @@ +scoreboard players set @s rtw.temp 1 +tellraw @s [{"text":"[RTWrapper] Command wrappers","color":"gold","bold":true}] +tellraw @s [{"text":" - advancement, attribute, bossbar, clear, clone, damage, data","color":"yellow"}] +tellraw @s [{"text":" - datapack, dialog, effect, execute, function, give, item","color":"yellow"}] +tellraw @s [{"text":" - loot, particle, perf, schedule, scoreboard, summon, tag","color":"yellow"}] +tellraw @s [{"text":" - team, teleport/tp, tellraw, time, title, weather, worldborder","color":"yellow"}] +tellraw @s [{"text":" - xp","color":"yellow"}] +tellraw @s [{"text":"Full parameter list: datapack/commands-26.2.json","color":"gray"}] diff --git a/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/open.mcfunction b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/open.mcfunction new file mode 100644 index 0000000..e4b5e04 --- /dev/null +++ b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/open.mcfunction @@ -0,0 +1,10 @@ +# Storage-backed menu launcher. +execute unless data storage rtwrapper:ui menu.target run data modify storage rtwrapper:ui menu.target set value "@s" +execute unless data storage rtwrapper:ui menu.item run data modify storage rtwrapper:ui menu.item set value "minecraft:stone" +execute unless data storage rtwrapper:ui menu.count run data modify storage rtwrapper:ui menu.count set value "1" +execute unless data storage rtwrapper:ui menu.x run data modify storage rtwrapper:ui menu.x set value "0" +execute unless data storage rtwrapper:ui menu.y run data modify storage rtwrapper:ui menu.y set value "80" +execute unless data storage rtwrapper:ui menu.z run data modify storage rtwrapper:ui menu.z set value "0" +execute unless data storage rtwrapper:ui menu.selector run data modify storage rtwrapper:ui menu.selector set value "@s" +execute unless data storage rtwrapper:ui menu.safe run data modify storage rtwrapper:ui menu.safe set value "1b" +function rtwrapper:ui/open/render with storage rtwrapper:ui menu diff --git a/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/open/render.mcfunction b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/open/render.mcfunction new file mode 100644 index 0000000..7051c7c --- /dev/null +++ b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/open/render.mcfunction @@ -0,0 +1,2 @@ +# Macro-rendered inline dialog. All actions are trigger values. +$execute store success score @s rtw.temp run dialog show @s {type:"minecraft:multi_action",title:{text:"RTWrapper Menu",color:"aqua",bold:true},body:[{type:"minecraft:plain_message",contents:{text:"Storage-backed inputs are shown below. Submit action uses trigger only."}}],inputs:[{type:"minecraft:text",key:"target",label:{text:"Target"},initial:"$(target)",max_length:64},{type:"minecraft:text",key:"item",label:{text:"Item"},initial:"$(item)",max_length:128},{type:"minecraft:text",key:"count",label:{text:"Count"},initial:"$(count)",max_length:8},{type:"minecraft:text",key:"x",label:{text:"X"},initial:"$(x)",max_length:16},{type:"minecraft:text",key:"y",label:{text:"Y"},initial:"$(y)",max_length:16},{type:"minecraft:text",key:"z",label:{text:"Z"},initial:"$(z)",max_length:16},{type:"minecraft:boolean",key:"safe",label:{text:"Safe mode"},initial:true,on_true:"1b",on_false:"0b"},{type:"minecraft:single_option",key:"menu_action",label:{text:"Action"},options:[{id:"-01",display:{text:"Run current request"},initial:true},{id:"-02",display:{text:"List commands"}},{id:"-03",display:{text:"Runtoolkit manager"}},{id:"-04",display:{text:"Batch menu"}},{id:"-05",display:{text:"Selector menu"}},{id:"-06",display:{text:"Settings"}},{id:"-07",display:{text:"Preset give"}},{id:"-08",display:{text:"Preset tp"}}]}],columns:2,actions:[{label:{text:"Submit selected option",color:"green"},action:{type:"dynamic/run_command",template:"trigger RTWrapper set $(menu_action)"}},{label:{text:"Run",color:"green"},action:{type:"run_command",command:"trigger RTWrapper set 2"}},{label:{text:"Commands",color:"yellow"},action:{type:"run_command",command:"trigger RTWrapper set 3"}},{label:{text:"DP Manager",color:"gold"},action:{type:"run_command",command:"trigger RTWrapper set 4"}},{label:{text:"Batch",color:"light_purple"},action:{type:"run_command",command:"trigger RTWrapper set 5"}},{label:{text:"Selector",color:"aqua"},action:{type:"run_command",command:"trigger RTWrapper set 6"}}],exit_action:{label:{text:"Close",color:"red"}}} diff --git a/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/preset/batch.mcfunction b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/preset/batch.mcfunction new file mode 100644 index 0000000..769eaac --- /dev/null +++ b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/preset/batch.mcfunction @@ -0,0 +1,3 @@ +data modify storage rtwrapper:api batch set value {runSafeMode:1b,requests:[{req:{cmd:"say",params:{message:"RTWrapper batch item 1"},runSafeMode:1b},args:[]},{req:{cmd:"say",params:{message:"RTWrapper batch item 2"},runSafeMode:1b},args:[]}]} +tellraw @s [{"text":"[RTWrapper] Preset batch set. Use function rtwrapper:api/run_many.","color":"gold"}] +scoreboard players set @s rtw.temp 1 diff --git a/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/preset/give.mcfunction b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/preset/give.mcfunction new file mode 100644 index 0000000..0bf9cc6 --- /dev/null +++ b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/preset/give.mcfunction @@ -0,0 +1,3 @@ +data modify storage rtwrapper:api request set value {cmd:"give",params:{target:"@s",item:"minecraft:stone",count:"1"},runSafeMode:1b} +tellraw @s [{"text":"[RTWrapper] Preset request set: give @s minecraft:stone 1. Use trigger RTWrapper set 2 to run.","color":"gold"}] +scoreboard players set @s rtw.temp 1 diff --git a/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/preset/tp.mcfunction b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/preset/tp.mcfunction new file mode 100644 index 0000000..e461412 --- /dev/null +++ b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/preset/tp.mcfunction @@ -0,0 +1,3 @@ +data modify storage rtwrapper:api request set value {cmd:"tp",params:{target:"@s",x:"0",y:"80",z:"0"},runSafeMode:1b} +tellraw @s [{"text":"[RTWrapper] Preset request set: tp @s 0 80 0. Use trigger RTWrapper set 2 to run.","color":"gold"}] +scoreboard players set @s rtw.temp 1 diff --git a/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector.mcfunction b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector.mcfunction new file mode 100644 index 0000000..ac0a603 --- /dev/null +++ b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector.mcfunction @@ -0,0 +1,2 @@ +execute unless data storage rtwrapper:ui selector.value run data modify storage rtwrapper:ui selector.value set value "@s" +function rtwrapper:ui/selector/render with storage rtwrapper:ui selector diff --git a/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector/check_all_limited.mcfunction b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector/check_all_limited.mcfunction new file mode 100644 index 0000000..5786e24 --- /dev/null +++ b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector/check_all_limited.mcfunction @@ -0,0 +1,3 @@ +data modify storage core:selector input.value set value "@a[limit=1]" +execute store success score @s rtw.temp run function core:selector/detect +data get storage core:selector result diff --git a/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector/check_entity_player.mcfunction b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector/check_entity_player.mcfunction new file mode 100644 index 0000000..eaa69ce --- /dev/null +++ b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector/check_entity_player.mcfunction @@ -0,0 +1,3 @@ +data modify storage core:selector input.value set value "@e[type=player,limit=1]" +execute store success score @s rtw.temp run function core:selector/detect +data get storage core:selector result diff --git a/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector/check_player_name.mcfunction b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector/check_player_name.mcfunction new file mode 100644 index 0000000..7230edb --- /dev/null +++ b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector/check_player_name.mcfunction @@ -0,0 +1,3 @@ +data modify storage core:selector input.value set value "Steve" +execute store success score @s rtw.temp run function core:selector/detect +data get storage core:selector result diff --git a/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector/check_self.mcfunction b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector/check_self.mcfunction new file mode 100644 index 0000000..c9b80fc --- /dev/null +++ b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector/check_self.mcfunction @@ -0,0 +1,3 @@ +data modify storage core:selector input.value set value "@s" +execute store success score @s rtw.temp run function core:selector/detect +data get storage core:selector result diff --git a/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector/render.mcfunction b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector/render.mcfunction new file mode 100644 index 0000000..23abf78 --- /dev/null +++ b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/selector/render.mcfunction @@ -0,0 +1,2 @@ +$dialog show @s {type:"minecraft:multi_action",title:{text:"Core Selector Tools",color:"aqua",bold:true},body:[{type:"minecraft:plain_message",contents:{text:"Selector input is shown from storage and checked by core:selector/detect."}}],inputs:[{type:"minecraft:text",key:"selector_value",label:{text:"Selector"},initial:"$(value)",max_length:128},{type:"minecraft:single_option",key:"selector_action",label:{text:"Action"},options:[{id:"-020",display:{text:"Check @s"},initial:true},{id:"-021",display:{text:"Check limited @a"}},{id:"-022",display:{text:"Check limited @e player"}},{id:"-023",display:{text:"Check player name"}}]}],columns:2,actions:[{label:{text:"Submit selected option",color:"green"},action:{type:"dynamic/run_command",template:"trigger RTWrapper set $(selector_action)"}},{label:{text:"Check @s",color:"green"},action:{type:"run_command",command:"trigger RTWrapper set 20"}},{label:{text:"Check @a limited",color:"green"},action:{type:"run_command",command:"trigger RTWrapper set 21"}},{label:{text:"Check @e player",color:"green"},action:{type:"run_command",command:"trigger RTWrapper set 22"}},{label:{text:"Check player name",color:"yellow"},action:{type:"run_command",command:"trigger RTWrapper set 23"}},{label:{text:"Back",color:"aqua"},action:{type:"run_command",command:"trigger RTWrapper set 1"}}],exit_action:{label:{text:"Close"}}} +scoreboard players set @s rtw.temp 1 diff --git a/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/settings.mcfunction b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/settings.mcfunction new file mode 100644 index 0000000..1796ff1 --- /dev/null +++ b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/settings.mcfunction @@ -0,0 +1,2 @@ +dialog show @s {type:"minecraft:multi_action",title:{text:"RTWrapper Settings",color:"gold",bold:true},body:[{type:"minecraft:plain_message",contents:{text:"All buttons dispatch through trigger values."}}],inputs:[{type:"minecraft:boolean",key:"safe",label:{text:"Prefer runSafeMode"},initial:true,on_true:"1b",on_false:"0b"},{type:"minecraft:single_option",key:"settings_action",label:{text:"Setting action"},options:[{id:"-010",display:{text:"Debug ON"},initial:true},{id:"-011",display:{text:"Debug OFF"}},{id:"-012",display:{text:"Silent ON"}},{id:"-013",display:{text:"Silent OFF"}},{id:"-014",display:{text:"Autotick ON"}},{id:"-015",display:{text:"Autotick OFF"}},{id:"-016",display:{text:"Safe preset"}},{id:"-017",display:{text:"Disable testMode"}}]}],columns:2,actions:[{label:{text:"Submit selected option",color:"green"},action:{type:"dynamic/run_command",template:"trigger RTWrapper set $(settings_action)"}},{label:{text:"Debug ON",color:"green"},action:{type:"run_command",command:"trigger RTWrapper set 10"}},{label:{text:"Debug OFF",color:"red"},action:{type:"run_command",command:"trigger RTWrapper set 11"}},{label:{text:"Silent ON",color:"green"},action:{type:"run_command",command:"trigger RTWrapper set 12"}},{label:{text:"Silent OFF",color:"red"},action:{type:"run_command",command:"trigger RTWrapper set 13"}},{label:{text:"Autotick ON",color:"green"},action:{type:"run_command",command:"trigger RTWrapper set 14"}},{label:{text:"Autotick OFF",color:"red"},action:{type:"run_command",command:"trigger RTWrapper set 15"}},{label:{text:"Safe preset",color:"yellow"},action:{type:"run_command",command:"trigger RTWrapper set 16"}},{label:{text:"Disable testMode",color:"dark_red"},action:{type:"run_command",command:"trigger RTWrapper set 17"}},{label:{text:"Back",color:"aqua"},action:{type:"run_command",command:"trigger RTWrapper set 1"}}],exit_action:{label:{text:"Close"}}} +scoreboard players set @s rtw.temp 1 diff --git a/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/settings/safe.mcfunction b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/settings/safe.mcfunction new file mode 100644 index 0000000..b82ec0d --- /dev/null +++ b/datapack/RTWrapper-Datapack/data/rtwrapper/function/ui/settings/safe.mcfunction @@ -0,0 +1,3 @@ +data modify storage rtwrapper:settings request_defaults set value {runSafeMode:1b} +tellraw @s [{"text":"[RTWrapper] Recommended default noted: runSafeMode=1b","color":"gold"}] +scoreboard players set @s rtw.temp 1 diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/advancement/packs/rtwrapper.json b/datapack/RTWrapper-Datapack/data/runtoolkit/advancement/packs/rtwrapper.json index 46040bb..164e2ab 100644 --- a/datapack/RTWrapper-Datapack/data/runtoolkit/advancement/packs/rtwrapper.json +++ b/datapack/RTWrapper-Datapack/data/runtoolkit/advancement/packs/rtwrapper.json @@ -15,7 +15,7 @@ "color": "gray" }, { - "text": "RTWrapper 1.0.2+26.2", + "text": "RTWrapper 1.0.3+26.2", "color": "green" }, { diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/dpman.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/dpman.mcfunction index a55c88c..6324e5e 100644 --- a/datapack/RTWrapper-Datapack/data/runtoolkit/function/dpman.mcfunction +++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/dpman.mcfunction @@ -1,7 +1,5 @@ -# Dialog-free Runtoolkit datapack manager entrypoint. -tellraw @s [{"text":"[Runtoolkit] Datapack Manager","color":"gold","bold":true}] -function runtoolkit:api/list -tellraw @s [{"text":"Commands:","color":"yellow"}] -tellraw @s [{"text":" data modify storage runtoolkit:api request set value {id:\"rtwrapper\"}","color":"gray"}] -tellraw @s [{"text":" function runtoolkit:api/enable | disable | reload","color":"gray"}] -tellraw @s [{"text":" function runtoolkit:api/reload_all / enable_all / disable_all / dump_registry","color":"gray"}] +# Runtoolkit datapack manager menu. Dialog mode needs rtwrapper.testMode; otherwise chat fallback. +execute unless entity @s[tag=rtwrapper.testMode] run function runtoolkit:api/list +execute unless entity @s[tag=rtwrapper.testMode] run tellraw @s [{"text":"[Runtoolkit] Use function rtwrapper:api/testmode/on for dialog menu.","color":"yellow"}] +execute if entity @s[tag=rtwrapper.testMode] run dialog show @s {type:"minecraft:multi_action",title:{text:"Runtoolkit Manager",color:"gold",bold:true},body:[{type:"minecraft:plain_message",contents:{text:"All actions dispatch through RTWrapper trigger values."}}],inputs:[{type:"minecraft:single_option",key:"dp_action",label:{text:"Manager action"},options:[{id:"-027",display:{text:"List packs"},initial:true},{id:"-028",display:{text:"Dump registry"}},{id:"-024",display:{text:"Enable RTWrapper"}},{id:"-025",display:{text:"Disable RTWrapper"}},{id:"-026",display:{text:"Reload RTWrapper"}},{id:"-029",display:{text:"Reload all"}}]}],columns:2,actions:[{label:{text:"Submit selected option",color:"green"},action:{type:"dynamic/run_command",template:"trigger RTWrapper set $(dp_action)"}},{label:{text:"List packs",color:"yellow"},action:{type:"run_command",command:"trigger RTWrapper set 27"}},{label:{text:"Dump registry",color:"gray"},action:{type:"run_command",command:"trigger RTWrapper set 28"}},{label:{text:"Enable RTWrapper",color:"green"},action:{type:"run_command",command:"trigger RTWrapper set 24"}},{label:{text:"Disable RTWrapper",color:"red"},action:{type:"run_command",command:"trigger RTWrapper set 25"}},{label:{text:"Reload RTWrapper",color:"aqua"},action:{type:"run_command",command:"trigger RTWrapper set 26"}},{label:{text:"Reload all",color:"light_purple"},action:{type:"run_command",command:"trigger RTWrapper set 29"}},{label:{text:"Back",color:"aqua"},action:{type:"run_command",command:"trigger RTWrapper set 1"}}],exit_action:{label:{text:"Close"}}} +execute if entity @s[tag=rtwrapper.testMode] run scoreboard players set @s rtw.temp 1 diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/dpman/disable_rtwrapper.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/dpman/disable_rtwrapper.mcfunction new file mode 100644 index 0000000..08ee5de --- /dev/null +++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/dpman/disable_rtwrapper.mcfunction @@ -0,0 +1,2 @@ +data modify storage runtoolkit:api request set value {id:"rtwrapper"} +function runtoolkit:api/disable diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/dpman/enable_rtwrapper.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/dpman/enable_rtwrapper.mcfunction new file mode 100644 index 0000000..7a86cd7 --- /dev/null +++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/dpman/enable_rtwrapper.mcfunction @@ -0,0 +1,2 @@ +data modify storage runtoolkit:api request set value {id:"rtwrapper"} +function runtoolkit:api/enable diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/dpman/reload_rtwrapper.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/dpman/reload_rtwrapper.mcfunction new file mode 100644 index 0000000..0679d0b --- /dev/null +++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/dpman/reload_rtwrapper.mcfunction @@ -0,0 +1,2 @@ +data modify storage runtoolkit:api request set value {id:"rtwrapper"} +function runtoolkit:api/reload diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/check_dependencies.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/check_dependencies.mcfunction index 1dc509e..ed2d6d8 100644 --- a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/check_dependencies.mcfunction +++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/check_dependencies.mcfunction @@ -1,13 +1,21 @@ # RTWrapper dependency check. -# Hard dependency for selector-string helpers: StringLib by CMDred. +# Dependency for selector-string helpers: StringLib by CMDred. data modify storage runtoolkit:runtime missing_dependencies set value [] scoreboard players set #dependency_errors rtk.status 0 -scoreboard players set rtwrapper rtk.loaded 0 - +scoreboard players set #rtwrapper_dependency_ok rtk.status 0 scoreboard players set stringlib rtk.registered 1 scoreboard players set stringlib rtk.enabled 0 -data modify storage stringlib:input find set value {String:"@p",Find:"@",n:1} + +data modify storage runtoolkit:state packs.rtwrapper.dependencies set value {stringlib:"missing"} +data modify storage runtoolkit:state packs.rtwrapper.dependency_ok set value 0b + +data modify storage stringlib:input find set value {String:"@s",Find:"@",n:1} execute store success score stringlib rtk.enabled run function stringlib:util/find +execute if score stringlib rtk.enabled matches 1.. run scoreboard players set #rtwrapper_dependency_ok rtk.status 1 +execute if score stringlib rtk.enabled matches 1.. run data modify storage runtoolkit:state packs.rtwrapper.dependencies.stringlib set value "detected" +execute if score stringlib rtk.enabled matches 1.. run data modify storage runtoolkit:state packs.rtwrapper.dependency_ok set value 1b execute if score stringlib rtk.enabled matches 1.. run data modify storage runtoolkit:registry packs.stringlib set value {id:"stringlib",name:"StringLib",namespace:"stringlib",kind:"dependency",source:"https://github.com/CMDred/StringLib",provided_by:"CMDred",status:"detected"} + execute unless score stringlib rtk.enabled matches 1.. run scoreboard players add #dependency_errors rtk.status 1 execute unless score stringlib rtk.enabled matches 1.. run data modify storage runtoolkit:runtime missing_dependencies append value "stringlib" +execute unless score stringlib rtk.enabled matches 1.. run data modify storage runtoolkit:registry packs.stringlib set value {id:"stringlib",name:"StringLib",namespace:"stringlib",kind:"dependency",source:"https://github.com/CMDred/StringLib",provided_by:"CMDred",status:"missing"} diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/disable.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/disable.mcfunction index ff5a6a7..b29b19d 100644 --- a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/disable.mcfunction +++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/disable.mcfunction @@ -1,5 +1,15 @@ # Disable RTWrapper manager hooks. Functions remain present, but the global -# manager will stop running RTWrapper load/tick hooks. +# manager stops running RTWrapper-managed load/tick hooks. scoreboard players set rtwrapper rtk.enabled 0 scoreboard players set rtwrapper rtk.loaded 0 -tellraw @a [{"text":"[Runtoolkit] Disabled RTWrapper manager hooks","color":"yellow"}] +scoreboard players add #rtwrapper_disables rtk.status 1 +scoreboard players set #auto_tick rtw.config 0 + +data modify storage runtoolkit:state packs.rtwrapper.enabled set value 0b +data modify storage runtoolkit:state packs.rtwrapper.loaded set value 0b +data modify storage runtoolkit:state packs.rtwrapper.status set value "disabled" +data modify storage runtoolkit:state packs.rtwrapper.last_action set value "disable" +data modify storage rtwrapper:runtime config.auto_tick set value 0b +data modify storage rtwrapper:runtime queue set value [] +data remove storage rtwrapper:runtime current +execute if score #silent rtw.config matches 0 run tellraw @a [{"text":"[Runtoolkit] Disabled RTWrapper manager hooks and cleared runtime queue","color":"yellow"}] diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/enable.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/enable.mcfunction index 5c5b30b..ba799df 100644 --- a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/enable.mcfunction +++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/enable.mcfunction @@ -1,5 +1,8 @@ -# Enable RTWrapper manager hooks. This does not run /datapack enable; it controls -# Runtoolkit-managed execution hooks. +# Enable RTWrapper manager hooks. This does not call vanilla /datapack enable. scoreboard players set rtwrapper rtk.enabled 1 +scoreboard players add #rtwrapper_enables rtk.status 1 +data modify storage runtoolkit:state packs.rtwrapper.enabled set value 1b +data modify storage runtoolkit:state packs.rtwrapper.last_action set value "enable" +data modify storage runtoolkit:state packs.rtwrapper.status set value "enabling" function runtoolkit:packs/rtwrapper/load -tellraw @a [{"text":"[Runtoolkit] Enabled RTWrapper","color":"green"}] +execute if score #silent rtw.config matches 0 run tellraw @a [{"text":"[Runtoolkit] Enabled RTWrapper manager hooks","color":"green"}] diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/list.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/list.mcfunction index 44dcc45..01a5322 100644 --- a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/list.mcfunction +++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/list.mcfunction @@ -1,5 +1,9 @@ -# Dynamic list row for RTWrapper. -execute if score rtwrapper rtk.enabled matches 1.. run tellraw @s [{"text":" - RTWrapper ","color":"aqua"},{"text":"enabled","color":"green"},{"text":" v1.0.2+26.2","color":"gray"},{"text":" deps:","color":"dark_gray"},{"text":" StringLib","color":"yellow"}] -execute unless score rtwrapper rtk.enabled matches 1.. run tellraw @s [{"text":" - RTWrapper ","color":"aqua"},{"text":"disabled","color":"red"},{"text":" v1.0.2+26.2","color":"gray"}] +# Dynamic list row for RTWrapper. Also refreshes a machine-readable list row. +data modify storage runtoolkit:runtime list.rtwrapper set from storage runtoolkit:state packs.rtwrapper +execute if score rtwrapper rtk.enabled matches 1.. if score rtwrapper rtk.loaded matches 1.. run data modify storage runtoolkit:runtime list.rtwrapper.display_status set value "enabled_loaded" +execute if score rtwrapper rtk.enabled matches 1.. unless score rtwrapper rtk.loaded matches 1.. run data modify storage runtoolkit:runtime list.rtwrapper.display_status set value "enabled_not_loaded" +execute unless score rtwrapper rtk.enabled matches 1.. run data modify storage runtoolkit:runtime list.rtwrapper.display_status set value "disabled" +execute if score rtwrapper rtk.enabled matches 1.. run tellraw @s [{"text":" - RTWrapper ","color":"aqua"},{"text":"enabled","color":"green"},{"text":" v1.0.3+26.2","color":"gray"},{"text":" deps:","color":"dark_gray"},{"text":" StringLib","color":"yellow"}] +execute unless score rtwrapper rtk.enabled matches 1.. run tellraw @s [{"text":" - RTWrapper ","color":"aqua"},{"text":"disabled","color":"red"},{"text":" v1.0.3+26.2","color":"gray"}] execute if score stringlib rtk.enabled matches 1.. run tellraw @s [{"text":" dependency StringLib: ","color":"gray"},{"text":"detected","color":"green"}] execute unless score stringlib rtk.enabled matches 1.. run tellraw @s [{"text":" dependency StringLib: ","color":"gray"},{"text":"missing","color":"red"},{"text":" https://github.com/CMDred/StringLib","color":"yellow"}] diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/load.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/load.mcfunction index d2d0cac..2167ee3 100644 --- a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/load.mcfunction +++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/load.mcfunction @@ -1,8 +1,14 @@ -# Load RTWrapper manager hooks. Core bootstrap always runs so trigger/objectives -# exist even when optional managed dependencies are missing; dependency status is -# still reported and selector helpers require StringLib. +# Load RTWrapper manager hooks. Core bootstrap runs when the manager entry is enabled. +# Missing StringLib is recorded as a dependency warning; core RTWrapper still loads. +execute if score rtwrapper rtk.enabled matches 1.. run scoreboard players add #rtwrapper_loads rtk.status 1 +execute if score rtwrapper rtk.enabled matches 1.. run data modify storage runtoolkit:state packs.rtwrapper.last_action set value "load" +execute if score rtwrapper rtk.enabled matches 1.. run data modify storage runtoolkit:state packs.rtwrapper.status set value "loading" execute if score rtwrapper rtk.enabled matches 1.. run function runtoolkit:packs/rtwrapper/check_dependencies execute if score rtwrapper rtk.enabled matches 1.. run function rtwrapper:core/load -execute if score rtwrapper rtk.enabled matches 1.. if score #dependency_errors rtk.status matches 0 run scoreboard players set rtwrapper rtk.loaded 1 -execute if score rtwrapper rtk.enabled matches 1.. unless score #dependency_errors rtk.status matches 0 run scoreboard players set rtwrapper rtk.loaded 0 -execute if score rtwrapper rtk.enabled matches 1.. unless score #dependency_errors rtk.status matches 0 run tellraw @a [{"text":"[Runtoolkit] RTWrapper dependency warning: ","color":"yellow"},{"nbt":"missing_dependencies","storage":"runtoolkit:runtime","color":"red"},{"text":". Selector detection helpers need StringLib.","color":"gray"}] +execute if score rtwrapper rtk.enabled matches 1.. run scoreboard players set rtwrapper rtk.loaded 1 +execute if score rtwrapper rtk.enabled matches 1.. run data modify storage runtoolkit:state packs.rtwrapper.loaded set value 1b +execute if score rtwrapper rtk.enabled matches 1.. if score #dependency_errors rtk.status matches 0 run data modify storage runtoolkit:state packs.rtwrapper.status set value "loaded" +execute if score rtwrapper rtk.enabled matches 1.. unless score #dependency_errors rtk.status matches 0 run data modify storage runtoolkit:state packs.rtwrapper.status set value "loaded_with_dependency_warnings" +execute unless score rtwrapper rtk.enabled matches 1.. run scoreboard players set rtwrapper rtk.loaded 0 +execute unless score rtwrapper rtk.enabled matches 1.. run data modify storage runtoolkit:state packs.rtwrapper.loaded set value 0b +execute unless score rtwrapper rtk.enabled matches 1.. run data modify storage runtoolkit:state packs.rtwrapper.status set value "disabled" diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/register.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/register.mcfunction index 05dda5b..22cbfaa 100644 --- a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/register.mcfunction +++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/register.mcfunction @@ -3,8 +3,16 @@ scoreboard objectives add rtk.registered dummy scoreboard objectives add rtk.enabled dummy scoreboard objectives add rtk.loaded dummy scoreboard objectives add rtk.status dummy +scoreboard objectives add rtw.config dummy +scoreboard objectives add rtw.status dummy +scoreboard objectives add rtw.temp dummy scoreboard players set rtwrapper rtk.registered 1 execute unless score rtwrapper rtk.enabled matches 0.. run scoreboard players set rtwrapper rtk.enabled 1 +scoreboard players set #rtwrapper_dependency_ok rtk.status 0 +scoreboard players add #rtwrapper_registers rtk.status 1 -data modify storage runtoolkit:registry packs.rtwrapper set value {id:"rtwrapper",name:"RTWrapper",version:"1.0.2+26.2",namespace:"rtwrapper",kind:"datapack",advancement:"runtoolkit:packs/rtwrapper",dependencies:["stringlib"],hooks:{register:"runtoolkit:packs/rtwrapper/register",load:"runtoolkit:packs/rtwrapper/load",tick:"runtoolkit:packs/rtwrapper/tick",list:"runtoolkit:packs/rtwrapper/list",enable:"runtoolkit:packs/rtwrapper/enable",disable:"runtoolkit:packs/rtwrapper/disable",reload:"runtoolkit:packs/rtwrapper/reload",check_dependencies:"runtoolkit:packs/rtwrapper/check_dependencies"}} +data modify storage runtoolkit:state packs.rtwrapper set value {id:"rtwrapper",registered:1b,enabled:1b,loaded:0b,dependency_ok:0b,status:"registered",last_action:"register",version:"1.0.3+26.2"} +execute unless score rtwrapper rtk.enabled matches 1.. run data modify storage runtoolkit:state packs.rtwrapper.enabled set value 0b + +data modify storage runtoolkit:registry packs.rtwrapper set value {id:"rtwrapper",name:"RTWrapper",version:"1.0.3+26.2",namespace:"rtwrapper",kind:"datapack",advancement:"runtoolkit:packs/rtwrapper",dependencies:["stringlib"],state_storage:"runtoolkit:state packs.rtwrapper",hooks:{register:"runtoolkit:packs/rtwrapper/register",load:"runtoolkit:packs/rtwrapper/load",tick:"runtoolkit:packs/rtwrapper/tick",list:"runtoolkit:packs/rtwrapper/list",enable:"runtoolkit:packs/rtwrapper/enable",disable:"runtoolkit:packs/rtwrapper/disable",reload:"runtoolkit:packs/rtwrapper/reload",check_dependencies:"runtoolkit:packs/rtwrapper/check_dependencies"}} diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/reload.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/reload.mcfunction index 40a9fce..7f99f36 100644 --- a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/reload.mcfunction +++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/reload.mcfunction @@ -1,4 +1,7 @@ # Reload RTWrapper through the manager. +scoreboard players add #rtwrapper_reloads rtk.status 1 +data modify storage runtoolkit:state packs.rtwrapper.last_action set value "reload" +data modify storage runtoolkit:state packs.rtwrapper.status set value "reloading" function runtoolkit:packs/rtwrapper/register function runtoolkit:packs/rtwrapper/load -tellraw @a [{"text":"[Runtoolkit] Reloaded RTWrapper","color":"aqua"}] +execute if score #silent rtw.config matches 0 run tellraw @a [{"text":"[Runtoolkit] Reloaded RTWrapper manager state","color":"aqua"}] diff --git a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/tick.mcfunction b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/tick.mcfunction index 512eeb5..1ec7f9d 100644 --- a/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/tick.mcfunction +++ b/datapack/RTWrapper-Datapack/data/runtoolkit/function/packs/rtwrapper/tick.mcfunction @@ -1,2 +1,4 @@ # Managed tick hook for RTWrapper. -execute if score rtwrapper rtk.enabled matches 1.. run function rtwrapper:core/tick +execute if score rtwrapper rtk.enabled matches 1.. if score rtwrapper rtk.loaded matches 1.. run scoreboard players add #rtwrapper_ticks rtk.status 1 +execute if score rtwrapper rtk.enabled matches 1.. if score rtwrapper rtk.loaded matches 1.. store result storage runtoolkit:state packs.rtwrapper.ticks int 1 run scoreboard players get #rtwrapper_ticks rtk.status +execute if score rtwrapper rtk.enabled matches 1.. if score rtwrapper rtk.loaded matches 1.. run function rtwrapper:core/tick diff --git a/docs/API.md b/docs/API.md index 78a3e7d..6b66819 100644 --- a/docs/API.md +++ b/docs/API.md @@ -105,6 +105,18 @@ Manager hooks: #runtoolkit:reload ``` +RTWrapper's manager hooks are stateful and do more than print text. They maintain: + +```text +storage runtoolkit:state packs.rtwrapper +storage runtoolkit:runtime list.rtwrapper +storage runtoolkit:runtime missing_dependencies +scoreboard rtk.enabled / rtk.loaded / rtk.status +``` + +`disable` also disables `#auto_tick` and clears `storage rtwrapper:runtime queue` so disabled manager hooks cannot continue processing queued work. + + Enable/disable/reload one managed pack: ```mcfunction @@ -127,6 +139,28 @@ function runtoolkit:api/require The Runtoolkit advancement registry uses `minecraft:tick` and is never revoked. -## Removed UI systems +## Restored trigger menus + +RTWrapper provides an opt-in menu system gated behind `rtwrapper.testMode`. -RTWrapper no longer provides the experimental dialog UI, `rtwrapper.testMode`, or the `RTWrapper` trigger objective. Use command functions directly. +```mcfunction +function rtwrapper:api/testmode/on +trigger RTWrapper set 1 +``` + +Trigger values: + +```mcfunction +trigger RTWrapper set 1 # RTWrapper main menu +trigger RTWrapper set 2 # Run current request +trigger RTWrapper set 3 # List wrappers in chat +trigger RTWrapper set 4 # Runtoolkit manager menu +trigger RTWrapper set 5 # Batch request menu +trigger RTWrapper set 6 # core:selector tools menu +``` + +The menus use inline `dialog show` screens and are wired to current APIs: `core:selector/detect`, `rtwrapper:api/run_many`, `runSafeMode`, and `runtoolkit:dpman`. The dialogs use input controls (`text`, `boolean`, `single_option`). Storage-backed menus render current defaults through macro functions, and every dialog action dispatches through `trigger RTWrapper set ...`; option ids use the `-0` form such as `-01`, `-010`, `-024`. Disable access: + +```mcfunction +function rtwrapper:api/testmode/off +``` diff --git a/gradle.properties b/gradle.properties index 1abd045..71a1ec2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ loader_version=0.19.3 fabric_version=0.153.0+26.2 # Mod metadata -mod_version=1.0.2+26.2 +mod_version=1.0.3+26.2 maven_group=com.runtoolkit archives_base_name=rtwrapper diff --git a/gradlew b/gradlew old mode 100755 new mode 100644 diff --git a/scripts/validate_datapack.py b/scripts/validate_datapack.py index 1402f7f..1011168 100644 --- a/scripts/validate_datapack.py +++ b/scripts/validate_datapack.py @@ -87,17 +87,30 @@ def main() -> None: core_load = (PACK / 'data' / 'rtwrapper' / 'function' / 'core' / 'load.mcfunction').read_text(encoding='utf-8') if 'scoreboard objectives add rtw.temp dummy' not in core_load: fail('rtwrapper:core/load must create rtw.temp') - if 'scoreboard objectives add RTWrapper trigger' in core_load: - fail('RTWrapper trigger objective must not be present after removing in-game trigger UI') + if 'scoreboard objectives add RTWrapper trigger' not in core_load: + fail('rtwrapper:core/load must create RTWrapper trigger for restored menu system') core_tick = (PACK / 'data' / 'rtwrapper' / 'function' / 'core' / 'tick.mcfunction').read_text(encoding='utf-8') - if 'rtwrapper:trigger/' in core_tick or 'scores={RTWrapper=' in core_tick: - fail('rtwrapper:core/tick must not process removed RTWrapper trigger UI') - - for forbidden in ['dialog show', 'rtwrapper.testMode', 'trigger RTWrapper', 'RTWrapper trigger']: - for path in PACK.rglob('*.mcfunction'): - if forbidden in path.read_text(encoding='utf-8'): - fail(f'forbidden removed UI/testMode token {forbidden!r} in {path.relative_to(ROOT)}') + if 'rtwrapper:trigger/handle' not in core_tick or 'scores={RTWrapper=1..}' not in core_tick: + fail('rtwrapper:core/tick must process RTWrapper trigger menu actions') + + for function in [ + PACK / 'data' / 'rtwrapper' / 'function' / 'api' / 'testmode' / 'on.mcfunction', + PACK / 'data' / 'rtwrapper' / 'function' / 'api' / 'testmode' / 'off.mcfunction', + PACK / 'data' / 'rtwrapper' / 'function' / 'trigger' / 'handle.mcfunction', + PACK / 'data' / 'rtwrapper' / 'function' / 'trigger' / 'run_request.mcfunction', + PACK / 'data' / 'rtwrapper' / 'function' / 'ui' / 'open.mcfunction', + PACK / 'data' / 'rtwrapper' / 'function' / 'ui' / 'settings.mcfunction', + PACK / 'data' / 'rtwrapper' / 'function' / 'ui' / 'batch.mcfunction', + PACK / 'data' / 'rtwrapper' / 'function' / 'ui' / 'selector.mcfunction', + PACK / 'data' / 'runtoolkit' / 'function' / 'dpman.mcfunction', + PACK / 'data' / 'core' / 'function' / 'selector' / 'detect.mcfunction', + PACK / 'data' / 'rtwrapper' / 'function' / 'api' / 'run_many.mcfunction', + PACK / 'data' / 'rtwrapper' / 'function' / 'api' / 'enqueue_many.mcfunction', + PACK / 'data' / 'rtwrapper' / 'function' / 'condition' / 'check_current.mcfunction', + ]: + if not function.exists(): + fail(f'missing restored menu/selector/batch function {function.relative_to(ROOT)}') selector_detect = (PACK / 'data' / 'core' / 'function' / 'selector' / 'detect.mcfunction').read_text(encoding='utf-8') for forbidden_selector in ['"@p"', '"@r"']: @@ -107,6 +120,35 @@ def main() -> None: if required_selector not in selector_detect: fail(f'core selector detect missing {required_selector}') + legacy_selector_namespace = ''.join(['c', 'r', 'e']) + for path in (PACK / 'data').rglob('*'): + if path.is_file() and len(path.parts) >= 2 and path.parts[-3:-1] == ('data', legacy_selector_namespace): + fail(f'legacy selector namespace must not exist; use core namespace: {path.relative_to(ROOT)}') + + menu_files = [ + PACK / 'data' / 'rtwrapper' / 'function' / 'ui' / 'open' / 'render.mcfunction', + PACK / 'data' / 'rtwrapper' / 'function' / 'ui' / 'settings.mcfunction', + PACK / 'data' / 'rtwrapper' / 'function' / 'ui' / 'batch.mcfunction', + PACK / 'data' / 'rtwrapper' / 'function' / 'ui' / 'selector' / 'render.mcfunction', + PACK / 'data' / 'runtoolkit' / 'function' / 'dpman.mcfunction', + ] + for menu_file in menu_files: + if not menu_file.exists(): + fail(f'missing dialog menu file {menu_file.relative_to(ROOT)}') + text = menu_file.read_text(encoding='utf-8') + if 'inputs:[' not in text: + fail(f'{menu_file.relative_to(ROOT)} must use dialog inputs') + if 'type:"minecraft:single_option"' not in text: + fail(f'{menu_file.relative_to(ROOT)} must expose single_option input') + if 'id:"-0' not in text: + fail(f'{menu_file.relative_to(ROOT)} options must use -0 ids') + if 'dynamic/run_command' not in text: + fail(f'{menu_file.relative_to(ROOT)} must submit selected option with dynamic/run_command') + if 'trigger RTWrapper set $(' not in text: + fail(f'{menu_file.relative_to(ROOT)} dynamic submit must call trigger RTWrapper') + if 'action:{type:"run_command",command:"function ' in text: + fail(f'{menu_file.relative_to(ROOT)} dialog actions must not run functions directly; use trigger') + rtw_register = (PACK / 'data' / 'runtoolkit' / 'function' / 'packs' / 'rtwrapper' / 'register.mcfunction').read_text(encoding='utf-8') if 'dependencies:["stringlib"]' not in rtw_register: fail('RTWrapper manager registration must declare StringLib dependency') @@ -115,6 +157,26 @@ def main() -> None: if 'stringlib:util/find' not in rtw_check: fail('RTWrapper dependency check must probe StringLib') + hook_dir = PACK / 'data' / 'runtoolkit' / 'function' / 'packs' / 'rtwrapper' + hook_requirements = { + 'register.mcfunction': ['runtoolkit:state packs.rtwrapper', 'runtoolkit:registry packs.rtwrapper', 'scoreboard players set rtwrapper rtk.registered'], + 'check_dependencies.mcfunction': ['runtoolkit:state packs.rtwrapper.dependencies', 'stringlib:util/find', 'missing_dependencies'], + 'load.mcfunction': ['runtoolkit:state packs.rtwrapper.status', 'rtwrapper:core/load', 'scoreboard players set rtwrapper rtk.loaded'], + 'enable.mcfunction': ['runtoolkit:state packs.rtwrapper.enabled set value 1b', 'runtoolkit:packs/rtwrapper/load'], + 'disable.mcfunction': ['runtoolkit:state packs.rtwrapper.enabled set value 0b', 'rtwrapper:runtime queue set value []', 'config.auto_tick set value 0b'], + 'reload.mcfunction': ['runtoolkit:state packs.rtwrapper.last_action set value "reload"', 'runtoolkit:packs/rtwrapper/register', 'runtoolkit:packs/rtwrapper/load'], + 'tick.mcfunction': ['runtoolkit:state packs.rtwrapper.ticks', 'rtwrapper:core/tick'], + 'list.mcfunction': ['runtoolkit:runtime list.rtwrapper', 'display_status'], + } + for file_name, required_fragments in hook_requirements.items(): + hook_path = hook_dir / file_name + if not hook_path.exists(): + fail(f'missing RTWrapper manager hook {hook_path.relative_to(ROOT)}') + hook_text = hook_path.read_text(encoding='utf-8') + for fragment in required_fragments: + if fragment not in hook_text: + fail(f'{hook_path.relative_to(ROOT)} is not functional enough; missing {fragment!r}') + api_run = (PACK / 'data' / 'rtwrapper' / 'function' / 'api' / 'run.mcfunction').read_text(encoding='utf-8') if 'runSafeMode' not in api_run or 'rtwrapper:core/run/run_next' not in api_run: fail('rtwrapper:api/run must support runSafeMode safe execution') @@ -214,7 +276,7 @@ def main() -> None: if MISSING_STORAGE_TEST_PATH_RE.search(line): fail(f'missing storage path before run at {rel}:{i}') - print(f'[validateDatapack] OK: {len(expected)} wrappers, {variant_count} named variants, no dialog/testMode, format=107') + print(f'[validateDatapack] OK: {len(expected)} wrappers, {variant_count} named variants, menus restored, core selector, format=107') if __name__ == '__main__': diff --git a/src/gametest/resources/fabric.mod.json b/src/gametest/resources/fabric.mod.json index 8742ade..05f476f 100644 --- a/src/gametest/resources/fabric.mod.json +++ b/src/gametest/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "rtwrapper-gametest", - "version": "1.0.2", + "version": "1.0.3", "name": "RTWrapper GameTests", "environment": "*", "entrypoints": { From e17ed51484e8fc2c55c94ea4d71102377b3afdb0 Mon Sep 17 00:00:00 2001 From: Legends11 <235496468+tickwarden@users.noreply.github.com> Date: Wed, 1 Jul 2026 16:33:12 +0000 Subject: [PATCH 2/3] Update build.gradle --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index ec60bac..81ebd88 100644 --- a/build.gradle +++ b/build.gradle @@ -44,6 +44,7 @@ sourceSets { // datapack/RTWrapper-Datapack as a separate root deliverable. srcDir 'datapack/RTWrapper-Datapack' exclude 'README.md' + exclude 'pack.png' } } } From db4b503ea487f932050f225de01410f5fcec0ac2 Mon Sep 17 00:00:00 2001 From: Legends11 <235496468+tickwarden@users.noreply.github.com> Date: Wed, 1 Jul 2026 16:34:16 +0000 Subject: [PATCH 3/3] Add pack.png --- datapack/RTWrapper-Datapack/pack.png | Bin 0 -> 1835 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 datapack/RTWrapper-Datapack/pack.png diff --git a/datapack/RTWrapper-Datapack/pack.png b/datapack/RTWrapper-Datapack/pack.png new file mode 100644 index 0000000000000000000000000000000000000000..fe9d7137933be896a21fb0ed52dc0f86349de150 GIT binary patch literal 1835 zcmV+`2h{k9P) zzi%Wp6vyAJQr}6rBdo+#k+RZ86k8uUilc*q`)epcP~Kk?3h1B!L7n21NQrdSAq`8i z(%nBW6v2zfYma|C&pf~J`&QXaKDNj2jXg8|#?!3Uo9^cNvVi~{KUsF>cTZ22aJOwk zaI1vR&+qQrpm+iRGyniYNni_lNF!n-{CK=C85RHlH`kZVYP~rKbV%?40PeOeJUv;4 z{HgF0^S&7NvO|pop@BD5@|hsKeKa`uVzu6MzDAs$ou{-C(eP_6Tz1R3jp_(A}06%0A1HX(*)m=3ZIGBW96E*Rm>NzLUiz-zyFGEgc8?I zzr6SudWGfcL&}PKo{3DLHGyRo){h^ zfa~nf)d=CI=T$6E&(05$AZi4_G(z}tcs&V{5+Fw-gfAlr7MN8i>Vps-p9DuL6H-^9 zR3lQaZd3SIKmV}*`QpoOz5J)&yxRZ#=JkcQezW``bzL`DzE2eWr)vR#Uyq(Lll9=J z&qKT(9NTBJep~rN3Mt z0#|TcN#MIm4=vwSp88yB|Cu^i3^E@Db6o%tzR#-#A=4n@y$0Zt$-<}cK^K9gAB6CJ z-lgEXfD#Tu`22S_;s>aR2RL*FML!3iJ_zCSnnI2+jj+uvzyJAba5*oYzf7r~d;x_! zuP*>5B|wfw0N`$Ms5>z?AA92DN&@i%RLtLPTUc;d1r&Zf{s^EyC#2}NKYmGW06=-e zF$EtZbGmr({AF_e+57-lQJ)FaJXS^c0kEPD0yU3S5qE90 ze!qk{nUcpUrhaDva5{)N@V1jg@iET`V(TBA0=Nxl!pHNY`vCyTw3l(>G4jQ1bg->(Ifk_4_1#kWyIjBNk!$8GH(7e6aM0CoKw`PumasO#s(PvQrN)!0kX zzD=OG4(BQSX!`?T#l3zm{H*-|)b(@VXYU8Vs)Qh7;@*Do17r~Q_KP1NgSfX}`~d%nd;2jGKfnxl0PzC| zkKkp0fXew<`2nWnZBG|DwO?s=et@Zyz)S>A?FSg?eF0c;>qO2;Q2qV@xx9v|9Az+} zUO)=vXYB`|Xum!!P`6+F0Dyl^k*b_YfRV5MD)tAUk{S)D+dq^f2Df3}p^lsstM}jF7@~&aZ_M6)RXMbNn>AXH2 zV1i)YKKcT$tE42T)(?<#IF1Sa81<(}CBadSSI4J{^GE{l|Eud$Rl-Ohet<;YeBw8C z{kp^tAiVeigcm=6@Ztv$Ui<*UNAa`WA3*ppUi<)+^Hul(xbqnK>Swb*z})$i*TTfq z@6sfG0N26AyiAHi5Xa=l(xiR>tV$S;sUQ1dMZP}(R@6bD=CLYbe*mnggFww=r6)m> zAq1d5r|ENf%*71nIhm4I{f((#_6HC?pC5p8C)Ca#0UR0yQyal?I4y<${If4e>d*GR z0M&@t7e$*q=OA+Av-$z3hcn>|@B?t{gqrzL`~ciKp=N$GKY;K&_)+};!k5pF?gtRQ zY`%*90fd+L1ys+wRNejnHS+)k_yL5cUjQQa0|;ME63G4lmGa^T5MKNM!e`nafchYW zPv;Nz2Y7pX1poji%V(1{Lillc6-yOcT?c*u842p*7rXnmN8D{&`0#!Q0P&+hY9oXn zj~_bwclT{$y$#fzL6QV~`H