From e8196b0b5e02ec21f75109ab7aba8d48220c8d05 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Thu, 22 Feb 2024 21:23:38 +0100 Subject: Template --- src/main/kotlin/moe/nea/kowalski/ExampleMod.kt | 22 ++++++++++++++++++++++ .../moe/nea/kowalski/mixin/MixinGuiMainMenu.java | 16 ++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/main/kotlin/moe/nea/kowalski/ExampleMod.kt create mode 100644 src/main/kotlin/moe/nea/kowalski/mixin/MixinGuiMainMenu.java (limited to 'src/main/kotlin/moe/nea/kowalski') diff --git a/src/main/kotlin/moe/nea/kowalski/ExampleMod.kt b/src/main/kotlin/moe/nea/kowalski/ExampleMod.kt new file mode 100644 index 0000000..a622a6c --- /dev/null +++ b/src/main/kotlin/moe/nea/kowalski/ExampleMod.kt @@ -0,0 +1,22 @@ +package moe.nea.kowalski + +import net.minecraft.client.Minecraft +import net.minecraft.init.Blocks +import net.minecraftforge.fml.common.Mod +import net.minecraftforge.fml.common.event.FMLInitializationEvent + +@Mod(modid = "kowalski", 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}") + } +} diff --git a/src/main/kotlin/moe/nea/kowalski/mixin/MixinGuiMainMenu.java b/src/main/kotlin/moe/nea/kowalski/mixin/MixinGuiMainMenu.java new file mode 100644 index 0000000..4ddc1b4 --- /dev/null +++ b/src/main/kotlin/moe/nea/kowalski/mixin/MixinGuiMainMenu.java @@ -0,0 +1,16 @@ +package moe.nea.kowalski.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!"); + } +} -- cgit