Richart3855

Hi, can you build me a mod, with wich i can edit a datapack of a world ingame, like vscode maybe you can create like an web link because i also want to have the spyglass plugin or something similar

Kodari AI
KodariApr 20 at 11:54 am 16,077 (v2)

I’ll create a comprehensive in-game datapack editor with a web-based interface.

DatapackStudio
A Fabric mod that provides a web-based in-game editor for datapacks. Features a built-in web server serving a Monaco Editor (VSCode engine) interface for editing datapack files with syntax highlighting, auto-completion, and validation. Browse datapack files, edit JSON/functions, and reload changes instantly. Access via command that opens your browser to the local editing interface. Perfect for rapid datapack development without leaving the game.

Now I’ll create the complete datapack editor mod with web-based interface.

Perfect! I’ve created a complete Fabric mod that provides a web-based datapack editor with the following features:

✨ Key Features:

  • Monaco Editor (VSCode engine) with syntax highlighting for JSON and mcfunction files

  • File browser showing all datapack files in your world

  • Live editing with auto-save support (Ctrl+S)

  • Instant reload - reload datapacks without leaving the editor

  • Security - only edits files within the datapacks folder

  • Easy access - /dps or /datapackstudio command opens your browser automatically

🎮 How to Use:

  1. Build with ./gradlew build

  2. Start your Minecraft server/world

  3. Run /dps (requires OP level 2)

  4. Browser opens to http://localhost:8080

  5. Edit any datapack file, save, and reload!

⚙️ Configuration: Edit config/datapackstudio.json to change:

  • Port (default: 8080)

  • Auto-open browser setting

  • Max file size limits

The editor supports JSON validation, syntax highlighting, and works with all datapack file types (recipes, advancements, functions, loot tables, etc.)

Richart3855

kannst du bitte außerdem hinzufügen das man ein datapack template mit versionsselector erstellen kann und irgendwo eine einbindung für mcstacker https://mcstacker.net/ und misode https://misode.github.io/ hat

Kodari AI
KodariApr 20 at 12:00 pm 21,125 (v2)

Ich werde die folgenden Features hinzufügen:

  1. Datapack Template Creator mit Versionsauswahl

  2. Integrierte Tools (MCStacker und Misode) dir

Perfekt! Ich habe folgende Features hinzugefügt:

✨ Neue Features:

  1. Datapack Template Creator mit Versionsauswahl (1.21.4 bis 1.16.5)

    • Erstellt komplette Datapack-Struktur mit pack.mcmeta, load/tick functions, Tags, Beispiel-Recipe und Advancement

    • Automatische pack_format Auswahl basierend auf der Minecraft-Version

  2. Integrierte Tools direkt im Editor:

  3. “Neues Datapack” Button öffnet ein Modal mit:

    • Datapack Name Eingabe

    • Namespace Eingabe

    • Minecraft Version Dropdown (18 Versionen unterstützt)

Die neuen Buttons sind direkt im Header der Sidebar integriert und die Oberfläche ist jetzt auf Deutsch! 🇩🇪

Richart3855

The compilation failed with this error:

code
Compilation failed with 10 error(s):

ERROR in src/main/java/com/datapackstudio/util/DatapackUtil.java at line 18: cannot find symbol
        Path datapacksPath = server.getSavePath(net.minecraft.world.level.storage.LevelResource.DATAPACK_DIR);
                                                                                 ^
  symbol: class LevelResource
  location: package net.minecraft.world.level.storage

ERROR in src/main/java/com/datapackstudio/util/DatapackUtil.java at line 51: cannot find symbol
        Path datapacksPath = server.getSavePath(net.minecraft.world.level.storage.LevelResource.DATAPACK_DIR);
                                                                                 ^
  symbol: class LevelResource
  location: package net.minecraft.world.level.storage

ERROR in src/main/java/com/datapackstudio/util/DatapackUtil.java at line 71: cannot find symbol
        Path datapacksPath = server.getSavePath(net.minecraft.world.level.storage.LevelResource.DATAPACK_DIR);
                                                                                 ^
  symbol: class LevelResource
  location: package net.minecraft.world.level.storage

ERROR in src/main/java/com/datapackstudio/server/handler/TemplateHandler.java at line 38: cannot find symbol
            Path datapackPath = server.getSavePath(net.minecraft.world.level.storage.LevelResource.DATAPACK_DIR)
                                                                                    ^
  symbol: class LevelResource
  location: package net.minecraft.world.level.storage

ERROR in src/main/java/com/datapackstudio/server/handler/ReloadHandler.java at line 31: cannot find symbol
                server.reloadResources(server.getDataPackContents().getResourceManager().streamResourcePacks().toList());
                                             ^
  symbol: method getDataPackContents()
  location: variable server of type MinecraftServer

