Перейти к содержимому
Mineforgian

Lodestone

An automatic content loader for Fabric mods.

12K загрузок8 подписчиковLGPL-3.0-or-laterfabric

Обновлён 30 июля 2025 г. · опубликован 11 июня 2024 г.

An automatic content loader for Fabric mods.

Usage

In order to use Lodestone directly, please ensure that you add it as a dependency for your mod. This mod does not add any content by itself.

Lodestone provides basic interfaces and APIs for easily registering modded content during initialization. The most important type provided is the Loaded interface, which the mod is built around. For a basic example, see the Cheese mod.

To create an automatically registered type, simply implement the target environment's associated interface.

/** An item that is loaded at runtime. */
public class LoadedItem extends Item implements CommonLoaded {

    // Required for all instances of `Loaded`. Allows Lodestone to group registered values by mod identifier.
    @Override
    public Identifier getLoaderId() {
        return Identifier.of(YourMod.MOD_ID, "your_item");
    }

    // A function that registers the value at runtime.
    @Override
    public void loadCommon() {
        Registry.register(Registries.ITEM, this.getLoaderId(), this);
    }

}

Each mod environment has its own dedicated interface:

  • CommonLoaded loads the value on the "common" environment, meaning both the client and the server.
  • ClientLoaded only loads the value on the client instance.
  • ServerLoaded only loads the value on the server instance.
  • DataGenerating only loads the value during Fabric's data generation task.

These are intended to be used within each mod initializer to load it properly.

public class YourMod implements ModInitializer {

    public static final String MOD_ID = "your_mod";
    public static final LoadedItem YOUR_ITEM = new LoadedItem(new Settings());

    @Override
    public void onInitialize() {
        // Registers this item for later loading.
        Lodestone.register(CommonLoaded.class, YOUR_ITEM);

        // Which is then done here.
        Lodestone.load(CommonLoaded.class, MOD_ID);
    }

}

Lodestone also provides an abstract class and two annotations for automatic registration of values.

public final class ItemLoader extends AutoLoader {

    @LoadingPriority(-1) // Controls the loading order. In this case, this loads last.
    public static final LoadedItem ITEM_1 = new LoadedItem("item_1", new Settings());
    public static final LoadedItem ITEM_2 = new LoadedItem("item_2", new Settings());
    public static final LoadedItem ITEM_3 = new LoadedItem("item_3", new Settings());
    public static final LoadedItem ITEM_4 = new LoadedItem("item_4", new Settings());
    public static final LoadedItem ITEM_5 = new LoadedItem("item_5", new Settings());

    @IgnoreLoading({ }) // Prevents this value from being loaded.
    public static final LoadedItem NULL = null;

    @Override
    public Identifier getLoaderId() {
        return Identifier.of(YourMod.MOD_ID, "items");
    }

}

This is then registered in a very similar way.

public class YourMod implements ModInitializer {

    public static final String MOD_ID = "your_mod";
    public static final ItemLoader ITEMS = new ItemLoader();

    @Override
    public void onInitialize() {
        // Registers all items for later loading.
        ITEMS.register();

        // Which is then done here.
        Lodestone.load(CommonLoaded.class, MOD_ID);
    }

}

Depending on Lodestone

Lodestone's sole purpose is to be used as a library for other mods. If you would like to depend on Lodestone for your Fabric mod, add the following to your Gradle manifest:

# gradle.properties

lodestone_version = 1.8.0
// build.gradle

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    modImplementation "com.github.Jaxydog:Lodestone:${project.lodestone_version}"

    // Or, to alternatively depend on the most recent commit:
    modImplementation 'com.github.Jaxydog:Lodestone:main-SNAPSHOT'
}

Lodestone should work with many older versions of Minecraft, but only the latest game version is guaranteed to have proper support. I am currently not interested in backporting to versions prior to roughly 1.18, but if you encounter any issues feel free to let me know anyway.

Версии

