galaxy.linux

You are an expert Minecraft mod developer. Create a complete, compilable mod called "NexaBuild" for Minecraft 1.21.11.

1. Project setup

  • Mod name: NexaBuild | Mod ID: nexabuild | Package: com.nexabuild
  • Minecraft version: 1.21.11 (verify the exact matching Fabric Loader, Fabric API, and Fabric Loom versions before writing build files)
  • Loader: Fabric (Java 21). Keep the code modular so a NeoForge port is easy.
  • Environment: client + server (client handles GUI/preview, server handles authoritative placement)
  • Deliver: full project tree, build.gradle, gradle.properties, fabric.mod.json, all source files, lang file (en_us.json), and README with build instructions. Code must compile without placeholders or TODOs.

2. NexaBuild folder (auto-generated)

On first launch, automatically create this structure in the game directory:

NexaBuild/ ├── schematics/ ← user drops uploaded schematic files here ├── imported/ ← files moved here after successful load (optional, configurable) ├── backups/ ← undo snapshots of replaced areas ├── presets/ ← saved placement presets (JSON) ├── logs/ └── nexabuild.json ← main config

  • Run a file watcher (WatchService) on schematics/ so newly dropped files are detected and listed instantly with no restart needed.
  • Also support an in-game "Upload" button that opens the OS file picker and copies the chosen file into schematics/.
  • Validate files, show clear error messages for corrupted or unsupported ones.

3. Supported formats

  • .schem (Sponge Schematic v2 and v3)
  • .litematic (Litematica)
  • .nbt (vanilla Structure Block)
  • .schematic (legacy MCEdit, best-effort conversion)

Include block states, block entities (chests, signs, etc.), and biome data where possible. Handle missing or unknown blocks gracefully (skip or substitute, configurable).

4. Auto-build system

  • Build modes:

1. Instant (all blocks at once, chunk-safe) 2. Animated layer-by-layer 3. Animated block-by-block with a configurable blocks/tick rate 4. Survival mode: consume items from the player's inventory/nearby containers and show a missing-materials list

  • Async/batched placement to avoid server lag (limit blocks per tick, configurable)
  • Pause / resume / cancel the build at any time
  • Full undo/redo (multi-step) using snapshots stored in backups/
  • Ghost/hologram preview before confirming (render outlines or translucent blocks, with color coding for blocks that would replace existing ones)

5. Placement editing (everything adjustable)

All of these must be editable both in the GUI and via commands, with live preview updating in real time:

  • Position: X/Y/Z absolute, plus nudge buttons (+/-1, +/-5, +/-16) and "snap to look-at block" / "snap to player"
  • Rotation: 0/90/180/270 degrees around Y
  • Mirror/flip: X axis, Z axis
  • Origin/anchor point: choose corner, center, or custom block as the pivot
  • Offset: fine X/Y/Z offset relative to anchor
  • Replace mode: replace all / only air / only non-air / keep existing (skip occupied)
  • Ignore blocks: toggle "ignore air", "ignore structure void", plus a custom ignore-block list
  • Block replacement mapping: swap block A to block B throughout the schematic (e.g., oak to spruce), with a per-block-type palette editor
  • Region crop: limit the build to a sub-box (min/max X/Y/Z) or specific layers (Y-range)
  • Include/exclude entities and block entities
  • Build direction/order: bottom-to-top, top-to-bottom, center-out
  • Speed control (blocks per tick)
  • Save/load all these settings as named presets in presets/

6. GUI

  • Keybind (default: N) opens the NexaBuild screen with these tabs: Schematics | Placement | Materials | Settings | History
  • Schematics tab: searchable list with name, size, block count, format, and a 3D/isometric thumbnail preview
  • Placement tab: all controls from section 5, with sliders, text fields, and buttons
  • Materials tab: required block list with counts, found vs. missing in inventory
  • History tab: past builds with undo and re-apply
  • Clean, responsive layout; tooltips on every control; supports scrolling and resizing

