Posted May 19, 20187 yr 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?
May 19, 20187 yr 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
May 19, 20187 yr Author 6 minutes ago, diesieben07 said: That is not how you subscribe to Forge events. Oh oops, how did that get there
May 19, 20187 yr Author 22 minutes ago, diesieben07 said: That is not how you subscribe to Forge events. Btw. why does text look dark there?
May 19, 20187 yr Author 2 minutes ago, diesieben07 said: I'm sorry, what? http://prntscr.com/jjyday This should be white, 0xFFFFFF or §f. All colors appear darker than they should for some reason.
May 19, 20187 yr 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)
May 19, 20187 yr 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?
May 19, 20187 yr 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()?
May 19, 20187 yr 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
May 19, 20187 yr 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
May 19, 20187 yr 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.