Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package halocraft;
- import java.util.Collection;
- import java.util.Iterator;
- import org.lwjgl.opengl.GL11;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.gui.Gui;
- import net.minecraft.client.gui.ScaledResolution;
- import net.minecraft.client.renderer.Tessellator;
- import net.minecraft.client.renderer.WorldRenderer;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.item.ItemStack;
- import net.minecraft.potion.Potion;
- import net.minecraft.potion.PotionEffect;
- import net.minecraft.util.ResourceLocation;
- import net.minecraftforge.client.event.RenderGameOverlayEvent;
- import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
- import net.minecraftforge.fml.common.eventhandler.EventPriority;
- import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
- import net.minecraftforge.fml.common.gameevent.TickEvent.RenderTickEvent;
- public class HaloEventHandler extends Gui{
- private Minecraft mc;
- ResourceLocation res = new ResourceLocation("halocraft:textures/gui/HaloOverlay.png");
- public HaloEventHandler(Minecraft mc){
- super();
- // We need this to invoke the render engine.
- this.mc = mc;
- }
- /**
- * Draws textured rectangles of sizes other than 256x256
- * @param x The x value of the top-left corner point on the screen where drawing to starts
- * @param y The y value of the top-left corner point on the screen where drawing to starts
- * @param u The u (x) value of top-left corner point of the texture to start drawing from
- * @param v The v (y) value of top-left corner point of the texture to start drawing from
- * @param width The width of the rectangle to draw on screen
- * @param height The height of the rectangle to draw on screen
- * @param textureWidth The width of the whole texture
- * @param textureHeight The height of the whole texture
- */
- protected void drawNonStandardTexturedRect(int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight)
- {
- double f = 1F / (double)textureWidth;
- double f1 = 1F / (double)textureHeight;
- WorldRenderer tessellator = Tessellator.getInstance().getWorldRenderer();
- tessellator.startDrawingQuads();
- tessellator.addVertexWithUV(x, y + height, 0, u * f, (v + height) * f1);
- tessellator.addVertexWithUV(x + width, y + height, 0, (u + width) * f, (v + height) * f1);
- tessellator.addVertexWithUV(x + width, y, 0, (u + width) * f, v * f1);
- tessellator.addVertexWithUV(x, y, 0, u * f, v * f1);
- Tessellator.getInstance().draw();
- }
- private static final int BUFF_ICON_SIZE = 256;
- @SubscribeEvent(priority = EventPriority.NORMAL)
- public void onRenderGameOverlay(RenderGameOverlayEvent event)
- {
- if(event.isCancelable() || event.type != ElementType.EXPERIENCE){
- return;
- }
- //if (((EntityPlayer)mc.thePlayer).inventory.armorInventory[3].getItem() == halocraft.Main.SpartanHelmet){
- int xPos = 0;
- int yPos = 0;
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- GL11.glDisable(GL11.GL_LIGHTING);
- this.mc.renderEngine.bindTexture(res);
- ScaledResolution Scaled = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
- this.drawNonStandardTexturedRect(xPos, yPos, 0, 0, mc.displayWidth, mc.displayHeight, 420, 250);
- //}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement