Jump to content

Listen for key down event, then open a gui (1.16.4)


Craftit7

Recommended Posts

So, I want to listen for client pressing H and then open a custom gui. The mod is a mod that will contain custom text that will be sent in the chat, sending in chat using command "say {msg}" works, the problem here is opening a gui on key press. Can anyone help? Btw, I still don't have a custom gui, i need help on how to do that too.

Link to comment
Share on other sites

I wasn't able to find anything about "ClientTicks".

Here is my mod main file:-
 

package com.craftit7.fpsbooster;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;

@Mod("customchatembeds")
public class FpsBooster {
	
	public static final Logger LOGGER = LogManager.getLogger();
	public static final String MOD_ID = "customchatembeds";
	
	public FpsBooster() {
		IEventBus Bus = FMLJavaModLoadingContext.get().getModEventBus();
		MinecraftForge.EVENT_BUS.register(this);
	}
	
	private void setup(final FMLCommonSetupEvent event) {}
}

 

Link to comment
Share on other sites

22 minutes ago, Craftit7 said:

im just not used to coding in eclipse which im forced to do.

you're not forced to code in eclipse. other options are IntelliJ, or VSCode (although vscode requires some setup, and therefore is not really recomended)

Link to comment
Share on other sites

1 hour ago, Craftit7 said:

Sorry if im asking alot of questions, Im new to modding.

And btw My hobby IS coding, im just not used to coding in eclipse which im forced to do.

I do all my own coding without an IDE and had to set up Eclipse for this, too, and honestly I'm kind of loving it? The nice thing about being a stickler for simple DIY approaches is you get to fully appreciate modern conveniences when you're forced to try them. xD Being able to jump right to function declarations by right clicking on them has been a lifesaver for me so far!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.