summary refs log tree commit diff stats
path: root/src/main
diff options
context:
space:
mode:
authornatanfudge <natan.lifsiz@gmail.com>2019-07-27 11:36:27 +0300
committernatanfudge <natan.lifsiz@gmail.com>2019-07-27 11:36:27 +0300
commitdfcc029c91454fd9d157c30f524f23c1a0e99ed5 (patch)
tree45ebc50566882780e4c642471f8e71ff37d714f5 /src/main
first commit
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/net/fabricmc/example/mixin/ExampleMixin.java16
-rw-r--r--src/main/kotlin/net/fabricmc/example/ExampleMod.kt12
-rw-r--r--src/main/resources/assets/modid/icon.pngbin0 -> 453 bytes
-rw-r--r--src/main/resources/fabric.mod.json36
-rw-r--r--src/main/resources/modid.mixins.json13
5 files changed, 77 insertions, 0 deletions
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..fe09c76
--- /dev/null
+++ b/src/main/java/net/fabricmc/example/mixin/ExampleMixin.java
@@ -0,0 +1,16 @@
+package net.fabricmc.example.mixin;
+
+import net.minecraft.client.MinecraftClient;
+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(MinecraftClient.class)
+// Mixins HAVE to be written in java due to constraints in the mixin system.
+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/kotlin/net/fabricmc/example/ExampleMod.kt b/src/main/kotlin/net/fabricmc/example/ExampleMod.kt
new file mode 100644
index 0000000..aebbd4b
--- /dev/null
+++ b/src/main/kotlin/net/fabricmc/example/ExampleMod.kt
@@ -0,0 +1,12 @@
+package net.fabricmc.example
+
+
+@Suppress("unused")
+fun init() {
+    // 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.
+
+    println("Hello Fabric world!")
+}
+
diff --git a/src/main/resources/assets/modid/icon.png b/src/main/resources/assets/modid/icon.png
new file mode 100644
index 0000000..047b91f
--- /dev/null
+++ b/src/main/resources/assets/modid/icon.png
Binary files differdiff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json
new file mode 100644
index 0000000..24acc5e
--- /dev/null
+++ b/src/main/resources/fabric.mod.json
@@ -0,0 +1,36 @@
+{
+  "schemaVersion": 1,
+  "id": "modid",
+  "version": "${version}",
+
+  "name": "Example Mod",
+  "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/modid/icon.png",
+
+  "environment": "*",
+  "entrypoints": {
+    "main": [
+      "net.fabricmc.example.ExampleModKt::init"
+    ]
+  },
+  "mixins": [
+    "modid.mixins.json"
+  ],
+
+  "depends": {
+    "fabricloader": ">=0.4.0",
+    "fabric": "*"
+  },
+  "suggests": {
+    "flamingo": "*"
+  }
+}
diff --git a/src/main/resources/modid.mixins.json b/src/main/resources/modid.mixins.json
new file mode 100644
index 0000000..e243f0a
--- /dev/null
+++ b/src/main/resources/modid.mixins.json
@@ -0,0 +1,13 @@
+{
+  "required": true,
+  "package": "net.fabricmc.example.mixin",
+  "compatibilityLevel": "JAVA_8",
+  "mixins": [
+  ],
+  "client": [
+    "ExampleMixin"
+  ],
+  "injectors": {
+    "defaultRequire": 1
+  }
+}