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 need to add text to the chest window when the name of the chest is equal to something.

I guess I need an event that fires every tick or so when you are inside a chest, and then render the text somehow above it.

Are there any good examples of the events I need to use in order to achieve something like this?

  • Author
45 minutes ago, diesieben07 said:

GuiScreenEvent.DrawScreenEvent.

 

@EventHandler
    public void renderChest(DrawScreenEvent e) {
    	if (e.getGui() instanceof GuiChest) {
	    	System.out.println("ok");
    	}
    }

Doesn't work for some reason

  • Author
Just now, diesieben07 said:

You have shown zero of your code.

ScaledResolution sr = new ScaledResolution(mc);
	    	String displayGUIText = "This is a place-holder";
	    	e.getGui().drawString(mc.fontRenderer, displayGUIText, sr.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(displayGUIText) / 2, sr.getScaledHeight() / 2 - 85, 0xFFFFFF);
	    	

 

just some basic font render stuff, it's all inside the event listener I sent earlier. (DrawScreenEvent.Post)

  • Author
11 minutes ago, diesieben07 said:

You need to set the GL color to white.

I don't think I really know how to do this, do you have an example of this?

GL11.glColor4f(1, 1, 1, 1);

This is what I found but it does nothing.

 

Also, can I get the chest's custom name from this event?

  • Author
13 minutes ago, diesieben07 said:

Use GLStateManager.color. You might also need RenderHelper.disableStandardItemLighting (and RenderHelper.enableStandardItemLighting after you are done).

 

Sure.

Awesome it worked. I am fiddling around trying to figure out how to get the custom chest name. Should it be inside getGui()?

  • Author
9 minutes ago, diesieben07 said:

GuiChest already draws the name, look at it.

I checked GuiChest by itself and what e.getGui() gives, also e.getGui().getClass() , couldn't find it. I'm probably not even close

 

  • Author
1 minute ago, diesieben07 said:

So, you checked GuiChest, but you did not see what GuiChest#drawGuiContainerForegroundLayer does?

I did, but I couldn't manage to access upperChestInventory

  • Author
2 minutes ago, diesieben07 said:

You do know Java, yes? Then you certainly know about access levels.

You need reflection.

oh right, reflections are no fun

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.