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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

18 changes: 5 additions & 13 deletions data/datalib/function/systems/dev_settings/display/open.mcfunction
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
# datalib:systems/dev_settings/display/open
# Builds the Dev Settings written book in datalib:temp and gives it to @s.
# Called by the chat link in datalib:systems/dev_settings/menu.
# Page routing is driven by the player's dl.dev_pg2 score.
# Clears any existing settings book then dispatches to the correct page function.
# Page functions give the book directly via item replace — no storage intermediate.

execute unless function datalib:debug/tools/utils/perm_check run return 0

# Reset page-2 cursor to slot 1 (version) if not already set
# Reset cursor if out of range
execute unless score @s dl.dev_pg2 matches 1..2 run scoreboard players set @s dl.dev_pg2 1

# Clear any existing settings book from the player
# Clear existing book
clear @s minecraft:written_book[custom_data={datalib_dev_settings:1b}]

# Dispatch page render — writes the page JSON into datalib:temp dev_settings_pages
# Dispatch — each page function does its own item replace
execute as @s[scores={dl.dev_pg2=1}] run function datalib:systems/dev_settings/display/page/version
execute as @s[scores={dl.dev_pg2=2}] run function datalib:systems/dev_settings/display/page/devmode

# Give the book using the standard give command with component syntax
# Pages are written by page/* functions into datalib:temp dev_settings_pages
function datalib:systems/dev_settings/display/internal/give_book

# Cleanup
data remove storage datalib:temp dev_settings_pages
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
# datalib:systems/dev_settings/display/page/devmode
# Builds the devMode toggle page SNBT into datalib:temp dev_settings_pages.
# Reads datalib:engine dev_settings.devMode (0b = disabled, 1b = enabled).
# devMode toggle page — single page, all components in {"text":"","extra":[...]}.

execute store result score #dl.dsm dl.tmp run data get storage datalib:engine dev_settings.devMode

# devMode ENABLED (score == 1)
execute if score #dl.dsm dl.tmp matches 1 run data modify storage datalib:temp dev_settings_pages set value '{"text":""},{"text":" -","bold":true},{"text":"Dev Settings","color":"gold","bold":true},{"text":"-","bold":true},{"text":"\\n\\n\\n"},{"text":"Toggle Type:"},{"text":"\\n"},{"text":" - "},{"text":"[Misc]","color":"light_purple"},{"text":"\\n\\n\\n\\n"},{"text":"Misc Settings:"},{"text":"\\n"},{"text":" ◄ ","color":"dark_aqua","hover_event":{"action":"show_text","value":" "},"click_event":{"action":"run_command","command":"/function datalib:systems/dev_settings/display/nav/left"}},{"text":"[devMode]","color":"#2DD158","hover_event":{"action":"show_text","value":"Status: Enabled"},"click_event":{"action":"run_command","command":"/function datalib:systems/dev_settings/actions/toggle_devmode"}},{"text":" ► ","color":"dark_aqua","hover_event":{"action":"show_text","value":" "},"click_event":{"action":"run_command","command":"/function datalib:systems/dev_settings/display/nav/right"}},{"text":"\\n\\n\\n\\n"},{"text":" "},{"text":"[Close]","color":"red","hover_event":{"action":"show_text","value":"Delete Book"},"click_event":{"action":"run_command","command":"/function datalib:systems/dev_settings/display/close"}}'
execute if score #dl.dsm dl.tmp matches 1 run item replace entity @s weapon.mainhand with minecraft:written_book[minecraft:written_book_content={author:"",title:"",pages:['{"text":"","extra":[{"text":" -","bold":true},{"text":"Dev Settings","color":"gold","bold":true},{"text":"-","bold":true},{"text":"\n\n\n"},{"text":"Toggle Type:"},{"text":"\n"},{"text":" - "},{"text":"[Misc]","color":"light_purple"},{"text":"\n\n\n\n"},{"text":"Misc Settings:"},{"text":"\n"},{"text":" \u25c4 ","color":"dark_aqua","hoverEvent":{"action":"show_text","value":[{"text":" "}]},"clickEvent":{"action":"run_command","value":"/function datalib:systems/dev_settings/display/nav/left"}},{"text":"[devMode]","color":"#2DD158","hoverEvent":{"action":"show_text","value":[{"text":"Status: Enabled"}]},"clickEvent":{"action":"run_command","value":"/function datalib:systems/dev_settings/actions/toggle_devmode"}},{"text":" \u25ba ","color":"dark_aqua","hoverEvent":{"action":"show_text","value":[{"text":" "}]},"clickEvent":{"action":"run_command","value":"/function datalib:systems/dev_settings/display/nav/right"}},{"text":"\n\n\n\n"},{"text":" "},{"text":"[Close]","color":"red","hoverEvent":{"action":"show_text","value":[{"text":"Delete Book"}]},"clickEvent":{"action":"run_command","value":"/function datalib:systems/dev_settings/display/close"}}]}']},minecraft:custom_data={datalib_dev_settings:1b},minecraft:item_name={"text":"Dev Settings","italic":false,"color":"light_purple"},minecraft:lore=[{"text":"dataLib","italic":false,"color":"#00AAAA"}]]

