After a long and drawn out search, I could not find a simple tutorial to actually render a new image onto the HUD. I finally figured out how to do this, so I thought I should share this super easy method. First, create a blank 256x256 png file (must be this size as far as i know to render correctly) that has transparency. For GIMP users, go to Layer ->Transparency->Add Alpha Channel. Then hit Select->all, and edit->clear. You now have a transparent png file. Put your texture in the upper left corner or wherever; note the upper lefthand corner of the image and the size of it (for example, the grass block in the terrain.png file would be 0,0 for leftand corner and 16x16 for the size). Save it as what you want, and put it with the rest of your textures.Then, create your main class and set up a Ticking loop.
To do this with Modloader:
public void load()
{
ModLoader.setInGameHook(this, true, false);
}
public boolean onTickInGame(float f, Minecraft minecraft)
{
}
To do this in Forge:
Main Class:
@Init
public void load(FMLInitializationEvent event){
TickRegistry.registerTickHandler(new TickerClient(), Side.CLIENT);
}
You bind the texture to GL11 so it can be rendered with drawTexturedModalRect. Leave the first argument, the second one is the filepath to the image you want to render. For example, if your textures were in the gui folder in minecraft.jar, you would put "/gui/imagename.png".
gig.drawTexturedModalRect(5, 5, 0, 0, 5, 102);
This draws the texture onto the screen. There are lots of variables here, so i'll explain them one by one:The first variable is the x position on the screen you want the image to be drawn (Top lefthand corner)The second variable is the y position on the screen you want the image to be drawn (Top leftand corner)Think of it as a graph; it's the exact same. The third variable is the x position on the texture you pointed to (Top lefthand corner again). For a grass block in terrain.png, this is 0.The fourth variable is the y position on the texture you pointed to (Top lefthand corner again). For a grass block in terrain.png, this is 0.Think of it as a graph also, it works the same way.The fifth variable is the width of the texture that you want to display. For a grass block in terrain.png, this is 16.The sixth variable is the height of the texture that you want to display. For a grass block in the terrain.png, this is 16.Basically, the first two numbers are for where it will be on the screen. The second two numbers are the location of the top left corner on the texturemap. The final 2 numbers are the width and height of the texture itself.Recompile, and start the client and world.
To do this with Modloader:
To do this in Forge:
Main Class:
TickerClient Class:
Make high-quality models in the Techne. And do the model in Blender.
Can you link me to your code and tell me the problem you are having?
I have updated the tutorial to 1.6.2.
In PM.
Make high-quality models in the Techne. And do the model in Blender.