basic mod template

This commit is contained in:
Jottyfan
2026-07-03 23:43:41 +02:00
parent 86a845fbf6
commit 092bf02339
14 changed files with 571 additions and 37 deletions
@@ -0,0 +1,30 @@
package de.jottyfan.minecraft;
import net.fabricmc.api.ModInitializer;
import net.minecraft.resources.Identifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Mfmd2627 implements ModInitializer {
public static final String MOD_ID = "mfmd2627";
// This logger is used to write text to the console and the log file.
// It is considered best practice to use your mod id as the logger's name.
// That way, it's clear which mod wrote info, warnings, and errors.
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
@Override
public void onInitialize() {
// This code runs as soon as Minecraft is in a mod-load-ready state.
// However, some things (like resources) may still be uninitialized.
// Proceed with mild caution.
LOGGER.info("Hello Fabric world!");
}
public static Identifier id(String path) {
return Identifier.fromNamespaceAndPath(MOD_ID, path);
}
}
@@ -0,0 +1,15 @@
package de.jottyfan.minecraft.mixin;
import net.minecraft.server.MinecraftServer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(MinecraftServer.class)
public class ExampleMixin {
@Inject(at = @At("HEAD"), method = "loadLevel")
private void init(CallbackInfo info) {
// This code is injected into the start of MinecraftServer.loadLevel()V
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

+31
View File
@@ -0,0 +1,31 @@
{
"schemaVersion": 1,
"id": "mfmd2627",
"version": "${version}",
"name": "mfmd2627",
"description": "This is an example description! Tell everyone what your mod is about!",
"authors": [
"Me!"
],
"contact": {
"homepage": "https://fabricmc.net/",
"sources": "https://github.com/FabricMC/fabric-example-mod"
},
"license": "CC0-1.0",
"icon": "assets/mfmd2627/icon.png",
"environment": "*",
"entrypoints": {
"main": [
"de.jottyfan.minecraft.Mfmd2627"
]
},
"mixins": [
"mfmd2627.mixins.json"
],
"depends": {
"fabricloader": ">=0.19.3",
"minecraft": "~26.2",
"java": ">=25",
"fabric-api": "*"
}
}
+14
View File
@@ -0,0 +1,14 @@
{
"required": true,
"package": "de.jottyfan.minecraft.mixin",
"compatibilityLevel": "JAVA_25",
"mixins": [
"ExampleMixin"
],
"injectors": {
"defaultRequire": 1
},
"overwrites": {
"requireAnnotations": true
}
}