From 4eb2056f2f20366ea49a7cf54d892bd3f25bdb16 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Fri, 26 Jan 2024 13:54:10 +0100 Subject: Tutorial stuff --- src/main/java/com/example/ExampleMod.java | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'src/main/java/com/example/ExampleMod.java') 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; + } } } -- cgit