Advertisement
MightyDanp

GuiEotInventory

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