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

Hi,

 

New to modding, so I will have tons of questions. As I am trying to learn from existing code, sometimes It's too much to me to properly interprete code. I hope that my questions are trivial, and someone will help a newbe.

 

I want to do a mod that will give some new HUD features (basically will give more FPS-ish HUD features), and I would rather that drawing string on HUD draw a textures. I seen that in thaumcraft there are some textures on HUD (vis/taint level when googles of revealing on). I want to display some HUD features when item is worn or in quickItem bar, but detecting item is kinda easy. For now I don't know how to implement drawing textures on HUD.

I would like to draw textures from a custom file, and I also don't know where to put that file or how to define that texture.

 

Can anyone help?

Hello.

 

I'm not sure about adding a new texture on the HUD, but I did manage to place a string/text on the screen.

 

Follow the Ticking example on the wiki. This a very handy thing to know/have if you want to add things that require constant updates. Once you have that ready, add this in the onRenderTick() Method:

 

FMLClientHandler.instance().getClient().fontRenderer.drawStringWithShadow(displayText(String), x(int), y(int), color(int));

 

Bare in mind this could be tidied up, but this was just from a quick test I've just done a few minutes ago. Obviously, don't forget to change the displayText(String) to a string and x,y & color to a number. For example:

FMLClientHandler.instance().getClient().fontRenderer.drawStringWithShadow("Hello World!", 0, 0, 16777215));

 

There is also a drawString method with the same parameters, just that it displays the text with no shadow.

 

The color parameter is an Integer and I'm uncertain how that works (although I am going to find out). However, I did find (somewhere buried deep in the files and I can't remember where) this value: 16777215 and this seems to give the same white color as the other texts

 

The Color parameter is the Hex color value (eg FF0000) converted into Decimal.

 

For the textures look how Minecraft displays the GUI elements (Inventory bar, health bar etc). I know things can be difficult with all over the unnamed variables (var1..var2), but if you're using Eclipse you can just highlight the variable name and all off the references highlight also so you can just follow where the variables lead. Sometimes you might see a named variable, which is a nice treat.

 

I hope this helps. Any questions just ask.

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.