Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ProfessorFichte/More-RPG-Classes/llms.txt

Use this file to discover all available pages before exploring further.

More RPG Library provides data generation helpers that make it easier to programmatically create advancements, weapon attributes, and other game data for your mod.

Overview

The library includes helpers for:
  • Spell Engine Advancements - Create spell-related advancements
  • Better Combat Weapon Attributes - Generate weapon attribute files
These helpers are designed to be used in your mod’s data generation phase.

Spell Engine Advancement Helper

The SpellEngineAdvancementHelper provides utilities for creating Spell Engine advancement criteria and advancement files.

Import

import net.more_rpg_classes.datagen.SpellEngineAdvancementHelper;
import net.more_rpg_classes.datagen.SpellEngineAdvancementHelper.AdvancementEntry;
import net.more_rpg_classes.datagen.SpellEngineAdvancementHelper.SpellEngineTrigger;

Available Triggers

The helper supports three Spell Engine triggers:
SpellEngineTrigger.SPELL_BOOK_CREATION  // "spell_engine:spell_book_creation"
SpellEngineTrigger.SPELL_BINDING        // "spell_engine:spell_binding"
SpellEngineTrigger.SPELL_CAST           // "spell_engine:spell_cast"

Creating Criteria

Spell Book Creation Criteria

Triggered when a player creates a spell book from a specific pool:
JsonObject criteria = SpellEngineAdvancementHelper.criteriaSpellBookCreation("#wizards:frost");
Generated JSON:
{
  "book": {
    "trigger": "spell_engine:spell_book_creation",
    "conditions": {
      "spell_pool": "#wizards:frost"
    }
  }
}

One Spell Bound Criteria

Triggered when a player binds at least one spell from a pool:
JsonObject criteria = SpellEngineAdvancementHelper.criteriaOneSpellBound("#wizards:fire");
Generated JSON:
{
  "bind": {
    "trigger": "spell_engine:spell_binding",
    "conditions": {
      "complete": false,
      "spell_pool": "#wizards:fire"
    }
  }
}

All Spells Bound Criteria

Triggered when a player binds all spells from a pool:
JsonObject criteria = SpellEngineAdvancementHelper.criteriaAllSpellsBound("#wizards:arcane");
Generated JSON:
{
  "bind": {
    "trigger": "spell_engine:spell_binding",
    "conditions": {
      "complete": true,
      "spell_pool": "#wizards:arcane"
    }
  }
}

Spell Cast Criteria

Triggered when a player casts a specific spell or any spell from a tag:
// Specific spell
JsonObject criteria = SpellEngineAdvancementHelper.criteriaSpellCast("wizards:fireball");

// Spell tag
JsonObject criteriaTag = SpellEngineAdvancementHelper.criteriaSpellCast("#wizards:frost");
Generated JSON:
{
  "cast": {
    "trigger": "spell_engine:spell_cast",
    "conditions": {
      "spell": "wizards:fireball"
    }
  }
}

Writing Advancement Files

Write a complete advancement JSON to a file:
Path outputPath = Paths.get("src/main/resources");
String modId = "your_mod";
String name = "frost_master";

JsonObject advancement = new JsonObject();
// ... build your advancement JSON

SpellEngineAdvancementHelper.writeAdvancement(outputPath, modId, name, advancement);
Output location:
src/main/resources/data/your_mod/advancement/frost_master.json

Advancement Entry Helper

Create advancement metadata with localization keys:
AdvancementEntry entry = new AdvancementEntry(
    "your_mod",
    "first_spell",
    "First Spell",
    "Bind your first spell"
);

Identifier id = entry.id();  // your_mod:first_spell
String titleKey = entry.titleKey();  // "advancements.your_mod.first_spell.title"
String descKey = entry.descriptionKey();  // "advancements.your_mod.first_spell.description"

Complete Example

Here’s a complete example of generating a spell advancement:
import com.google.gson.JsonObject;
import net.more_rpg_classes.datagen.SpellEngineAdvancementHelper;
import java.nio.file.Path;
import java.nio.file.Paths;

public class MyDatagen {
    public static void generateAdvancement() throws Exception {
        Path outputPath = Paths.get("src/main/resources");
        
        // Create advancement entry metadata
        var entry = new SpellEngineAdvancementHelper.AdvancementEntry(
            "my_mod",
            "frost_apprentice",
            "Frost Apprentice",
            "Bind your first frost spell"
        );
        
        // Build advancement JSON
        JsonObject advancement = new JsonObject();
        
        // Add parent (optional)
        JsonObject parent = new JsonObject();
        parent.addProperty("parent", "my_mod:root");
        advancement.add("parent", parent);
        
        // Add display
        JsonObject display = new JsonObject();
        display.addProperty("icon", "spell_engine:scroll");
        
        JsonObject title = new JsonObject();
        title.addProperty("translate", entry.titleKey());
        display.add("title", title);
        
        JsonObject description = new JsonObject();
        description.addProperty("translate", entry.descriptionKey());
        display.add("description", description);
        
        advancement.add("display", display);
        
        // Add criteria
        JsonObject criteria = SpellEngineAdvancementHelper.criteriaOneSpellBound("#wizards:frost");
        advancement.add("criteria", criteria);
        
        // Write to file
        SpellEngineAdvancementHelper.writeAdvancement(
            outputPath,
            entry.modId(),
            entry.name(),
            advancement
        );
    }
}