7. Commands (/nexabuild, alias /nb)

  • /nb list | load <name> | unload
  • /nb pos <x> <y> <z> | rotate <deg> | mirror <x|z> | offset <x> <y> <z>
  • /nb mode <instant|layer|block|survival>
  • /nb build | pause | resume | cancel | undo | redo
  • /nb preset save|load|delete <name>
  • /nb reload (rescan folder and config)

All with tab-completion and permission levels.

8. Multiplayer and safety

  • Server-authoritative placement with permission checks (configurable op level)
  • Respect protected/spawn areas and claim mods where possible
  • Max schematic size and max blocks-per-tick limits in config
  • Rate limiting and packet validation for uploads/placement requests
  • Log all builds to logs/

9. Code quality

  • Clean architecture: separate modules for parsing (format loaders), placement engine, rendering, networking, GUI, config
  • Use a common internal Schematic data model that all loaders convert into
  • Thread-safe file IO, no blocking the main thread
  • Comments and Javadoc for public classes
  • Unit tests for the parsers and the rotate/mirror transforms

10. Output format

  1. Show the complete file tree.
  2. Provide every file's full code, one by one, in order.
  3. End with build, install, and usage instructions plus a list of known limitations.

If anything depends on an API that changed in 1.21.11, state the assumption clearly and use the correct current API.

Kodari AI
KodariNov 9 at 5:16 pm 3
NexaBuild
NexaBuild is a comprehensive Minecraft Fabric mod for 1.21.11 that enables advanced schematic building. It supports multiple formats (Sponge, Litematica, Structure Block, MCEdit), features an auto-build system with four modes (instant, layer, block, survival), and provides extensive placement editing including rotation, mirroring, offsets, and block replacement. The mod includes a full GUI with tabs for schematics, placement, materials, and history, plus a command system. It features file watching for auto-import, undo/redo functionality, ghost previews, and server-authoritative placement with safety limits.

[Generation stopped]

galaxy.linux

Make like this mod but Generate folder after load and there we can add schematics

Kodari AI
KodariNov 9 at 5:29 pm 1
  • Create the NexaBuild folder when the mod loads.

  • Detect schematic files added to its schematics folder and expose a server-side list command.

[Generation stopped]

galaxy.linux

You are an expert Minecraft Fabric mod developer and a careful refactorer.

I am attaching the full source of an existing client-side mod called "Auto cc" (Auto Builder). Do NOT rewrite it from scratch. Rename and extend it into a new mod called "NexaBuild". Keep everything that already works (the BuildEngine behaviour, schematic reading, isometric preview, HUD tracker) and add the features below. Where my source and this prompt disagree, keep the source's working behaviour.

