Getting Started
What is Matthiesen Lib?
Section titled “What is Matthiesen Lib?”Matthiesen Lib is a lightweight Architectury-style library that enables mod developers to write shared code that works seamlessly across both Fabric and NeoForge mod loaders for Minecraft 1.21.1. Instead of maintaining separate implementations for each platform, you can write your mod logic once in common code and let Matthiesen Lib handle the platform-specific details.
Key Features
Section titled “Key Features”Matthiesen Lib provides a unified API for:
- Content Registration - Register blocks, items, block entities, sounds, creative tabs, and more from common code
- Command System - Create cross-platform commands with a simple abstraction layer
- Permission System - Unified permission validation across both platforms
- Client-Side Features - Register screens, entity renderers, HUD layers, and custom block outlines
- Embers Text API Integration - Send immersive messages using Ember’s Text API with a cross-platform compatibility layer
- Utility Classes - ItemBuilder, screen abstractions, and other helpful utilities
Why Use Matthiesen Lib?
Section titled “Why Use Matthiesen Lib?”Write Once, Run Everywhere
Section titled “Write Once, Run Everywhere”Instead of maintaining separate Fabric and NeoForge implementations:
// With Matthiesen Lib - Write once in common codepublic static final RegistryBuilder REGISTRY = new MatthiesenLib.RegistryBuilder("mymod");
public static final Supplier<Item> MY_ITEM = REGISTRY.registerItem( "my_item", () -> new Item(new Item.Properties()));Simplified Multi-Loader Development
Section titled “Simplified Multi-Loader Development”- Automatic Namespace Prefixing - The RegistryBuilder automatically adds your mod ID to all registered content
- Platform Abstraction - Access platform-specific features through a common API
- Unified Initialization - One initialization flow that works on both loaders
Quick Start
Section titled “Quick Start”To start using Matthiesen Lib in your mod:
- Add the dependency - See Installation
- Create registry classes - Extend the appropriate abstract registry classes
- Register your content - Use the registry instances to register items, blocks, etc.
- Initialize registries - Call the
init()methods during mod startup
package dev.matthiesen.common.mymod.registry;
import dev.matthiesen.common.matthiesen_lib.registry.AbstractItemRegistry;import net.minecraft.world.item.Item;import java.util.function.Supplier;
public class ItemRegistry extends AbstractItemRegistry { private static final ItemRegistry INSTANCE = new ItemRegistry();
protected ItemRegistry() { super("mymod"); }
public static void init() {}
public static final Supplier<Item> EXAMPLE_ITEM;
static { EXAMPLE_ITEM = INSTANCE.register("example_item", () -> new Item(new Item.Properties())); }}
// In your mod initializerpublic class MyMod { public void initialize() { ItemRegistry.init(); }}Next Steps
Section titled “Next Steps” Learn how to set up Matthiesen Lib in your development environment with the Installation Guide.
Explore the Registry Builder API to see how to register content from common code.
Check out the Commands page to learn how to create cross-platform commands.
Find out how to implement permissions with the Permissions system.
Discover how to register client-side features like screens and renderers in the Client-Side Features section.
Integrate with the Embers Text API for immersive messaging with the Embers Integration guide.
Utilize helpful utilities like the ItemBuilder in the Utilities section.