Advertisement
MightyDanp

Untitled

Jul 26th, 2015
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.37 KB | None | 0 0
  1. package com.mightydanp.eot.client.gui;
  2.  
  3. import org.lwjgl.opengl.GL11;
  4. import org.lwjgl.opengl.GL12;
  5.  
  6. import tconstruct.client.tabs.TabRegistry;
  7.  
  8. import com.mightydanp.eot.inventory.InventoryEotInventory;
  9. import com.mightydanp.eot.client.tabs.InventoryTabEot;
  10. import com.mightydanp.eot.inventory.ContainterEotInventory;
  11. import com.mightydanp.eot.item.ModItems;
  12. import com.mightydanp.eot.lib.References;
  13.  
  14. import net.minecraft.client.Minecraft;
  15. import net.minecraft.client.gui.inventory.GuiContainer;
  16. import net.minecraft.client.renderer.InventoryEffectRenderer;
  17. import net.minecraft.client.renderer.OpenGlHelper;
  18. import net.minecraft.client.renderer.RenderHelper;
  19. import net.minecraft.client.renderer.entity.RenderManager;
  20. import net.minecraft.client.resources.I18n;
  21. import net.minecraft.entity.player.EntityPlayer;
  22. import net.minecraft.entity.player.InventoryPlayer;
  23. import net.minecraft.inventory.Container;
  24. import net.minecraft.util.ResourceLocation;
  25.  
  26. public class GuiEotInventory extends GuiContainer{
  27.  
  28. private static final ResourceLocation background = new ResourceLocation(References.MODID, "textures/gui/eotInventory.png");
  29. private static final ResourceLocation tier1Bag = new ResourceLocation(References.MODID, "textures/gui/tier1Bag.png");
  30.  
  31. private float xSize_lo;
  32. private float ySize_lo;
  33.  
  34. private static final int BAG_WIDTH = 116;
  35. private int bagLeft = 0;
  36. private int bagTop = 0;
  37.  
  38. private final InventoryEotInventory inventory;
  39.  
  40. public GuiEotInventory(EntityPlayer player,InventoryPlayer inventoryplayer, InventoryEotInventory holder) {
  41. super(new ContainterEotInventory(player, inventoryplayer, holder));
  42. this.inventory = holder;
  43. }
  44.  
  45. @Override
  46. public void initGui ()
  47. {
  48. super.initGui();
  49.  
  50. this.guiLeft = (this.width - this.xSize) / 2;
  51. this.guiTop = (this.height - this.ySize) / 2;
  52. this.bagLeft = this.guiLeft;
  53. this.bagTop = this.guiTop;
  54.  
  55. if (inventory.getInventory()[0] != null)
  56. {
  57. this.xSize += BAG_WIDTH;
  58. }
  59.  
  60. this.buttonList.clear();
  61. this.buttonList.clear();
  62.  
  63. TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabEot.class);
  64. TabRegistry.addTabsToList(this.buttonList);
  65. }
  66.  
  67. @Override
  68. public void drawScreen (int par1, int par2, float par3){
  69. super.drawScreen(par1, par2, par3);
  70. this.xSize_lo = (float) par1;
  71. this.ySize_lo = (float) par2;
  72. }
  73.  
  74.  
  75. @Override
  76. protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
  77. GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  78. this.mc.getTextureManager().bindTexture(background);
  79. int cornerX = guiLeft;
  80. int cornerY = guiTop;
  81.  
  82. cornerX = this.guiLeft;
  83. cornerY = this.guiTop;
  84. drawTexturedModalRect(cornerX, guiTop, 0, 0, xSize, ySize);
  85.  
  86. if (inventory.getInventory()[0] != null)
  87. {
  88. if (inventory.getInventory()[0].getItem() == ModItems.tier1Bag){
  89. GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  90. this.mc.getTextureManager().bindTexture(tier1Bag);
  91.  
  92. this.drawTexturedModalRect(bagLeft + 164 , bagTop, 0, 0, 150, 72);
  93. }
  94. }
  95.  
  96. drawPlayerOnGui(this.mc, cornerX + 89, cornerY + 75, 30, (float) (cornerX + 51) - this.xSize_lo, (float) (cornerY + 75 - 50) - this.ySize_lo);
  97. }
  98.  
  99. public static void drawPlayerOnGui (Minecraft par0Minecraft, int par1, int par2, int par3, float par4, float par5)
  100. {
  101. GL11.glEnable(GL11.GL_COLOR_MATERIAL);
  102. GL11.glPushMatrix();
  103. GL11.glTranslatef((float) par1, (float) par2, 50.0F);
  104. GL11.glScalef((float) (-par3), (float) par3, (float) par3);
  105. GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
  106. float f2 = par0Minecraft.thePlayer.renderYawOffset;
  107. float f3 = par0Minecraft.thePlayer.rotationYaw;
  108. float f4 = par0Minecraft.thePlayer.rotationPitch;
  109. par4 -= 19;
  110. GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F);
  111. RenderHelper.enableStandardItemLighting();
  112. GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
  113. GL11.glRotatef(-((float) Math.atan((double) (par5 / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
  114. par0Minecraft.thePlayer.renderYawOffset = (float) Math.atan((double) (par4 / 40.0F)) * 20.0F;
  115. par0Minecraft.thePlayer.rotationYaw = (float) Math.atan((double) (par4 / 40.0F)) * 40.0F;
  116. par0Minecraft.thePlayer.rotationPitch = -((float) Math.atan((double) (par5 / 40.0F))) * 20.0F;
  117. par0Minecraft.thePlayer.rotationYawHead = par0Minecraft.thePlayer.rotationYaw;
  118. GL11.glTranslatef(0.0F, par0Minecraft.thePlayer.yOffset, 0.0F);
  119. RenderManager.instance.playerViewY = 180.0F;
  120. RenderManager.instance.renderEntityWithPosYaw(par0Minecraft.thePlayer, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
  121. par0Minecraft.thePlayer.renderYawOffset = f2;
  122. par0Minecraft.thePlayer.rotationYaw = f3;
  123. par0Minecraft.thePlayer.rotationPitch = f4;
  124. GL11.glPopMatrix();
  125. RenderHelper.disableStandardItemLighting();
  126. GL11.glDisable(GL12.GL_RESCALE_NORMAL);
  127. OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
  128. GL11.glDisable(GL11.GL_TEXTURE_2D);
  129. OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
  130. }
  131.  
  132. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement