Miror_Hk
๐Ÿ“Ž 1 file 4,322 chars
๐Ÿ“„
pasted-code-1794364925210.txt
txt 45 lines
โ–ถ
CRITICAL VERSION LOCK: This mod MUST target Minecraft 1.21.1 with NeoForge 1.21.1 ONLY. Do NOT target NeoForge 26.1.2, 26.2, or any other version. If the current Kodari project is locked to 26.x and cannot be changed to 1.21.1, STOP and reply: "This project is locked to 26.x. Please create a new NeoForge 1.21.1 project and re-run this prompt." Do not generate any code for 26.x.

If a 1.21.1 project is available, generate the full mod using Java 21 and NeoForge 1.21.1 APIs only (net.neoforged.*). No Fabric, no old Forge (net.minecraftforge.*).

Create a client-side only NeoForge 1.21.1 mod. Mod ID: hudmod. Display name: Custom HUD Editor. The mod must not add blocks, items, entities, or server-side logic. It only renders and edits HUD overlays on the client.

KEEP ALL CORE FEATURES:
- A main HUD element with editable x, y, scale (0.5โ€“3.0), text color (RGB hex), contrast (0.0โ€“2.0), and optional custom PNG image path (ResourceLocation string, e.g. "hudmod:textures/gui/custom.png").
- If image path is empty or invalid, render text label "My HUD" instead.
- Editor screen opens with Right Shift (KeyMapping via RegisterKeyMappingsEvent on the mod event bus; input via InputEvent.Key on NeoForge.EVENT_BUS). Does not pause the game (isPauseScreen returns false).
- Editor has: EditBox for hex color, EditBox for image path, slider for scale, slider for contrast.
- Main HUD element is draggable with left mouse button; hit detection must account for current scale. A red outline shows its bounds.
- Render via RegisterGuiLayersEvent registered on modEventBus.addListener(...), above VanillaGuiLayers.HOTBAR.
- Config persistence via ModConfigSpec (ModConfig.Type.CLIENT) for x, y, color, scale, contrast, imagePath. Registered in the mod constructor via modContainer.registerConfig. Save on every change.

ADD NEW FUN FEATURES (all toggleable in the editor):
1. Clock widget: shows in-game time of day (e.g., "Day 42, 14:30").
2. Speedometer widget: shows player movement speed in blocks per second. If riding an entity, show that entity's speed.
3. Biome & Coordinates widget: shows current biome name and XYZ coordinates.
4. Ping & FPS widget: shows server ping (if multiplayer) and FPS.
5. Rainbow Text toggle: when enabled, text color of all HUD elements cycles through rainbow colors automatically.
6. Bobbing toggle: when enabled, HUD elements bob up and down with a sine wave based on player walk distance.
7. Random Compliment widget: every 60 seconds displays a random short compliment message (e.g., "You're doing great!", "Nice factory!").

EDITOR SCREEN UPGRADES:
- Add a "Widget List" panel on the left side with checkboxes to toggle visibility of each widget (Main HUD, Clock, Speedometer, Biome, Ping/FPS, Compliment).
- New widgets are positioned automatically below the main HUD element with a small offset.
- Main HUD element remains draggable and resizable.

CREATE MOD COMPATIBILITY (STUB ONLY, NO HARD DEPENDENCY):
- Do NOT add Create to neoforge.mods.toml dependencies. The mod must load fine without Create.
- Use ModList.get().isLoaded("create") to detect Create at client side.
- If Create is loaded, attempt to read the player's vehicle inside a try-catch block so missing classes never crash the game. Log "Create detected" once for debugging.
- Add a "Contraption Info" widget: if Create is loaded, show "Create: Detected (no data)"; otherwise show "Create: Not found". This is a placeholder for future real integration.

TECHNICAL CONSTRAINTS (NeoForge 1.21.1 ONLY):
- Java 21.
- Use ResourceLocation.fromNamespaceAndPath(...) or ResourceLocation.parse(...). Do NOT use new ResourceLocation(...) (removed in 1.21).
- GuiGraphics.blit must use the 1.21.1 signature (do NOT use GuiGraphicsExtractor, which is for 26.x).
- RegisterGuiLayersEvent must be attached via modEventBus.addListener(...), NOT NeoForge.EVENT_BUS.
- ModConfigSpec must be registered in the mod constructor via modContainer.registerConfig(ModConfig.Type.CLIENT, SPEC).
- neoforge.mods.toml must be placed at META-INF/neoforge.mods.toml inside the JAR.
- Package: com.example.hudmod. Files: HudMod.java, HudElement.java, HudEditorScreen.java, and neoforge.mods.toml.

Generate the complete source code for all files, including imports, and the neoforge.mods.toml content.
Kodari AI
KodariNov 11 at 2:42 am 2
CustomHudEditor
A client-side only NeoForge 1.21.1 mod that renders and edits customizable HUD overlays. Features a draggable main HUD element with adjustable position, scale, color, contrast, and optional custom image. Includes toggleable widgets for clock, speedometer, biome/coordinates, ping/FPS, and random compliments. Editor screen opens with Right Shift, offering sliders, text fields, and widget visibility checkboxes. Supports rainbow text and bobbing animations. Detects Create mod presence without hard dependency, showing placeholder contraption info. Config persists via ModConfigSpec.

This project is locked to NeoForge 26.2. Kodari supports NeoForge 1.21.1; switch projects to build the requested mod.

Switch to NeoForge 1.21.1

Kodari can make mistakes. Review important code before using.
Files

No files in this session

Code