# devMode DISABLED (score == 0 or unset)
execute unless score #dl.dsm dl.tmp matches 1 run data modify storage datalib:temp dev_settings_pages set value '{"text":""},{"text":" -","bold":true},{"text":"Dev Settings","color":"gold","bold":true},{"text":"-","bold":true},{"text":"\\n\\n\\n"},{"text":"Toggle Type:"},{"text":"\\n"},{"text":" - "},{"text":"[Misc]","color":"light_purple"},{"text":"\\n\\n\\n\\n"},{"text":"Misc Settings:"},{"text":"\\n"},{"text":" ◄ ","color":"dark_aqua","hover_event":{"action":"show_text","value":" "},"click_event":{"action":"run_command","command":"/function datalib:systems/dev_settings/display/nav/left"}},{"text":"[devMode]","color":"#D12D60","hover_event":{"action":"show_text","value":"Status: Disabled"},"click_event":{"action":"run_command","command":"/function datalib:systems/dev_settings/actions/toggle_devmode"}},{"text":" ► ","color":"dark_aqua","hover_event":{"action":"show_text","value":" "},"click_event":{"action":"run_command","command":"/function datalib:systems/dev_settings/display/nav/right"}},{"text":"\\n\\n\\n\\n"},{"text":" "},{"text":"[Close]","color":"red","hover_event":{"action":"show_text","value":"Delete Book"},"click_event":{"action":"run_command","command":"/function datalib:systems/dev_settings/display/close"}}'
execute unless score #dl.dsm dl.tmp matches 1 run item replace entity @s weapon.mainhand with minecraft:written_book[minecraft:written_book_content={author:"",title:"",pages:['{"text":"","extra":[{"text":" -","bold":true},{"text":"Dev Settings","color":"gold","bold":true},{"text":"-","bold":true},{"text":"\n\n\n"},{"text":"Toggle Type:"},{"text":"\n"},{"text":" - "},{"text":"[Misc]","color":"light_purple"},{"text":"\n\n\n\n"},{"text":"Misc Settings:"},{"text":"\n"},{"text":" \u25c4 ","color":"dark_aqua","hoverEvent":{"action":"show_text","value":[{"text":" "}]},"clickEvent":{"action":"run_command","value":"/function datalib:systems/dev_settings/display/nav/left"}},{"text":"[devMode]","color":"#D12D60","hoverEvent":{"action":"show_text","value":[{"text":"Status: Disabled"}]},"clickEvent":{"action":"run_command","value":"/function datalib:systems/dev_settings/actions/toggle_devmode"}},{"text":" \u25ba ","color":"dark_aqua","hoverEvent":{"action":"show_text","value":[{"text":" "}]},"clickEvent":{"action":"run_command","value":"/function datalib:systems/dev_settings/display/nav/right"}},{"text":"\n\n\n\n"},{"text":" "},{"text":"[Close]","color":"red","hoverEvent":{"action":"show_text","value":[{"text":"Delete Book"}]},"clickEvent":{"action":"run_command","value":"/function datalib:systems/dev_settings/display/close"}}]}']},minecraft:custom_data={datalib_dev_settings:1b},minecraft:item_name={"text":"Dev Settings","italic":false,"color":"light_purple"},minecraft:lore=[{"text":"dataLib","italic":false,"color":"#00AAAA"}]]

scoreboard players reset #dl.dsm dl.tmp
Loading