Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package maelstromphoenix.waih;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.gui.GuiScreen;
- import net.minecraft.client.gui.ScaledResolution;
- import net.minecraft.client.renderer.GlStateManager;
- import net.minecraft.client.renderer.Tessellator;
- import net.minecraft.client.renderer.VertexBuffer;
- import net.minecraft.client.renderer.texture.TextureManager;
- import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.item.ItemStack;
- import net.minecraft.util.ResourceLocation;
- import org.lwjgl.opengl.GL11;
- /**
- * Created by Sven on 5/27/16.
- */
- public class Overlay extends GuiScreen{
- public static Minecraft minecraft = Minecraft.getMinecraft();
- public static EntityPlayer player = minecraft.thePlayer;
- public static TextureManager textureManager = minecraft.renderEngine;
- public static Tessellator tessellator = Tessellator.getInstance();
- public static VertexBuffer vertexBuffer = tessellator.getBuffer();
- public void render(){
- ItemStack currentItem = player.inventory.getCurrentItem();
- if(currentItem == null)
- return;
- ScaledResolution scaledResolution = new ScaledResolution(minecraft);
- float width = scaledResolution.getScaledWidth();
- float height = scaledResolution.getScaledHeight();
- drawTexturedRectangle(width/4, height - height/4, 50, 50, 0, "rounded_rectangle.png");
- }
- public void drawTexturedRectangle(double x, double y, double width, double height, double zIndex, String texture){
- textureManager.bindTexture(new ResourceLocation(WAIH.MODID, texture));
- GlStateManager.enableAlpha();
- vertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
- vertexBuffer.pos(x - width/2, y - height/2, zIndex).tex(0, 0).color(1.0f, 1.0f, 1.0f, 0.1f).endVertex();
- vertexBuffer.pos(x - width/2, y + height/2, zIndex).tex(0, 1).color(1.0f, 1.0f, 1.0f, 0.1f).endVertex();
- vertexBuffer.pos(x + width/2, y + height/2, zIndex).tex(1, 1).color(1.0f, 1.0f, 1.0f, 0.1f).endVertex();
- vertexBuffer.pos(x + width/2, y - height/2, zIndex).tex(1, 0).color(1.0f, 1.0f, 1.0f, 0.1f).endVertex();
- tessellator.draw();
- GlStateManager.disableAlpha();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement