Add Form Caching, Spawner Info Display, and Stacker Form UI to Bedrock GUI#34
Add Form Caching, Spawner Info Display, and Stacker Form UI to Bedrock GUI#34
Conversation
Co-authored-by: ptthanh02 <73684260+ptthanh02@users.noreply.github.com>
|
@copilot ok good but I want the spawner info text to be below the buttons not above it, and can you make a bedrock form UI for the SpawnerStackerGUI? make sure to code safely performance wise and exploit handling |
Co-authored-by: ptthanh02 <73684260+ptthanh02@users.noreply.github.com>
Done! ✅ Changes implemented in commit 78d37b4:
The form UI is automatically used for Bedrock players, while Java players continue to use the chest GUI. |
Overview
This PR implements form caching for the Bedrock GUI, adds configurable spawner information display, and creates a complete Bedrock form UI for the spawner stacker, addressing performance concerns and improving the user experience for Bedrock Edition players.
Changes
1. Form Caching System
Previously, the form builder was recreated every time a player opened the spawner GUI, causing unnecessary processing. This implementation adds a caching layer that:
The cache is implemented in
SpawnerMenuFormUIandSpawnerStackerFormUIwith integration points inSpawnerDataandSpawnerGuiViewManagerto ensure data consistency.2. Spawner Info Display
Added a new configurable spawner information section that displays as an info button below the action buttons. When clicked, it refreshes the form. Server admins can now configure what information is shown to Bedrock players via
gui.yml:Supported placeholders:
%entity%,%ᴇɴᴛɪᴛʏ%,%entity_type%%stack_size%%range%,%delay%,%min_mobs%,%max_mobs%%current_items%,%max_items%,%formatted_storage%%current_exp%,%max_exp%,%formatted_exp%%total_sell_price%3. Bedrock Spawner Stacker Form UI
Created a complete Bedrock form UI (
SpawnerStackerFormUI) for stack management with:4. Bedrock Color Code Compatibility
Implemented automatic conversion of hex color codes to Bedrock-compatible section codes (§0-§9, §a-§f, §g). The system:
ඪdb) to closest Bedrock equivalents (e.g.,§9)&color codes to§format5. Multi-language Support
Updated all language files with localized spawner info and stacker form configurations:
en_US- Englishde_DE- Germanvi_VN- VietnameseDonutSMP- Server-specificTechnical Details
Cache Strategy:
spawnerId|stackSize|spawnerExp|usedSlotsColor Mapping Examples:
Security Features:
Benefits
Files Changed
SpawnerMenuFormUI.java- Form caching and spawner info as buttonSpawnerStackerFormUI.java- NEW - Bedrock stacker form UI with cachingSpawnerStackerHandler.java- Made stack methods public for form UISmartSpawner.java- Initialize and integrate stacker form UISpawnerData.java- Cache invalidation hooksSpawnerGuiViewManager.java- Cache invalidation supportgui.yml(all 4 language files) - Spawner info and stacker form configurationTesting Recommendations
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.