This file provides comprehensive context and guidelines for Gemini agents working on the Meteor Addons project.
Meteor Addons is a specialized addon for the Meteor Client (a Minecraft utility mod). It functions as an in-game package manager, allowing users to browse, install, and update other Meteor Client addons directly from the client's GUI.
- Type: Java Project (Fabric Mod / Meteor Client Addon)
- Language: Java 21
- Build System: Gradle (Kotlin DSL)
- Dependencies: Meteor Client, Fabric Loader, OkHttp, Gson
- Data Source: Fetches metadata from the meteor-addon-scanner repository.
- Render Thread: exclusively for GUI updates and texture manipulation. NEVER block this thread.
- Background Threads: All network operations (HTTP requests) and heavy file I/O MUST run on background threads.
- Use
MeteorExecutor.execute(() -> { ... })for background tasks.
- Use
- Synchronization: To update the GUI from a background thread, schedule the task back to the render thread:
- Use
mc.execute(() -> { ... }).
- Use
The project uses Meteor Client's Systems pattern for persistent, globally accessible singletons.
- Registration: Systems are added in
MeteorAddonsAddon.onInitialize()usingSystems.add(new MySystem()). - Access:
MySystem.get()(wrapper forSystems.get(MySystem.class)). - Persistence: Override
toTag()andfromTag()to save/load state (NBT).
Meteor's GUI framework has a strict initialization order. Violating this causes "theme is null" crashes.
- Constructor: Initialize data fields only. Do NOT build UI or call
init(). - init(): Build your UI here. This method is called automatically by the framework after the widget is added to the tree and the
themeis set. - Theme: Access the
themefield (provided by parent) insideinit(). Never acceptGuiThemein the constructor.
- Centralized Config: Icon sizes are defined in
com.cope.meteoraddons.config.IconSizeConfig.ADDON_ICON_SIZE: Default 64x64.
- Preloading:
IconPreloadSystemhandles async downloading of icon bytes. - Texture Creation: Occurs on the render thread (via
reload()ormc.execute()) usingNativeImage. - Instant Lookup:
IconCacheorIconPreloadSystem.getTexture()returns the texture immediately (or a default) to prevent rendering lag.
src/main/java/com/cope/meteoraddons/
├── MeteorAddonsAddon.java # Main entry point. Registers systems/tabs.
├── addons/ # Data models
│ ├── Addon.java # Base interface
│ ├── InstalledAddon.java # Local addon wrapper (ModContainer)
│ └── OnlineAddon.java # Remote addon wrapper (AddonMetadata)
├── config/
│ └── IconSizeConfig.java # Centralized dimension constants
├── gui/
│ ├── screens/ # Full-screen UIs (Browse, Installed)
│ ├── tabs/ # Tab integration (AddonsTab)
│ └── widgets/ # Reusable components (WAddonCard)
├── models/
│ └── AddonMetadata.java # JSON mapping for scanner data
├── systems/
│ ├── AddonManager.java # Core logic: fetching, filtering, downloading
│ └── IconPreloadSystem.java # Async icon download & GPU texture management
└── util/
├── HttpClient.java # OkHttp wrapper
└── VersionUtil.java # Minecraft version compatibility helpers
Mandatory: Use the gradle-mcp-server tools for all build tasks. Do NOT use run_shell_command with ./gradlew or gradle.
- List Tasks:
gradle_list_tasks(projectPath=...) - Execute Task:
gradle_execute(projectPath=..., tasks=["build"]) - Quick Build:
gradle_build(projectPath=...) - Project Info:
gradle_project_info(projectPath=...) - Dependencies:
gradle_dependencies(projectPath=...)
- Data Flow:
AddonManager.init()-> Background Fetch -> Filter (Version/Verified) -> Deduplicate -> Async Icon Download -> Texture Creation -> GUI Render. - Networking: Uses
OkHttp(bundled viaincludein Gradle). Always verify internet access before assuming success. - File Operations: Addons are downloaded to
MeteorClient.FOLDER.getParent().resolve("mods"). - Version Filtering: Checks
custom.supported_versionsarray first, thenmc_version.
- Calling
init()manually: Never do this for Widgets. - Blocking Render Thread: Will freeze the game. Use
MeteorExecutor. - Texture Size Mismatch: Always resize
NativeImageto match the texture dimensions defined inIconSizeConfigbefore uploading to prevent memory violations. - Theme Shadowing: Do not create a
themefield in your widget if extending a Meteor widget; use the protected field from the parent.
Use code-search-mcp for all codebase exploration and navigation.
- Initialize: Always ensure the workspace is added via
add_workspace(if not already detected/listed). - Search: Prefer these tools over
grepor basic file reading:search_symbols: Find classes, methods, and variables.search_ast_pattern: Find code based on structure (e.g.,Systems.add($$$)).search_text: Fast, regex-based text search (uses ripgrep).
- Investigate: Use
codebase_investigatorfor complex, high-level architectural questions.
- AI Reference: The
ai_reference/directory contains decompiled/source code of Meteor Client and other addons. Index this directory if you need to search it deeply. - Mappings: The project uses Yarn mappings.