ERROR in   src/main/java/com/datapackstudio/util/DatapackUtil.java at line 18: cannot find symbol
          Path datapacksPath = server.getSavePath(net.minecraft.world.level.storage.LevelResource.DATAPACK_DIR);
                                                                                   ^
  symbol: class LevelResource
  location: package net.minecraft.world.level.storage

ERROR in   src/main/java/com/datapackstudio/util/DatapackUtil.java at line 51: cannot find symbol
          Path datapacksPath = server.getSavePath(net.minecraft.world.level.storage.LevelResource.DATAPACK_DIR);
                                                                                   ^
  symbol: class LevelResource
  location: package net.minecraft.world.level.storage

ERROR in   src/main/java/com/datapackstudio/util/DatapackUtil.java at line 71: cannot find symbol
          Path datapacksPath = server.getSavePath(net.minecraft.world.level.storage.LevelResource.DATAPACK_DIR);
                                                                                   ^
  symbol: class LevelResource
  location: package net.minecraft.world.level.storage

ERROR in   src/main/java/com/datapackstudio/server/handler/TemplateHandler.java at line 38: cannot find symbol
              Path datapackPath = server.getSavePath(net.minecraft.world.level.storage.LevelResource.DATAPACK_DIR)
                                                                                      ^
  symbol: class LevelResource
  location: package net.minecraft.world.level.storage

ERROR in   src/main/java/com/datapackstudio/server/handler/ReloadHandler.java at line 31: cannot find symbol
                  server.reloadResources(server.getDataPackContents().getResourceManager().streamResourcePacks().toList());
                                               ^
  symbol: method getDataPackContents()
  location: variable server of type MinecraftServer


=== COMPILATION ERROR ANALYSIS ===

MISSING CLASSES:
  - LevelResource
ACTION: Create these classes or check imports

MISSING METHODS:
  - getDataPackContents()
ACTION: Check method names and signatures

FILES TO INVESTIGATE:
  - src/main/java/com/datapackstudio/util/DatapackUtil.java
  - src/main/java/com/datapackstudio/server/handler/TemplateHandler.java
  - src/main/java/com/datapackstudio/server/handler/ReloadHandler.java
  -   src/main/java/com/datapackstudio/util/DatapackUtil.java
  -   src/main/java/com/datapackstudio/server/handler/TemplateHandler.java
  -   src/main/java/com/datapackstudio/server/handler/ReloadHandler.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariApr 20 at 12:02 pm 8,576 (v2)

I see the issue - I used Mojmap names instead of Yarn mappings. Let me read the breaking changes guide and fix the compilation errors.

Now I’ll fix the Yarn mapping errors. The issues are:

  1. LevelResource.DATAPACK_DIR (Mojmap) → WorldSavePath.DATAPACKS (Yarn)

  2. getDataPackContents() (Mojmap) → Need to use command-based reload

Perfekt! Ich habe die Yarn-Mapping-Fehler behoben:

✅ Fixes:

  1. LevelResource.DATAPACK_DIR → LevelStorage.WorldSavePath.DATAPACKS (korrekte Yarn-Mappings)

  2. getDataPackContents() → Command-basiertes Reload mit /reload Befehl

  3. Alle imports korrigiert

Der Mod sollte jetzt kompilieren! 🎉

Richart3855

The compilation failed with this error:

code
Compilation failed with 8 error(s):

ERROR in src/main/java/com/datapackstudio/util/DatapackUtil.java at line 19: cannot find symbol
        Path datapacksPath = server.getSavePath(LevelStorage.WorldSavePath.DATAPACKS);
                                                            ^
  symbol: variable WorldSavePath
  location: class LevelStorage

ERROR in src/main/java/com/datapackstudio/util/DatapackUtil.java at line 52: cannot find symbol
        Path datapacksPath = server.getSavePath(LevelStorage.WorldSavePath.DATAPACKS);
                                                            ^
  symbol: variable WorldSavePath
  location: class LevelStorage

ERROR in src/main/java/com/datapackstudio/util/DatapackUtil.java at line 72: cannot find symbol
        Path datapacksPath = server.getSavePath(LevelStorage.WorldSavePath.DATAPACKS);
                                                            ^
  symbol: variable WorldSavePath
  location: class LevelStorage

ERROR in src/main/java/com/datapackstudio/server/handler/TemplateHandler.java at line 39: cannot find symbol
            Path datapackPath = server.getSavePath(LevelStorage.WorldSavePath.DATAPACKS)
                                                               ^
  symbol: variable WorldSavePath
  location: class LevelStorage

ERROR in   src/main/java/com/datapackstudio/util/DatapackUtil.java at line 19: cannot find symbol
          Path datapacksPath = server.getSavePath(LevelStorage.WorldSavePath.DATAPACKS);
                                                              ^
  symbol: variable WorldSavePath
  location: class LevelStorage

