Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
@@ -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
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<number>` form such as `-01`, `-010`, `-024`. Disable menu access:

```mcfunction
function rtwrapper:api/testmode/off
```

## Build

Expand Down
708 changes: 0 additions & 708 deletions RTWrapper-manager.patch

This file was deleted.

1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ sourceSets {
// datapack/RTWrapper-Datapack as a separate root deliverable.
srcDir 'datapack/RTWrapper-Datapack'
exclude 'README.md'
exclude 'pack.png'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tag @s remove rtwrapper.testMode
tellraw @s [{"text":"[RTWrapper] testMode disabled","color":"gold"}]
Original file line number Diff line number Diff line change
@@ -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"}]
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"}]
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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"}]
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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"}]
Original file line number Diff line number Diff line change
@@ -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
Loading