From 3d91fd7897209f24c172f25fe4331fcda156001d Mon Sep 17 00:00:00 2001 From: Adrian Siekierka Date: Sat, 3 Nov 2018 23:22:32 +0100 Subject: first commit --- src/main/java/net/fabricmc/example/ExampleMod.java | 14 ++++++++++++++ .../java/net/fabricmc/example/mixin/ExampleMixin.java | 15 +++++++++++++++ src/main/resources/mod.json | 11 +++++++++++ src/main/resources/modid.client.json | 12 ++++++++++++ src/main/resources/modid.common.json | 11 +++++++++++ 5 files changed, 63 insertions(+) create mode 100644 src/main/java/net/fabricmc/example/ExampleMod.java create mode 100644 src/main/java/net/fabricmc/example/mixin/ExampleMixin.java create mode 100644 src/main/resources/mod.json create mode 100644 src/main/resources/modid.client.json create mode 100644 src/main/resources/modid.common.json (limited to 'src') diff --git a/src/main/java/net/fabricmc/example/ExampleMod.java b/src/main/java/net/fabricmc/example/ExampleMod.java new file mode 100644 index 0000000..e5ed082 --- /dev/null +++ b/src/main/java/net/fabricmc/example/ExampleMod.java @@ -0,0 +1,14 @@ +package net.fabricmc.example; + +import net.fabricmc.api.ModInitializer; + +public class ExampleMod implements ModInitializer { + @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. + + System.out.println("Hello Fabric world!"); + } +} diff --git a/src/main/java/net/fabricmc/example/mixin/ExampleMixin.java b/src/main/java/net/fabricmc/example/mixin/ExampleMixin.java new file mode 100644 index 0000000..60b731f --- /dev/null +++ b/src/main/java/net/fabricmc/example/mixin/ExampleMixin.java @@ -0,0 +1,15 @@ +package net.fabricmc.example.mixin; + +import net.minecraft.client.MinecraftGame; +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(MinecraftGame.class) +public class ExampleMixin { + @Inject(at = @At("HEAD"), method = "init()V") + private void init(CallbackInfo info) { + System.out.println("This line is printed by an example mod mixin!"); + } +} diff --git a/src/main/resources/mod.json b/src/main/resources/mod.json new file mode 100644 index 0000000..f9dcafd --- /dev/null +++ b/src/main/resources/mod.json @@ -0,0 +1,11 @@ +{ + "id": "modid", + "name": "Example Mod", + "version": "1.0.0", + "side": "universal", + "initializer": "net.fabricmc.example.ExampleMod", + "mixins": { + "client": "modid.client.json", + "common": "modid.common.json" + } +} \ No newline at end of file diff --git a/src/main/resources/modid.client.json b/src/main/resources/modid.client.json new file mode 100644 index 0000000..d6fc9b4 --- /dev/null +++ b/src/main/resources/modid.client.json @@ -0,0 +1,12 @@ +{ + "required": true, + "package": "net.fabricmc.example.mixin", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "ExampleMixin" + ], + "refmap": "modid.refmap.json", + "injectors": { + "defaultRequire": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/modid.common.json b/src/main/resources/modid.common.json new file mode 100644 index 0000000..a39340e --- /dev/null +++ b/src/main/resources/modid.common.json @@ -0,0 +1,11 @@ +{ + "required": true, + "package": "net.fabricmc.example.mixin", + "compatibilityLevel": "JAVA_8", + "mixins": [ + ], + "refmap": "modid.refmap.json", + "injectors": { + "defaultRequire": 1 + } +} \ No newline at end of file -- cgit v1.2.3