Skip to content

refactor(gui): improve caching flow, deterministic execution context, and GUI item cleanup#12

Open
tickwarden wants to merge 19 commits intoofficialbarden:mainfrom
tickwarden:main
Open

refactor(gui): improve caching flow, deterministic execution context, and GUI item cleanup#12
tickwarden wants to merge 19 commits intoofficialbarden:mainfrom
tickwarden:main

Conversation

@tickwarden
Copy link

@tickwarden tickwarden commented Feb 19, 2026

Summary

This PR improves GUI stability, caching consistency, and execution determinism. It introduces centralized GUI item cleanup, placeholder item support, and enhanced menu interaction features.


Changes

Execution Context

  • Replaced generic player execution with deterministic player targeting
  • Preserves position, rotation, and anchor context during execution

GUI Caching

  • Refactored item holder caching flow
  • Improved toggle button cache consistency

GUI Item Lifecycle

  • Added centralized GUI item cleanup function
  • Introduced placeholder GUI item support

Menu Interaction

  • Added automatic menu close on item selection with command execution support
    • Example: Selecting an item can close the menu and execute commands (e.g. /tp @a 0 100 0)
  • Implemented conditional entity spawning tied to held items
    • Example: Holding a specific item spawns a minecart; releasing it removes the minecart
  • Added support for multiple commands per interaction

Structure

  • Removed duplicated inline cleanup logic
  • Improved internal modularity

Metadata

  • Updated pack format compatibility configuration

Why

These changes improve:

  • Multiplayer reliability
  • GUI execution predictability
  • Internal maintainability
  • Item lifecycle consistency
  • Interaction flexibility and responsiveness

Risk Assessment

Low to Medium risk

Affected behavioral areas:

  • GUI caching flow
  • Item cleanup handling
  • Execution context logic
  • Automatic menu close behavior
  • Entity spawning/despawning tied to item state

Testing

Tested scenarios:

  • Singleplayer GUI interaction
  • Multiplayer concurrent GUI usage
  • Cache persistence between menu switches
  • GUI item cleanup cases
  • Placeholder item handling
  • Menu close on selection with command execution
  • Item-based entity spawn/despawn behavior

Notes

  • Centralized cleanup prevents GUI items from remaining in player inventories after interaction cycles
  • Automatic menu close enables smoother GUI-to-gameplay transitions
  • Item-based entity spawning enables dynamic held-item interactions

Copy link
Author

@tickwarden tickwarden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look reasonable. The switch to sort-arbitrary,limit=1 for deterministic execution is a good improvement. Minor: worth adding a comment explaining why sort-arbitrary is used here for future reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant