📄
pasted-code-1788436494679.txt
txt
28 lines
▶
Please generate a complete, production-ready source code structure for a Minecraft 1.21.4 Client-Side Fabric mod named "FlashbackInventoryAddon" (modid: flashbackinventoryaddon).
The mod acts as an addon for the Flashback mod, allowing players to view and interact with inventory replays/overlays. Here are the precise specifications and classes required inside `src/main/java/com/flashbackinventoryaddon/`:
1. FlashbackInventoryAddon.java (Client Mod Initializer):
- Implements `ClientModInitializer`.
- Initializes `CursorRenderer.init()` and `GuiRenderController.init()` inside `onInitializeClient()`.
2. ConfigManager.java:
- A simple configuration holder containing a boolean option `captureInventory` (default: true).
3. render/GuiRenderController.java:
- Tracks screen changes. Method `onScreenChange(Screen newScreen)` checks if the screen is an instance of `HandledScreen>` and if `ConfigManager.config.captureInventory` is true, stores it as `activeCapturedScreen`.
- Provides `renderOverlay(DrawContext context, float delta)` and `getActiveCapturedScreen()`.
4. render/CursorRenderer.java:
- Renders a custom cursor texture (`textures/gui/sprites/cursor.png`) using `DrawContext` and `MinecraftClient.getInstance()`.
5. flashback/FlashbackCompat.java:
- Bridge class to retrieve `GuiRenderController.getActiveCapturedScreen()` to integrate seamlessly with Flashback replay data.
6. mixin/ ScreenMixin.java, GuiMixin.java, GameRendererMixin.java:
- ScreenMixin: Hooks into `Screen.class` to capture initialization (`onInit`) and rendering (`onRender` with `DrawContext`).
- GuiMixin: Hooks into `InGameHud` to render overlays during tick updates using `DrawContext` and `RenderTickCounter`.
- GameRendererMixin: Hooks into screen transitions.
Ensure all imports match Minecraft 1.21.4 Yarn mappings (e.g., using `DrawContext`, `RenderTickCounter`, `Identifier.of()`, etc.), and place everything under a unified `src/main/java/com/flashbackinventoryaddon` structure to avoid Gradle multi-source set compilation issues.
`
Create the Fabric 1.21.4 client mod metadata and Gradle structure.
Add the initializer, config, rendering controllers, Flashback bridge, and mixins.
Add the required mixin configuration, cursor asset metadata, and language entry.
Created the complete Fabric 1.21.4 client-side project structure for FlashbackInventoryAddon, including:
Gradle/Loom configuration targeting Minecraft 1.21.4, Yarn build 8, Fabric Loader 0.16.9, and Java 21.
Client initializer and configuration holder.
GUI capture/render controller.
Custom cursor renderer using
Identifier.of().Flashback compatibility bridge.
ScreenMixin,GuiMixin, andGameRendererMixin.Fabric metadata, mixin configuration, and language resource.
The project is located under com.flashbackinventoryaddon as requested.
did it work and render invintory in flashback mod
No. The generated code does not render inventory replays inside the Flashback mod.
What it currently does:
Tracks the currently open live
HandledScreen.Draws a custom cursor overlay over that live screen.
Does not capture inventory contents, slots, titles, clicks, or replay timestamps.
Does not connect to any Flashback API or replay events.
FlashbackCompatonly returns the addon’s own stored screen; it is not a real Flashback integration.The referenced cursor texture is missing.
A successful build was not verified because the project lacks the Gradle wrapper.
To make it work, the implementation needs the exact Flashback mod version and its available API/access points. It would then need to capture inventory state during recording and recreate/render that state during Flashback playback, rather than storing a live HandledScreen object.
package com.flashbackinventoryaddon;
import com.flashbackinventoryaddon.render.CursorRenderer;
import com.flashbackinventoryaddon.render.GuiRenderController;
import net.fabricmc.api.ClientModInitializer;
public final class FlashbackInventoryAddon implements ClientModInitializer {
public static final String MOD_ID = "flashbackinventoryaddon";
@Override
public void onInitializeClient() {
CursorRenderer.init();
GuiRenderController.init();
}
}