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'm trying to load a background for my GUI, but the bottom of the image keeps getting cut off.

 

GuiInformationDisplay:

 

 

package terramagna.gui;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.event.EventPriority;
import net.minecraftforge.event.ForgeSubscribe;
import org.lwjgl.opengl.GL11;
import terramagna.TerraMagna;
import terramagna.utils.PlayerStatsUtil;

public class GuiInformationDisplay extends Gui
{

private Minecraft mc;
private ResourceLocation texture = new ResourceLocation("terramagna", "textures/gui/hud_1.png");

public GuiInformationDisplay(Minecraft mc)
{

	super();

	this.mc = mc;

}

@ForgeSubscribe(priority = EventPriority.NORMAL)
public void onRenderexperienceBar(RenderGameOverlayEvent event)
{

	if(event.isCancelable() || event.type != ElementType.EXPERIENCE)
	{

		return;

	}

	String goldAmount = Integer.toString(PlayerStatsUtil.getExperience());

	FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;

	drawThing();

	fontRenderer.drawString("Terra Magna: " + TerraMagna.getVersion(), 2, 2, 0xFFFFFF);
	fontRenderer.drawString("Gold: " + goldAmount, 2, 12, 0xFFFF00);

}

public void drawThing()
{

	mc.renderEngine.bindTexture(texture);
	drawTexturedModalRect(-35, 0, 128, 32, 128, 32);

}

}

 

 

 

 

Here's the image I'm trying to load:

http://i.imgur.com/SmmJq7A.png

Kain

  • Author

I used Paint.net to make it. And I'm pretty sure the bottom right corner is transparent.

Kain

Now I miss Hydroflame lolz :P

 

Haha, he isn't the only one with some GUI tricks xD He at least can explain what they do though.... I just know how to implement them. Where are his tessellator tutorials exactly? Or an even better question... Where are good ones? ( That includes his ).

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

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.