Advertisement
Guest User

Untitled

a guest
Jan 11th, 2015
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.03 KB | None | 0 0
  1. package com.nextlevelminecraft.cad435.TNL_Client_Dependencies;
  2.  
  3.  
  4. import cpw.mods.fml.common.eventhandler.SubscribeEvent;
  5. import net.minecraft.client.Minecraft;
  6. import net.minecraft.client.gui.Gui;
  7. import net.minecraftforge.client.event.RenderGameOverlayEvent;
  8. import org.lwjgl.opengl.GL11;
  9. import org.newdawn.slick.*;
  10. import org.newdawn.slick.opengl.Texture;
  11. import org.newdawn.slick.opengl.TextureLoader;
  12. import org.newdawn.slick.util.ResourceLoader;
  13.  
  14. import java.awt.Font;
  15.  
  16. public class MsgGui extends Gui {
  17.     Minecraft mc;
  18.  
  19.     public MsgGui(Minecraft mc) {
  20.         super();
  21.         this.mc = mc;
  22.     }
  23.  
  24.     static final Font awtFont = new Font("Arial", Font.BOLD, 24);
  25.     static final org.newdawn.slick.TrueTypeFont font = new TrueTypeFont(awtFont, true);
  26.  
  27.     Texture GUItexture;
  28.     boolean Textureloaded = false;
  29.  
  30.     @SubscribeEvent(receiveCanceled = true)
  31.     public void onEvent(RenderGameOverlayEvent.Pre event) {
  32.  
  33.         if (event.type == RenderGameOverlayEvent.ElementType.FOOD) {
  34.             if (Textureloaded == false) {
  35.                 try {
  36.                     GUItexture = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("assets/objloader/Tiny.png"));
  37.                 } catch (Exception e) {
  38.                 }
  39.                 Textureloaded = true;
  40.             }
  41.  
  42.             GL11.glPushMatrix();
  43.  
  44.  
  45.             GL11.glEnable(GL11.GL_TEXTURE_2D);
  46.  
  47.             GUItexture.bind();
  48.             GL11.glBegin(GL11.GL_QUADS);
  49.             GL11.glTexCoord2f(0, 0); // top left
  50.             GL11.glVertex2f(0, 0);
  51.  
  52.             GL11.glTexCoord2f(0, 1); // bottom left
  53.             GL11.glVertex2f(0, 100);
  54.  
  55.             GL11.glTexCoord2f(1, 1); // bottom right
  56.             GL11.glVertex2f(100, 100);
  57.  
  58.             GL11.glTexCoord2f(1, 0); // top right
  59.             GL11.glVertex2f(100, 0);
  60.             GL11.glEnd();
  61.             GL11.glPopMatrix();
  62.         }
  63.     }
  64.  
  65.     @SubscribeEvent(receiveCanceled = true)
  66.     public void onEvent(RenderGameOverlayEvent.Post event) {
  67.  
  68.  
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement