Fix/bugs#5
Merged
Merged
Conversation
added 2 commits
May 17, 2026 08:01
…e packs
Toggle actions_on/off:
- Tag is flipped via Java API BEFORE actions run (no race condition)
- actions_on fires when the toggle WAS on (turning OFF)
- actions_off fires when the toggle WAS off (turning ON)
- Default tag add/remove no longer injected as run_command — handled in Java
- Custom actions (sound, message, run_command…) execute normally after the flip
- GUI reopens automatically unless an action closes/navigates away
Sound action:
- New 'sound' action type in ActionType enum and executeAction
- value format: 'namespace:sound.id' or 'namespace:sound.id:volume:pitch'
- Uses player.playSoundToPlayer() — only the clicking player hears it
- Logs WARN for unknown sound IDs; does not stop action chain
- Does not return true (does not break chain)
Example datapack:
- admin_panel.json: sound on open, toggle with actions_on/off + sound/message,
placeholder in toggle lore ({player}), sound on close button
- showcase.json: sound on every button, toggle actions_on/off with lever click
sounds at different pitches, {player} in all lore/messages, {page1}/{pages}
in all nav buttons, {score:coins} in on_open message
README:
- sound added to action types table with format docs
- Toggle table: clarified actions_on/off execution order and tag flip timing
GuiVarStore:
- New singleton: Map<UUID, Map<String, String>> in memory
- set / add / remove / clear / get / getInt / getAll / getOrDefault
- ConcurrentHashMap at top level; cleared automatically on GUI close
GuiDefinition:
- New ActionType: SET_VAR, ADD_VAR, SUB_VAR, RESET_VAR, CLEAR_VARS
- New ConditionType: VAR_EQ, VAR_GT, VAR_LT, VAR_SET
- ButtonAction gains 'var' field (variable key for var actions)
BarrelGuiHandler:
- Placeholder {var:key} resolved in resolve()
- evaluateCondition handles var_eq/gt/lt/set
- executeAction handles all 5 var action types
- onClose(ServerPlayerEntity) calls GuiVarStore.INSTANCE.clear()
GuiCommand:
- /guiapi var get <player> <key>
- /guiapi var set <player> <key> <value>
- /guiapi var clear <player>
- Help text updated
Example datapack:
- counter.json: full counter demo — set_var on_open, add/sub/reset_var,
var_gt and var_set conditions, {var:count} in title and lore
- README: var placeholder table, var action table, var condition table,
counter example, /guiapi var commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.