D4RKAR

drawScreenMethod

Jul 17th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.04 KB | None | 0 0
  1.  /**
  2.      * Draws the screen and all the components in it.
  3.      */
  4.     public void drawScreen(int mouseX, int mouseY, float partialTicks)
  5.     {
  6.         int i = this.guiLeft;
  7.         int j = this.guiTop;
  8.         this.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
  9.         GlStateManager.disableRescaleNormal();
  10.         RenderHelper.disableStandardItemLighting();
  11.         GlStateManager.disableLighting();
  12.         GlStateManager.disableDepth();
  13.         super.drawScreen(mouseX, mouseY, partialTicks);
  14.         RenderHelper.enableGUIStandardItemLighting();
  15.         GlStateManager.pushMatrix();
  16.         GlStateManager.translate((float)i, (float)j, 0.0F);
  17.         GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  18.         GlStateManager.enableRescaleNormal();
  19.         this.hoveredSlot = null;
  20.         int k = 240;
  21.         int l = 240;
  22.         OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
  23.         GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  24.  
  25.         for (int i1 = 0; i1 < this.inventorySlots.inventorySlots.size(); ++i1)
  26.         {
  27.             Slot slot = this.inventorySlots.inventorySlots.get(i1);
  28.  
  29.             if (slot.isEnabled())
  30.             {
  31.                 this.drawSlot(slot);
  32.             }
  33.  
  34.             if (this.isMouseOverSlot(slot, mouseX, mouseY) && slot.isEnabled())
  35.             {
  36.                 this.hoveredSlot = slot;
  37.                 GlStateManager.disableLighting();
  38.                 GlStateManager.disableDepth();
  39.                 int j1 = slot.xPos;
  40.                 int k1 = slot.yPos;
  41.                 GlStateManager.colorMask(true, true, true, false);
  42.                 this.drawGradientRect(j1, k1, j1 + 16, k1 + 16, -2130706433, -2130706433);
  43.                 GlStateManager.colorMask(true, true, true, true);
  44.                 GlStateManager.enableLighting();
  45.                 GlStateManager.enableDepth();
  46.             }
  47.         }
  48.  
  49.         RenderHelper.disableStandardItemLighting();
  50.         this.drawGuiContainerForegroundLayer(mouseX, mouseY);
  51.         RenderHelper.enableGUIStandardItemLighting();
  52.         net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiContainerEvent.DrawForeground(this, mouseX, mouseY));
  53.         InventoryPlayer inventoryplayer = this.mc.player.inventory;
  54.         ItemStack itemstack = this.draggedStack.isEmpty() ? inventoryplayer.getItemStack() : this.draggedStack;
  55.  
  56.         if (!itemstack.isEmpty())
  57.         {
  58.             int j2 = 8;
  59.             int k2 = this.draggedStack.isEmpty() ? 8 : 16;
  60.             String s = null;
  61.  
  62.             if (!this.draggedStack.isEmpty() && this.isRightMouseClick)
  63.             {
  64.                 itemstack = itemstack.copy();
  65.                 itemstack.setCount(MathHelper.ceil((float)itemstack.getCount() / 2.0F));
  66.             }
  67.             else if (this.dragSplitting && this.dragSplittingSlots.size() > 1)
  68.             {
  69.                 itemstack = itemstack.copy();
  70.                 itemstack.setCount(this.dragSplittingRemnant);
  71.  
  72.                 if (itemstack.isEmpty())
  73.                 {
  74.                     s = "" + TextFormatting.YELLOW + "0";
  75.                 }
  76.             }
  77.  
  78.             this.drawItemStack(itemstack, mouseX - i - 8, mouseY - j - k2, s);
  79.         }
  80.  
  81.         if (!this.returningStack.isEmpty())
  82.         {
  83.             float f = (float)(Minecraft.getSystemTime() - this.returningStackTime) / 100.0F;
  84.  
  85.             if (f >= 1.0F)
  86.             {
  87.                 f = 1.0F;
  88.                 this.returningStack = ItemStack.EMPTY;
  89.             }
  90.  
  91.             int l2 = this.returningStackDestSlot.xPos - this.touchUpX;
  92.             int i3 = this.returningStackDestSlot.yPos - this.touchUpY;
  93.             int l1 = this.touchUpX + (int)((float)l2 * f);
  94.             int i2 = this.touchUpY + (int)((float)i3 * f);
  95.             this.drawItemStack(this.returningStack, l1, i2, (String)null);
  96.         }
  97.  
  98.         GlStateManager.popMatrix();
  99.         GlStateManager.enableLighting();
  100.         GlStateManager.enableDepth();
  101.         RenderHelper.enableStandardItemLighting();
  102.     }
Advertisement
Add Comment
Please, Sign In to add comment