diff options
author | Linnea Gräf <nea@nea.moe> | 2024-01-26 13:54:10 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-01-26 13:54:10 +0100 |
commit | 4eb2056f2f20366ea49a7cf54d892bd3f25bdb16 (patch) | |
tree | 3268f0ea22a395365502556a115ec3580dee565c /src/main/java/com/example/ExampleMod.java | |
parent | d449a6860bdfd4994caddf6b37e0792e439a52d3 (diff) | |
download | forge1.8.9template-4eb2056f2f20366ea49a7cf54d892bd3f25bdb16.tar.gz forge1.8.9template-4eb2056f2f20366ea49a7cf54d892bd3f25bdb16.tar.bz2 forge1.8.9template-4eb2056f2f20366ea49a7cf54d892bd3f25bdb16.zip |
Tutorial stuff
Diffstat (limited to 'src/main/java/com/example/ExampleMod.java')
-rw-r--r-- | src/main/java/com/example/ExampleMod.java | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/main/java/com/example/ExampleMod.java b/src/main/java/com/example/ExampleMod.java index c18b591..166c371 100644 --- a/src/main/java/com/example/ExampleMod.java +++ b/src/main/java/com/example/ExampleMod.java @@ -1,13 +1,34 @@ package com.example; -import net.minecraft.init.Blocks; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraftforge.client.ClientCommandHandler; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; -@Mod(modid = "examplemod", useMetadata=true) +@Mod(modid = "examplemod", useMetadata = true) public class ExampleMod { @Mod.EventHandler public void init(FMLInitializationEvent event) { - System.out.println("Dirt: " + Blocks.dirt.getUnlocalizedName()); + MinecraftForge.EVENT_BUS.register(this); + ClientCommandHandler.instance.registerCommand(new CrashCommand()); + } + + public static GuiScreen screenToOpenNextTick = null; + + public static final int MOUSE_LEFT = 0; + public static final int MOUSE_RIGHT = 1; + public static final int MOUSE_MIDDLE = 2; + public static final int MOUSE_BACKWARD = 3; + public static final int MOUSE_FORWARD = 4; + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (screenToOpenNextTick != null) { + Minecraft.getMinecraft().displayGuiScreen(screenToOpenNextTick); + screenToOpenNextTick = null; + } } } |