Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I'm making a book for my mod. At first when you open the book you are presented with an index, after that another index with a more specific list of items or blocks. The problem is that when I click in one of the menus, it instantly clicks on the second menu that is on the same coordinate.

 

Here's a gfy explaining my interface and my problem

 

Basicly, what I want is index > subindex > item/block entry

And its going index >item/block entry

 

If my code for my GUI is needed, here it is:GitHub

// Code is messy, just started getting into Java

Simply by override the GuiScreen#mouseClicked(int x, int y, int mouseId) like this:

@Override
/**
@param x = relative mouse position x
@param y = relative mouse position y
@param mouseId = mouse button being pressed
*/
protected void mouseClicked(int x, int y, int mouseId) {
	super.mouseClicked(x, y, mouseId);
	this.initGui();
}

 

Do not call the initGui method during the actionPerformed method because when the mouse is pressed on top of a GuiButton it goes into a loop. When you draw a new button on the same location and the mouse is not released, it continues the loop (the code gets executed immediately so you can never time it when to release your mouse . So when the mouseClicked is done (super call), you re initialize your gui elements.

 

There is no double clicking involved, just fast execution. ;]

 

Note, when writing in Java you should rename the button classes to start with a capital letter.

http://journals.ecs.soton.ac.uk/java/tutorial/java/javaOO/classdecl.html

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.