Matthiesen Core
A library mod for NeoForge and Fabric that enables developers to create mods with a shared common codebase.
介绍
Matthiesen Core
Matthiesen Core is a library mod for NeoForge and Fabric that enables developers to create mods with a shared common codebase.
It provides a set of core functionalities and utilities that can be used across multiple mods, allowing for easier development and maintenance.
Instead of maintaining separate implementations for each platform, you can write your mod logic once in common code and let Matthiesen core
handle the platform-specific details.
Matthiesen Core does not have to be installed on the client if the mod depending on it is server-side only. However, if the mod(s) that depend
on Matthiesen Core have client-side components, then Matthiesen Core must be installed on the client as well.
Note: For regular users, This library does nothing on its own aside from setting up the core functionality for other mods to utilize.
If you are not a mod developer, simply drop the mod in your
mods/folder alongside the other mods that depend on it, and you are good to go.
Matthiesen Core is the successor to Matthiesen Lib and Matthiesen Lib Api, which
were two separate libraries that have now been combined into a single unified library mod, that provides a more streamlined and efficient experience for mod developers.
Features
Matthiesen Core provides a unified API for:
- Content Registration: Register blocks, items, entities, and other game content in a platform-agnostic way.
- Event Handling: Listen to and handle game events across different platforms.
- Networking: Send and receive network packets between the client and server.
- Configuration Management: Manage mod configurations and settings in a consistent manner.
- Utility Functions: Access a variety of utility functions for common tasks, such as logging, resource management, and more.
- Client-Side Features: Includes client-specific features like HUD management, keybinding handling, and screen management.
- Permission Management: Provides a permission system for managing access to certain features or commands.
Required Dependencies
- Fabric API (Fabric only)
- Forge Config API Port (Fabric only)
Optional Dependencies
- Adventure Platform Mod
- Ember’s Text API
- Impactor
- LuckPerms
- Minecraft SQLite JDBC
- Minecraft MySQL JDBC
- Fabric Permissions API (Fabric only)
Version Compatibility
| Minecraft Version | Fabric Version | NeoForge Version | Mod Version |
|——————-|—————-|——————|————-|
| 1.21.1 | 0.17.2+ | 21.1.182+ | 1.x.x |
| 1.21.1 | 0.18.4+ | 21.1.234+ | 2.x.x |
Developer Quick Start
Matthiesen Core development versions and sources are available from Matthiesen Dev Maven.
Gradle
Step 1: Add the Maven repository to your build.gradle.kts file
repositories {
maven("https://maven.matthiesen.dev/releases") {
name = "devMatthiesenMaven-releases"
}
// For Snapshot versions, also include the snapshots repository
maven("https://maven.matthiesen.dev/snapshots") {
name = "devMatthiesenMaven-snapshots"
}
}
Step 2: Add the version property to your gradle.properties file
matthiesen_core_version=2.x.x
Note: Replace
2.x.xwith the latest version of Matthiesen Core. You can find the latest version on Matthiesen Dev Maven or see the table below for the latest version.
| Release Type | Version Badge |
|————–|————————————————————————————————————————————————|
| Latest Release | |
Step 3: Add the dependency to your build.gradle.kts file
// In common/build.gradle.kts
dependencies {
modImplementation("dev.matthiesen:matthiesen-core-common:${property("matthiesen_core_version")}") {
isTransitive = false
}
}
// In fabric/build.gradle.kts
dependencies {
modImplementation("dev.matthiesen:matthiesen-core-fabric:${property("matthiesen_core_version")}") {
isTransitive = false
}
}
// In neoforge/build.gradle.kts
dependencies {
modImplementation("dev.matthiesen:matthiesen-core-neoforge:${property("matthiesen_core_version")}") {
isTransitive = false
}
}
Step 4: Loader-specific Dependency Setup
For Fabric and NeoForge, you will need to add the appropriate loader-specific dependency to your mod metadata file (e.g., fabric.mod.json for Fabric or neoforge.mods.toml for NeoForge). This ensures that the correct version of Matthiesen Core is loaded alongside your mod.
Fabric Example (fabric.mod.json):
{
"depends": {
"matthiesen_core": ">=2.x.x"
}
}
NeoForge Example (neoforge.mods.toml):
[[dependencies.yourmodid]]
modId = "matthiesen_core"
type = "required"
versionRange = "[2.x.x,)"
ordering = "AFTER"
side = "BOTH"
Step 5: Sync your project and set up your common mod codebase to use Matthiesen Core’s APIs for content registration, event handling, networking, and other features.
AbstractCommonMod: Extend the AbstractCommonMod class in your common mod codebase to leverage Matthiesen Core’s core functionalities. This class provides a foundation for your mod, allowing you to focus on implementing your mod’s unique features while Matthiesen Core handles the platform-specific details.
package com.example.mymod;
import dev.matthiesen.matthiesen_core.common.AbstractCommonMod;
import dev.faststats.Token;
import org.jetbrains.annotations.Nullable;
public final class ExampleModCommon extends AbstractCommonMod {
public static final String MOD_ID = "examplemod";
public static final String MOD_NAME = "Example Mod";
public static final ExampleModCommon INSTANCE = new ExampleModCommon();
private ExampleModCommon() {
super(MOD_ID, MOD_NAME);
}
@Override
public @Nullable @Token String getMetricsToken() {
return null;
}
@Override
public void initialize() {
super.initialize();
createInfoLog("Initializing Example Mod Common...");
}
}
AbstractCommonClientMod: Extend the AbstractCommonClientMod class in your client mod codebase to leverage Matthiesen Core’s client-specific features. This class provides a foundation for your client-side mod, allowing you to focus on implementing your mod’s unique client-side features while Matthiesen Core handles the platform-specific details.
package com.example.mymod.client;
import dev.matthiesen.matthiesen_core.common.AbstractCommonClientMod;
import com.example.mymod.ExampleModCommon;
public final class ExampleModCommonClient extends AbstractCommonClientMod {
public static final ExampleModCommonClient INSTANCE = new ExampleModCommonClient();
private ExampleModCommonClient() {
super(ExampleModCommon.INSTANCE);
}
@Override
public void initialize() {
createInfoLog("Initializing Example Mod Common Client logic...");
}
}
Further Reading
Documentation for this mod can be found at mods.matthiesen.dev
FastStats Metrics
This mod uses FastStats to collect anonymous usage statistics. This helps the developer understand
how this mod is being used and improve it over time. You can learn more about the data collected and how it is used by visiting
FastStats: Information.
You can also view the data collected by this mod on the FastStats: Matthiesen Core page.
To opt out of this data collection, set the enabled property to false in the <game_directory>/config/faststats/config.properties file.
License
MIT – see LICENSE.
常见问题
Matthiesen Core 支持哪些 Minecraft 版本?
Matthiesen Core 支持 Minecraft Java 版 1.21.1,可用的加载器:Fabric / NeoForge。下载时注意选择和你游戏版本一致的文件。
Matthiesen Core 怎么安装?
先用 PCL2 或 HMCL 启动器安装对应版本的 Fabric / NeoForge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。运行环境:客户端和服务端都要装。
Adammatthiesen 的其他作品
查看全部 →
Cobblemon Move Tutor
Adds a Cobblemon NPC for Tutor moves!
Cobblemon Pokestops
This mod adds Pokemon GO inspired Pokestops to Cobblemon. Pokestops can be used to get items, and they have a cooldown period after being used.
Cobblemon Escape Rope
A lightweight Cobblemon add-on that adds an Escape Rope item for returning to the last safe place where you were under open sky.
CobbleStops
A PokeStop DataPack and Resource Pack for Cobblemon 1.7
评论
登录后评论和评分