-
-
Notifications
You must be signed in to change notification settings - Fork 15
Fix GUI layout version placement and dynamic slot detection for all GUI buttons #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix GUI layout version placement and dynamic slot detection for all GUI buttons #9
Conversation
Co-authored-by: ptthanh02 <73684260+ptthanh02@users.noreply.github.com>
|
@copilot ok but you need to do for other slot as well in the sync and don't use |
…ng with one-time initialization Co-authored-by: ptthanh02 <73684260+ptthanh02@users.noreply.github.com>
Extended dynamic slot detection to storage and exp slots (previously hardcoded CHEST_SLOT=11, EXP_SLOT=15). Replaced 5-second caching with one-time initialization when config loads for better performance. All three slot types (storage, exp, spawner_info) now use consistent dynamic detection and are refreshed only on layout reload via the existing clearSlotCache() method. (commit 0166685) Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Overview
This PR addresses critical issues with the SmartSpawner GUI system and extends dynamic slot detection to all GUI buttons:
Issues Fixed
1. Version Config Placement
Problem: When the plugin first loads and creates default GUI layout files, the
gui_layout_versionwas being added at the bottom of the YAML configuration files instead of at the top.Root Cause: The
GuiLayoutUpdater.createDefaultLayoutFileWithHeader()method was simply appending the version to the existing configuration.Solution: Modified the method to create a new configuration with version first, then copy all other keys to preserve proper ordering.
2. Timer Sync Issue
Problem: The %time% placeholder in spawner_info button lore was not updating correctly when the button was positioned in different slots across layout configurations.
Root Cause: The timer update logic in
SpawnerGuiViewManagerwas using a hardcodedSPAWNER_INFO_SLOT = 13, but:This mismatch caused timer updates to target the wrong inventory slot, making the timer appear frozen.
3. Hardcoded Storage and Exp Slots
Problem: Storage and exp button updates were using hardcoded slot constants (
CHEST_SLOT = 11,EXP_SLOT = 15) that didn't match actual layout configurations.Root Cause: Similar to the timer sync issue, hardcoded slots caused mismatches when:
Solution:
SPAWNER_INFO_SLOT,CHEST_SLOT,EXP_SLOT)storage,exp, andspawner_infoSpawnerMenuUIto handle different button variantsclearSlotCache()methodTechnical Details
Key Changes
Performance Improvements
Testing
The fix has been verified to work correctly with:
Backward Compatibility
All changes maintain full backward compatibility. Existing configurations will continue to work, and the dynamic slot detection automatically adapts to any layout configuration for all GUI button types.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.