aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/example
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/com/example')
-rw-r--r--src/main/kotlin/com/example/ExampleMod.kt25
-rw-r--r--src/main/kotlin/com/example/mixin/MixinGuiMainMenu.java16
2 files changed, 41 insertions, 0 deletions
diff --git a/src/main/kotlin/com/example/ExampleMod.kt b/src/main/kotlin/com/example/ExampleMod.kt
new file mode 100644
index 0000000..ad0feff
--- /dev/null
+++ b/src/main/kotlin/com/example/ExampleMod.kt
@@ -0,0 +1,25 @@
+package com.example
+
+import net.minecraft.client.Minecraft
+import net.minecraft.init.Blocks
+import net.minecraftforge.fml.common.Mod
+import net.minecraftforge.fml.common.event.FMLInitializationEvent
+import net.minecraft.client.renderer.GlStateManager
+
+@Mod(modid = "examplemod", useMetadata = true)
+class ExampleMod {
+ @Mod.EventHandler
+ fun init(event: FMLInitializationEvent) {
+ try {
+ val resource: net.minecraft.client.resources.IResource = Minecraft.getMinecraft().getResourceManager()
+ .getResource(net.minecraft.util.ResourceLocation("test:test.txt"))
+ org.apache.commons.io.IOUtils.copy(resource.getInputStream(), java.lang.System.out)
+ } catch (e: java.io.IOException) {
+ throw java.lang.RuntimeException(e)
+ }
+
+ println("Dirt: ${Blocks.dirt.unlocalizedName}")
+ // Below is a demonstration of an access-transformed class access.
+ println("Color State: " + GlStateManager.Color());
+ }
+}
diff --git a/src/main/kotlin/com/example/mixin/MixinGuiMainMenu.java b/src/main/kotlin/com/example/mixin/MixinGuiMainMenu.java
new file mode 100644
index 0000000..47eee87
--- /dev/null
+++ b/src/main/kotlin/com/example/mixin/MixinGuiMainMenu.java
@@ -0,0 +1,16 @@
+package com.example.mixin;
+
+import net.minecraft.client.gui.GuiMainMenu;
+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(GuiMainMenu.class)
+public class MixinGuiMainMenu {
+
+ @Inject(method = "initGui", at = @At("HEAD"))
+ public void onInitGui(CallbackInfo ci) {
+ System.out.println("Hello from Main Menu!");
+ }
+}