Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.happykiller.weightlimit.client.gui.player;
- import org.lwjgl.opengl.GL11;
- import com.happykiller.weightlimit.main.ModReference;
- import com.happykiller.weightlimit.player.inventory.InventoryWeightLimit;
- import com.happykiller.weightlimit.player.inventory.container.ContainerWeightedPlayer;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.gui.inventory.GuiContainer;
- import net.minecraft.client.renderer.GlStateManager;
- import net.minecraft.client.renderer.OpenGlHelper;
- import net.minecraft.client.renderer.RenderHelper;
- import net.minecraft.client.renderer.entity.RenderManager;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.entity.player.InventoryPlayer;
- import net.minecraft.util.ResourceLocation;
- public class GuiWeightedPlayer extends GuiContainer {
- private float xSize_lo;
- private float ySize_lo;
- private static final ResourceLocation iconLocal = new
- ResourceLocation(ModReference.MOD_ID, "textures/gui/container/player/WeightedInventory.png");
- private final InventoryWeightLimit inv;
- public GuiWeightedPlayer(EntityPlayer player, InventoryPlayer invPlayer, InventoryWeightLimit invW) {
- super(new ContainerWeightedPlayer(player, invPlayer, invW));
- this.inv = invW;
- }
- public void drawScreen(int mouseX, int mouseY, float partialTicks) {
- super.drawScreen(mouseX, mouseY, partialTicks);
- this.xSize_lo = (float)mouseX;
- this.ySize_lo = (float)mouseY;
- }
- //protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {}
- protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- this.mc.getTextureManager().bindTexture(iconLocal);
- int k = (this.width - this.xSize) / 2;
- int l = (this.height - this.ySize) / 2;
- this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
- //int i1;
- this.drawPlayerModel(k + 51, l + 75, 30, (float)(k + 51) - this.xSize_lo, (float)(l + 75 - 50) - this.ySize_lo, this.mc.thePlayer);
- }
- public static void drawPlayerModel(int p_147046_0_, int p_147046_1_, int p_147046_2_, float p_147046_3_, float p_147046_4_, EntityLivingBase p_147046_5_) {
- GlStateManager.enableColorMaterial();
- GlStateManager.pushMatrix();
- GlStateManager.translate((float)p_147046_0_, (float)p_147046_1_, 50.0F);
- GlStateManager.scale((float)(-p_147046_2_), (float)p_147046_2_, (float)p_147046_2_);
- GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
- float f2 = p_147046_5_.renderYawOffset;
- float f3 = p_147046_5_.rotationYaw;
- float f4 = p_147046_5_.rotationPitch;
- float f5 = p_147046_5_.prevRotationYawHead;
- float f6 = p_147046_5_.rotationYawHead;
- GlStateManager.rotate(135.0F, 0.0F, 1.0F, 0.0F);
- RenderHelper.enableStandardItemLighting();
- GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F);
- GlStateManager.rotate(-((float)Math.atan((double)(p_147046_4_ / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
- p_147046_5_.renderYawOffset = (float)Math.atan((double)(p_147046_3_ / 40.0F)) * 20.0F;
- p_147046_5_.rotationYaw = (float)Math.atan((double)(p_147046_3_ / 40.0F)) * 40.0F;
- p_147046_5_.rotationPitch = -((float)Math.atan((double)(p_147046_4_ / 40.0F))) * 20.0F;
- p_147046_5_.rotationYawHead = p_147046_5_.rotationYaw;
- p_147046_5_.prevRotationYawHead = p_147046_5_.rotationYaw;
- GlStateManager.translate(0.0F, 0.0F, 0.0F);
- RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
- rendermanager.setPlayerViewY(180.0F);
- rendermanager.setRenderShadow(false);
- rendermanager.renderEntityWithPosYaw(p_147046_5_, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
- rendermanager.setRenderShadow(true);
- p_147046_5_.renderYawOffset = f2;
- p_147046_5_.rotationYaw = f3;
- p_147046_5_.rotationPitch = f4;
- p_147046_5_.prevRotationYawHead = f5;
- p_147046_5_.rotationYawHead = f6;
- GlStateManager.popMatrix();
- RenderHelper.disableStandardItemLighting();
- GlStateManager.disableRescaleNormal();
- GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
- GlStateManager.disableTexture2D();
- GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
- }
- }
Add Comment
Please, Sign In to add comment