Better Combat Weapon Attribute Generator

The BetterCombatWeaponAttributeGenerator generates Better Combat weapon attribute files for your custom weapons.

Import

import net.more_rpg_classes.datagen.BetterCombatWeaponAttributeGenerator;

Basic Usage

Generate weapon attributes for a list of items:
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;

Path outputPath = Paths.get("src/main/resources");
String modId = "your_mod";

// Your weapon registry entries (RegistryObject, DeferredItem, etc.)
List<?> weapons = List.of(
    ModItems.CUSTOM_SWORD,
    ModItems.CUSTOM_AXE,
    ModItems.CUSTOM_STAFF
);

BetterCombatWeaponAttributeGenerator.generateBetterCombatWeaponAttributes(
    outputPath,
    modId,
    weapons,
    "bettercombat:sword"  // Parent attribute
);

With Name Filter

Generate attributes only for weapons matching a name pattern:
BetterCombatWeaponAttributeGenerator.generateBetterCombatWeaponAttributes(
    outputPath,
    modId,
    weapons,
    "staff",  // Only process items with "staff" in their ID
    "bettercombat:staff"
);

Parameters

outputPath

Type: Path Base output directory (usually src/main/resources).

modId

Type: String Your mod’s ID for the data folder path.

weaponEntries

Type: List<?> List of weapon registry entries. The generator supports entries with:
  • getId() method returning Identifier
  • id() method returning Identifier
  • item() or get() method returning an Item

nameFilter

Type: String (optional) Only process items whose ID contains this string. Use null to process all items.

parent

Type: String The Better Combat parent attribute to use. Common values:
  • "bettercombat:sword"
  • "bettercombat:axe"
  • "bettercombat:staff"
  • "bettercombat:claymore"
  • "bettercombat:dagger"

Output

Generated files are placed in:
src/main/resources/data/{modId}/weapon_attributes/{item_name}.json
Example file content:
{
  "parent": "bettercombat:staff"
}

Complete Example

import net.more_rpg_classes.datagen.BetterCombatWeaponAttributeGenerator;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;

public class MyWeaponDatagen {
    public static void generateWeaponAttributes() throws Exception {
        Path outputPath = Paths.get("src/main/resources");
        String modId = "my_rpg_mod";
        
        // Generate staff attributes
        BetterCombatWeaponAttributeGenerator.generateBetterCombatWeaponAttributes(
            outputPath,
            modId,
            ModItems.ALL_WEAPONS,
            "staff",
            "bettercombat:staff"
        );
        
        // Generate sword attributes
        BetterCombatWeaponAttributeGenerator.generateBetterCombatWeaponAttributes(
            outputPath,
            modId,
            ModItems.ALL_WEAPONS,
            "sword",
            "bettercombat:sword"
        );
        
        // Generate dagger attributes
        BetterCombatWeaponAttributeGenerator.generateBetterCombatWeaponAttributes(
            outputPath,
            modId,
            ModItems.ALL_WEAPONS,
            "dagger",
            "bettercombat:dagger"
        );
    }
}

Using in Fabric Data Generation

Integrate these helpers into Fabric’s data generation system:
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;

public class MyModDatagen implements DataGeneratorEntrypoint {
    @Override
    public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
        FabricDataGenerator.Pack pack = fabricDataGenerator.createPack();
        
        try {
            // Generate advancements
            generateMyAdvancements();
            
            // Generate weapon attributes
            BetterCombatWeaponAttributeGenerator.generateBetterCombatWeaponAttributes(
                fabricDataGenerator.getModContainer().getRootPaths().get(0),
                "my_mod",
                MyItems.WEAPONS,
                "bettercombat:sword"
            );
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    
    private void generateMyAdvancements() throws Exception {
        // Your advancement generation code
    }
}

Implementation Reference

Spell Engine Advancement Helper

net.more_rpg_classes.datagen.SpellEngineAdvancementHelper
Source: common/src/main/java/net/more_rpg_classes/datagen/SpellEngineAdvancementHelper.java:1

Better Combat Weapon Attribute Generator

net.more_rpg_classes.datagen.BetterCombatWeaponAttributeGenerator
Source: common/src/main/java/net/more_rpg_classes/datagen/BetterCombatWeaponAttributeGenerator.java:1
These helpers use Gson for JSON generation with pretty printing enabled, making the output human-readable.

Build docs developers (and LLMs) love