ERROR in   src/main/java/com/datapackstudio/util/DatapackUtil.java at line 52: cannot find symbol
          Path datapacksPath = server.getSavePath(LevelStorage.WorldSavePath.DATAPACKS);
                                                              ^
  symbol: variable WorldSavePath
  location: class LevelStorage

ERROR in   src/main/java/com/datapackstudio/util/DatapackUtil.java at line 72: cannot find symbol
          Path datapacksPath = server.getSavePath(LevelStorage.WorldSavePath.DATAPACKS);
                                                              ^
  symbol: variable WorldSavePath
  location: class LevelStorage

ERROR in   src/main/java/com/datapackstudio/server/handler/TemplateHandler.java at line 39: cannot find symbol
              Path datapackPath = server.getSavePath(LevelStorage.WorldSavePath.DATAPACKS)
                                                                 ^
  symbol: variable WorldSavePath
  location: class LevelStorage


=== COMPILATION ERROR ANALYSIS ===

FILES TO INVESTIGATE:
  - src/main/java/com/datapackstudio/util/DatapackUtil.java
  - src/main/java/com/datapackstudio/server/handler/TemplateHandler.java
  -   src/main/java/com/datapackstudio/util/DatapackUtil.java
  -   src/main/java/com/datapackstudio/server/handler/TemplateHandler.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariApr 20 at 12:05 pm 5,836 (v2)

I need to find the correct Yarn mapping for the datapacks path. Let me check the existing code and fix the import.

I see the issue - WorldSavePath is not a nested class of LevelStorage. It’s a separate class that needs to be imported. Let me fix this:

✅ Fixed: Der korrekte Yarn-Import ist net.minecraft.util.WorldSavePath, nicht LevelStorage.WorldSavePath. Jetzt sollte der Mod kompilieren!

Richart3855

wie kann ich diese ui nun öffnen

Kodari AI
KodariApr 20 at 12:12 pm 4,065 (v2)

Ich muss mir die Command- und Webserver-Dateien ansehen, um zu verstehen, wie die UI geöffnet wird.

Perfekt! Die UI ist ganz einfach zu öffnen:

🎮 So öffnest du die Datapack Studio UI:

  1. Starte deine Minecraft-Welt (Singleplayer oder Server)

  2. Gib einen dieser Commands ein:

    Plain Text
    /dps
    

    oder

    Plain Text
    /datapackstudio
    
  3. Der Browser öffnet sich automatisch mit der Editor-UI!


📝 Was passiert im Hintergrund:

  • ✅ Der Webserver startet automatisch beim Start der Welt

  • ✅ Standard-Port: 8080 (konfigurierbar)

  • ✅ Der Command öffnet: http://localhost:8080

  • ✅ Du kannst auch manuell die URL im Browser öffnen


🔧 Falls der Browser nicht automatisch öffnet:

Wenn du die Fehlermeldung siehst, dass der Browser nicht geöffnet werden konnte, wird dir die URL im Chat angezeigt. Kopiere sie einfach und öffne sie manuell in deinem Browser.


⚙️ Port ändern (optional):

Der Port wird in der Config-Datei gespeichert. Lass mich schnell schauen, wo genau:

Die Config-Datei wird automatisch erstellt unter:

Plain Text
config/datapackstudio.json

Mit diesen Standard-Einstellungen:

JSON
{
  "port": 8080,
  "autoOpenBrowser": true,
  "enableSyntaxValidation": true,
  "maxFileSize": 5242880
}

Du kannst den Port dort ändern, falls 8080 schon belegt ist! 🚀

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
20 1,342
src/main/java/com/datapackstudio/DatapackStudio.java
package com.datapackstudio;

import com.datapackstudio.command.EditorCommand;
import com.datapackstudio.config.ConfigManager;
import com.datapackstudio.server.WebServerManager;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DatapackStudio implements ModInitializer {
    public static final String MOD_ID = "datapackstudio";
    public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
    private static WebServerManager webServerManager;

    @Override
    public void onInitialize() {
        LOGGER.info("Initializing Datapack Studio");
        
        ConfigManager.load();
        
        CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
            EditorCommand.register(dispatcher);
        });
        
        ServerLifecycleEvents.SERVER_STARTED.register(server -> {
            webServerManager = new WebServerManager(server);
            if (webServerManager.start()) {
                LOGGER.info("Datapack Studio web server started on port {}", ConfigManager.getConfig().port);
            } else {
                LOGGER.error("Failed to start Datapack Studio web server");
            }
        });
        
        ServerLifecycleEvents.SERVER_STOPPING.register(server -> {
            if (webServerManager != null) {
                webServerManager.stop();
                LOGGER.info("Datapack Studio web server stopped");
            }
        });
    }

    public static WebServerManager getWebServerManager() {
        return webServerManager;
    }
}