1. Project facts (from the existing source: keep these, bump only if a newer matching version is required)

  • Minecraft 1.21.11, Java 21, client-only, Fabric Loader 0.19.5+, Fabric API 0.141.6+1.21.11
  • Loom plugin id net.fabricmc.fabric-loom-remap version 1.14.10, Yarn mappings 1.21.11+build.6, Gradle wrapper 9.7.1
  • loom { splitEnvironmentSourceSets() }, with src/main (resources) and src/client/java (all code), and the mod registered for both source sets
  • Rename: mod id nexabuild, name "NexaBuild", package dev.nexabuild (move every dev.autocc.* class), archives name nexabuild, lang file assets/nexabuild/lang/en_us.json, keybind category key.category.nexabuild.general, keybind key.nexabuild.open (default Right Shift), logger name "nexabuild"
  • fabric.mod.json: environment client, depends fabricloader >=0.19.5, minecraft ~1.21.11, java >=21, fabric-api *
  • Use the 1.21.11 Yarn API exactly as the existing code does (for example KeyBinding.Category.create(Identifier), Screen#mouseClicked(Click, boolean), Screen#keyPressed(KeyInput), DrawContext#drawStrokedRectangle, Screen#onFilesDropped(List<Path>)). Do not guess new signatures; if unsure, read the existing class and follow it.
  • Keep GridPos, BuildOrder, PathPlanner free of Minecraft types so they stay unit-testable.
  • Everything must pass ./gradlew build with no TODOs or placeholders.

2. The NexaBuild folder: created AFTER the mod has loaded

In onInitializeClient (and again lazily on the first client tick when client.runDirectory is available) create, if missing:

NexaBuild/ ├── schematics/ ← the user drops files here (subfolders allowed) ├── imported/ ← optional archive of processed files ├── presets/ ← saved placement presets (*.json) ├── cache/ ← preview thumbnails and parse results ├── logs/ └── nexabuild.json ← config (see section 7)

Folder system rules:

  • Create the folders even if the player never opens the menu. Never crash if the disk is read-only: log, disable the feature, and show the reason in the menu.
  • A background WatchService thread (daemon) watches schematics/ recursively (register new subfolders as they appear). New, modified, renamed, and deleted files update the Library list within about 1 second, with no restart. Hand results to the client thread through a thread-safe queue and apply them in the client tick. Never touch GUI or world state from the watcher thread.
  • Debounce: only parse a file once its size and modified time have been stable for about 500 ms (so half-copied files are never read).
  • Fallback: if WatchService fails (some network drives), poll every 2 seconds.
  • Initial scan on startup and on the RELOAD button, and on /nb reload.
  • Supported extensions: .litematic (existing reader), .schem (Sponge v2/v3), .nbt (vanilla structure), and .schematic (legacy, best-effort). Convert every format into one internal Schematic model (width/height/length, int[] voxels, palette of block id + properties, block entities, region offsets). Make the existing LitematicaFile implement or adapt to it so BuildPlan, BuildEngine, and IsoRenderer work on any format.
  • Keep the existing limits (max volume 6,000,000 cells, max dimension 8192, NBT size cap) and report violations as clear errors.
  • Drag-and-drop onto the menu copies the file into schematics/ (do not just reference the original path). Handle name collisions with " (2)", " (3)".
  • Buttons: OPEN FOLDER (opens schematics/ in the OS file manager using Util.getOperatingSystem().open(...)), IMPORT (copy chosen files in), REMOVE (move the file to imported/.trash after a confirm; never hard-delete without confirm), and RELOAD.
  • Each library entry has a state: Queued → Decoding → Ready / Failed(reason). Failed files stay listed in red with the error. Parsing uses a small thread pool; the existing "textures are uploaded between frames, never during a render pass" rule (tickPreview) must be kept.
  • Log all folder events (added/removed/failed) to NexaBuild/logs/nexabuild.log with timestamps and rotate at about 1 MB.

3. The menu (new, multi-tab). Keep the existing dark monochrome look

Reuse the existing palette (WHITE, SOFT_WHITE, MUTED, DIM, PANEL, PANEL_INNER, ROW, BORDER, BLACK), the top accent line, the badge, and drawButton/drawChip helpers. Keep the responsive Layout logic (split view on wide windows; list and preview taking turns on narrow windows or large GUI scale). Everything must stay usable at GUI scale 1 to 4 and at 854x480 window size.

Opening: keybind (default Right Shift), /nb or /nexabuild with no arguments, and an optional Mod Menu entrypoint (soft dependency, modmenu entrypoint only if present) that opens the Settings tab. The menu does not pause the game (shouldPause = false). The build still pauses while any screen is open and resumes when closed, as the existing engine does.

Header: title "NexaBuild", subtitle "SCHEMATIC BUILDER", badge "CLIENT". Below it, a tab strip: LIBRARY | PLACEMENT | MATERIALS | BUILD | HISTORY | SETTINGS. Keyboard: Tab / Shift+Tab or 1–6 to switch tabs, Esc to close (Esc leaves View mode first, as now), mouse wheel to scroll, Ctrl+F focuses search.

LIBRARY tab

  • Search box (live filter by name/author/format) and sort chips (Name, Date, Size, Blocks).
  • Rows (as now, ROW_HEIGHT 34): name, extension badge, file size, dimensions, block count, status dot.
  • Selected schematic: isometric preview (existing IsoRenderer): rotate, top-down toggle, zoom, and a Y-layer slider to slice the view. VIEW MODE expands the preview over the whole content area (existing behaviour). Stats panel: size, total blocks, distinct blocks, author, description, data version, format.
  • Footer buttons: OPEN FOLDER, IMPORT, REMOVE, RELOAD, SELECT. An empty state shows the existing drop zone with the text "Drop files here or put them in NexaBuild/schematics".

PLACEMENT tab (every value editable, with a live ghost preview in the world)

  • Anchor position: X/Y/Z number fields (typed or arrow/scroll adjust) plus nudge buttons ±1, ±5, ±16 per axis; SNAP TO LOOK-AT BLOCK; SNAP TO PLAYER; AUTO FLAT SITE (the existing BuildPlan.findFlatSite); LOCK ANCHOR.
  • Rotation: 0/90/180/270 (buttons plus Q/E hotkeys in preview). Mirror X, Mirror Z.
  • Pivot: corner / center / bottom-center / custom block. Fine offset X/Y/Z.
  • Region crop: min/max X/Y/Z sub-box and a Y-layer range (from-to) slider; for multi-region litematics, a per-region include checkbox list.
  • Replace mode: air only / replace everything / skip occupied (do not overwrite non-air).
  • Ignore list: air, structure void, plus a custom list (searchable block picker).
  • Block swap table: rows "from block → to block" (searchable pickers using the block registry, with a count of affected cells), enable/disable per row, and a "swap whole family" helper (for example oak → spruce for planks/log/stairs/slabs/fences/doors where the target exists). Swaps must be applied through BlockStateResolver so properties carry over safely.
  • Include or exclude: block entities, entities, redstone state clicks (repeater delay, comparator mode, lever, note block, door/trapdoor/gate states).
  • Build order: bottom-to-top (default), top-to-bottom, nearest-neighbour (existing BuildOrder), column-by-column, and center-out.
  • Speed: placements per second / ticks between placements, and a "careful mode" (extra verify sweep).
  • PRESETS: Save as, Load, Overwrite, Delete, and Duplicate for named presets in NexaBuild/presets/*.json. A preset stores all of the above (not the anchor position unless the user ticks "include position").
  • Implementation: add an immutable PlacementSettings record, applied in BuildPlan before ordering (transform → crop → swap → ignore → order). Keep the planning code testable without Minecraft.
  • World ghost preview: render outlines or translucent blocks through a Fabric world-render event for the planned cells, with colors: green = to place, yellow = will replace existing, red = blocked/unsupported, grey = already correct. Toggle in the menu and with a hotkey; cap how many cells are drawn per frame (config).

MATERIALS tab

  • Existing material view, upgraded: Item, Needed, In inventory, Missing, with sort and a "missing only" filter, plus a total. Show the shopping list BEFORE the build starts (the engine already computes this) and let the user copy it to the clipboard or export it to NexaBuild/logs/materials-<name>.txt.
  • Show which items the swap table changed and which blocks are unobtainable in survival (for example air-like, command blocks) as warnings.

BUILD tab

  • Big state panel: IDLE / RUNNING / PAUSED / DONE / STOPPED, phase (TRAVELLING / BREAKING / PLACING), placed, broken, satisfied, floating, missing items, reach-only, scaffold used, completion % with a progress bar, elapsed and ETA, and the engine's note() text.
  • Buttons: START (AUTO BUILD), PAUSE/RESUME, STOP (confirm), RESTART FAILED CELLS (second pass for cells that were missing an item or support the first time).
  • Start behaviour: use the Placement tab's anchor if set, otherwise the block in front of the player on a flat site (current behaviour); then close the menu so the engine can walk.
  • Pre-flight checklist shown before starting (each line is green/yellow/red): world loaded, schematic ready, enough materials, a spare scaffold block present (a block the schematic does not use), free space, and the multiplayer-rules warning.

HISTORY tab

  • List of past builds: name, date, duration, placed/total, result. Actions: RE-RUN, RESUME FROM CELL, REMOVE ENTRY. Stored in NexaBuild/logs/history.json.
  • A log viewer showing the tail of nexabuild.log with filters (info/warn/error) and a COPY button.

SETTINGS tab

  • Toggles and sliders bound to nexabuild.json: master enable; disable automation on multiplayer servers (default ON); show ghost preview; HUD tracker position and corner; confirm dialogs; watcher enabled/poll fallback; max cells rendered; default build order; default speed; crouch/sprint helper handling for toggle options; language-independent number formats.
  • Buttons: OPEN CONFIG FOLDER, RESET TO DEFAULTS.

All lists must scroll with the wheel and with draggable scrollbars. All controls need tooltips. Text that does not fit must be truncated with an ellipsis using the existing truncate approach. Every action writes a short message to the footer status line.

4. Commands (Fabric client commands, /nexabuild, alias /nb, tab-completion everywhere)

/nb (open menu) | list | reload | folder | load <name> | unload | pos <x y z> | here | look | rotate <0|90|180|270> | mirror <x|z> | offset <x y z> | order <mode> | speed <n> | swap <from> <to> | crop <x1 y1 z1 x2 y2 z2> | preview <on|off> | build | pause | resume | stop | preset save|load|delete <name> | materials | status.

5. Build engine: keep and extend

Keep every existing capability: "place what is placeable right now" scanning (floating clusters build out from the first supported block), vantage-point selection, reach placement, crouch warm-up so containers are placed instead of opened, hotbar/inventory swaps through the player's screen handler, redstone state clicks, tower and bridge scaffolding with a spare block the schematic never uses (and tear-down at the end), stuck/limit constants, rotation repair, sweep repairs, and per-state-change logging.

Extend it only with: PlacementSettings support (transform, crop, swap, ignore, replace mode, order, speed), resume from a saved cell index, restart-failed-cells pass, and the settings-driven safety rules below. Make the constants configurable only where a setting is listed above.

Safety (new, default ON):

  • A first-run screen explains that automated building can break server rules, and requires a click to enable.
  • "Disable on multiplayer servers" blocks start on non-integrated servers unless the user turns it off.
  • Hard stop (with a message) when the player takes damage, drops below a health threshold, dies, changes dimension, disconnects, or opens an unexpected GUI.
  • An emergency stop key (default Backspace while building) in addition to the STOP button.

6. Code quality

  • Packages: dev.nexabuild.client (entry, commands), .config, .files (watcher, scanner, library index), .format (litematic, sponge, nbt, legacy loaders and the Schematic model), .build (plan, order, path, engine, tracker, settings), .render (iso preview, world ghost), .gui (screen, tab classes, widgets).
  • Split the giant GUI and BuildEngine only where needed for the new features; do not change engine behaviour without a reason, and note any change.
  • Javadoc on public classes. Unit tests (JUnit 5) for: each format loader against small generated fixtures, rotate/mirror/crop/swap transforms, BuildOrder, PathPlanner, file debounce logic, and preset JSON round-trips. Keep the existing tools/ Python helpers and update them for the new names.

7. Config (NexaBuild/nexabuild.json, load with defaults for missing keys, never crash on bad JSON: back up as .bak and regenerate)

enabled, disableOnMultiplayer, firstRunAccepted, watcher {enabled, pollFallback, debounceMs}, ghost {enabled, maxCells}, hud {corner, enabled}, defaults {order, speed, replaceMode, ignoreAir}, safety {minHealth, stopOnDamage}, ui {confirmDialogs, lastTab}.

8. Delivery format

Work in stages and make each stage compile before moving on: 1) rename and project setup, 2) config and folder system with watcher, 3) format loaders and the Schematic model, 4) PlacementSettings and BuildPlan changes, 5) menu and all tabs, 6) ghost preview, 7) commands, 8) safety, history, presets, tests.

For each stage: list the files changed, give complete code for every new or changed file, and finish with build, install, and usage instructions plus known limitations. State any 1.21.11 API assumption explicitly.

Kodari AI
KodariNov 9 at 5:29 pm 1

[Generation stopped]

Kodari can make mistakes. Review important code before using.
Files
auto-cc-1.0.0 (1).jar
Code
1 0