First step to my own mod

This commit is contained in:
c0de 2023-03-20 18:02:32 -05:00
parent eab1b6b7a0
commit 3185cfb26d
7 changed files with 34 additions and 35 deletions

View File

@ -0,0 +1,19 @@
package dev.c0de.minecraft;
import net.fabricmc.api.ModInitializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class c0deFoxMod implements ModInitializer {
public static final Logger LOGGER = LoggerFactory.getLogger("c0defox");
@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 world!");
}
}

View File

@ -1,6 +1,6 @@
package net.fabricmc.example.mixin; package dev.c0de.minecraft.mixin;
import net.fabricmc.example.ExampleMod; import dev.c0de.minecraft.c0deFoxMod;
import net.minecraft.client.gui.screen.TitleScreen; import net.minecraft.client.gui.screen.TitleScreen;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
@ -8,9 +8,10 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(TitleScreen.class) @Mixin(TitleScreen.class)
public class ExampleMixin { public class c0deFoxMixin {
@Inject(at = @At("HEAD"), method = "init()V") @Inject(at = @At("HEAD"), method = "init()V")
private void init(CallbackInfo info) { private void init(CallbackInfo info) {
ExampleMod.LOGGER.info("This line is printed by an example mod mixin!"); c0deFoxMod.LOGGER.info("This line is printed by an example mod mixin!");
} }
} }

View File

@ -1,21 +0,0 @@
package net.fabricmc.example;
import net.fabricmc.api.ModInitializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ExampleMod implements ModInitializer {
// 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("modid");
@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!");
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 453 B

View File

@ -1,12 +1,12 @@
{ {
"required": true, "required": true,
"minVersion": "0.8", "minVersion": "0.8",
"package": "net.fabricmc.example.mixin", "package": "dev.c0de.minecraft.mixin",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_17",
"mixins": [ "mixins": [
], ],
"client": [ "client": [
"ExampleMixin" "c0deFoxMixin"
], ],
"injectors": { "injectors": {
"defaultRequire": 1 "defaultRequire": 1

View File

@ -1,25 +1,25 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"id": "modid", "id": "c0defox",
"version": "${version}", "version": "${version}",
"name": "Example Mod", "name": "c0de's client mod",
"description": "This is an example description! Tell everyone what your mod is about!", "description": "Various tweaks and functions to play around with minecraft",
"authors": [ "authors": [
"Me!" "c0de"
], ],
"contact": { "contact": {
"homepage": "https://fabricmc.net/", "homepage": "https://c0defox.es",
"sources": "https://github.com/FabricMC/fabric-example-mod" "sources": "https://c0de.dev/c0de/minecraft-mod"
}, },
"license": "CC0-1.0", "license": "MIT",
"icon": "assets/modid/icon.png", "icon": "assets/modid/icon.png",
"environment": "*", "environment": "*",
"entrypoints": { "entrypoints": {
"main": [ "main": [
"net.fabricmc.example.ExampleMod" "dev.c0de.minecraft.c0deFoxMod"
] ]
}, },
"mixins": [ "mixins": [