ВерсияКаналИграЗагрузчикиДатаСкачать
1.8.0Релиз1.21.5, 1.21.6, 1.21.7, 1.21.8fabric30 июля 2025 г..jar (25 КБ)
1.7.1Релиз1.21.4, 1.21.5, 1.21.6, 1.21.7fabric9 марта 2025 г..jar (22 КБ)
1.7.0Релиз1.21.4, 1.21.5, 1.21.6, 1.21.7fabric26 февраля 2025 г..jar (22 КБ)
1.6.0Релиз1.20.5, 1.20.6, 1.21, 1.21.1fabric5 октября 2024 г..jar (22 КБ)
1.5.3Релиз1.20.5, 1.20.6, 1.21, 1.21.1fabric4 октября 2024 г..jar (22 КБ)
1.5.3-rc1Бета1.20.5, 1.20.6, 1.21, 1.21.1fabric4 октября 2024 г..jar (22 КБ)
1.5.2Релиз1.20.5, 1.20.6, 1.21, 1.21.1fabric4 октября 2024 г..jar (22 КБ)
1.5.1Релиз1.21.1fabric31 августа 2024 г..jar (21 КБ)
1.5.0Релиз1.21fabric14 июня 2024 г..jar (21 КБ)
1.4.0Релиз1.21fabric13 июня 2024 г..jar (30 КБ)
1.3.0Релиз1.20.6fabric12 июня 2024 г..jar (30 КБ)
1.2.0Релиз1.20.6fabric12 июня 2024 г..jar (29 КБ)
1.1.2Релиз1.20.6fabric12 июня 2024 г..jar (28 КБ)
1.1.1Релиз1.20.6fabric12 июня 2024 г..jar (28 КБ)
1.1.0Релиз1.20.6fabric12 июня 2024 г..jar (28 КБ)

Показаны последние 15 из 17 версий. Все версии — на Modrinth.

Ченджлог

1.8.0Релиз1.21.6, 1.21.7, 1.21.8 · 30 июля 2025 г.

Create an additional class for usage with AutoLoaders.

Content Changes

  • Adds the AutoLoaded class; a wrapper that provides an API for applying load functions to generic types.
1.7.1Релиз1.21.5, 1.21.6, 1.21.7 · 9 марта 2025 г.

Fix the way that the library determines whether data generation is enabled.

Internal Changes

  • No longer assume that data generation can only happen server-side.
  • Check whether the fabric-api.datagen property exists at all, not just that it's non-null.
1.7.0Релиз1.21.5, 1.21.6, 1.21.7 · 26 февраля 2025 г.

Adjust internals to fix support for previous game versions.

Content Changes

  • Fix string type used in the readme's dependency example.
  • Add example for using latest commit as a dependency.
  • Removed the LodestoneTest mod.

Internal Changes

  • Lodestone no longer depends on fabric-api.
  • Bumped Gradle version to 8.12.
1.6.0Релиз1.20.6, 1.21, 1.21.1 · 5 октября 2024 г.

Minor improvements and validation improvements.

Content Changes

  • Improved the clarity and consistency of some log messages.
  • Slightly refactored code examples in the readme.

Internal Changes

  • Minor code style fixes.
  • Custom environments whose interface is annotated with @BundledLoader now cause an exception during runtime.
1.5.3Релиз1.20.6, 1.21, 1.21.1 · 4 октября 2024 г.

Updates Gradle tasks & versions.

Content Changes

  • Modrinth publishing task now sets all versions past 1.18.
  • Updated Gradle to 8.8.
  • Updated Loom to 1.7-SNAPSHOT.
  • Fix JitPack builds.

Internal Changes

  • Resolves two of the three documentation warnings during building.
1.5.3-rc1Бета1.20.6, 1.21, 1.21.1 · 4 октября 2024 г.

Updates Gradle tasks & versions.

Content Changes

  • Modrinth publishing task now sets all versions past 1.18.
  • Updated Gradle to 8.8.
  • Updated Loom to 1.7-SNAPSHOT.

Internal Changes

  • Resolves two of the three documentation warnings during building.
1.5.2Релиз1.20.6, 1.21, 1.21.1 · 4 октября 2024 г.

Makes dependency version requirements less strict.

Content Changes

  • Lodestone now runs on 1.18 or later, as long as you have sufficient dependency versions.
  • Added an explicit requirement for any version of fabric-data-generation-api-v1.
  • Lodestone now requires any Fabric loader version past 0.4.0.
  • Lodestone now requires at least Java 17 due to the usage of sealed types.
1.5.1Релиз1.21.1 · 31 августа 2024 г.

Update to 1.21.1

Content Changes

  • Updated required loader version to 0.16.3.

Полная история изменений — на Modrinth.

Комментарии

Загружаем…