Jump to content

Recommended Posts

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?

Posted
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

Posted
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)

Posted
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?

Posted
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()?

Posted
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

 

Posted
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

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.