Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.nextlevelminecraft.cad435.TNL_Client_Dependencies;
- import cpw.mods.fml.common.eventhandler.SubscribeEvent;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.gui.Gui;
- import net.minecraftforge.client.event.RenderGameOverlayEvent;
- import org.lwjgl.opengl.GL11;
- import org.newdawn.slick.*;
- import org.newdawn.slick.opengl.Texture;
- import org.newdawn.slick.opengl.TextureLoader;
- import org.newdawn.slick.util.ResourceLoader;
- import java.awt.Font;
- public class MsgGui extends Gui {
- Minecraft mc;
- public MsgGui(Minecraft mc) {
- super();
- this.mc = mc;
- }
- static final Font awtFont = new Font("Arial", Font.BOLD, 24);
- static final org.newdawn.slick.TrueTypeFont font = new TrueTypeFont(awtFont, true);
- Texture GUItexture;
- boolean Textureloaded = false;
- @SubscribeEvent(receiveCanceled = true)
- public void onEvent(RenderGameOverlayEvent.Pre event) {
- if (event.type == RenderGameOverlayEvent.ElementType.FOOD) {
- if (Textureloaded == false) {
- try {
- GUItexture = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("assets/objloader/Tiny.png"));
- } catch (Exception e) {
- }
- Textureloaded = true;
- }
- GL11.glPushMatrix();
- GL11.glEnable(GL11.GL_TEXTURE_2D);
- GUItexture.bind();
- GL11.glBegin(GL11.GL_QUADS);
- GL11.glTexCoord2f(0, 0); // top left
- GL11.glVertex2f(0, 0);
- GL11.glTexCoord2f(0, 1); // bottom left
- GL11.glVertex2f(0, 100);
- GL11.glTexCoord2f(1, 1); // bottom right
- GL11.glVertex2f(100, 100);
- GL11.glTexCoord2f(1, 0); // top right
- GL11.glVertex2f(100, 0);
- GL11.glEnd();
- GL11.glPopMatrix();
- }
- }
- @SubscribeEvent(receiveCanceled = true)
- public void onEvent(RenderGameOverlayEvent.Post event) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement