Пример #1
0
  /** Draws the screen and all the components in it. */
  public void drawScreen(int par1, int par2, float par3) {
    boolean var4 = Mouse.isButtonDown(0);
    int var5 = this.guiLeft;
    int var6 = this.guiTop;
    int var7 = var5 + 175;
    int var8 = var6 + 18;
    int var9 = var7 + 14;
    int var10 = var8 + 112;

    if (!this.wasClicking && var4 && par1 >= var7 && par2 >= var8 && par1 < var9 && par2 < var10) {
      this.isScrolling = this.needsScrollBars();
    }

    if (!var4) {
      this.isScrolling = false;
    }

    this.wasClicking = var4;

    if (this.isScrolling) {
      this.currentScroll = ((float) (par2 - var8) - 7.5F) / ((float) (var10 - var8) - 15.0F);

      if (this.currentScroll < 0.0F) {
        this.currentScroll = 0.0F;
      }

      if (this.currentScroll > 1.0F) {
        this.currentScroll = 1.0F;
      }

      ((ContainerCreative) this.inventorySlots).scrollTo(this.currentScroll);
    }

    super.drawScreen(par1, par2, par3);
    CreativeTabs[] var11 = CreativeTabs.creativeTabArray;
    int start = tabPage * 10;
    int var12 = Math.min(var11.length, ((tabPage + 1) * 10) + 2);
    if (tabPage != 0) start += 2;
    boolean rendered = false;

    for (int var13 = start; var13 < var12; ++var13) {
      CreativeTabs var14 = var11[var13];

      if (var14 != null && renderCreativeInventoryHoveringText(var14, par1, par2)) {
        rendered = true;
        break;
      }
    }

    if (!rendered && !renderCreativeInventoryHoveringText(CreativeTabs.tabAllSearch, par1, par2)) {
      renderCreativeInventoryHoveringText(CreativeTabs.tabInventory, par1, par2);
    }

    if (this.field_74235_v != null
        && selectedTabIndex == CreativeTabs.tabInventory.getTabIndex()
        && this.func_74188_c(
            this.field_74235_v.xDisplayPosition,
            this.field_74235_v.yDisplayPosition,
            16,
            16,
            par1,
            par2)) {
      this.drawCreativeTabHoveringText(
          StringTranslate.getInstance().translateKey("inventory.binSlot"), par1, par2);
    }

    if (maxPages != 0) {
      String page = String.format("%d / %d", tabPage + 1, maxPages + 1);
      int width = fontRenderer.getStringWidth(page);
      GL11.glDisable(GL11.GL_LIGHTING);
      this.zLevel = 300.0F;
      itemRenderer.zLevel = 300.0F;
      fontRenderer.drawString(page, guiLeft + (xSize / 2) - (width / 2), guiTop - 44, -1);
      this.zLevel = 0.0F;
      itemRenderer.zLevel = 0.0F;
    }

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_LIGHTING);
  }
  /** Draws the screen and all the components in it. */
  public void drawScreen(int par1, int par2, float par3) {
    boolean var4 = Mouse.isButtonDown(0);
    int var5 = this.guiLeft;
    int var6 = this.guiTop;
    int var7 = var5 + 175;
    int var8 = var6 + 18;
    int var9 = var7 + 14;
    int var10 = var8 + 112;

    if (!this.wasClicking && var4 && par1 >= var7 && par2 >= var8 && par1 < var9 && par2 < var10) {
      this.isScrolling = this.needsScrollBars();
    }

    if (!var4) {
      this.isScrolling = false;
    }

    this.wasClicking = var4;

    if (this.isScrolling) {
      this.currentScroll = ((float) (par2 - var8) - 7.5F) / ((float) (var10 - var8) - 15.0F);

      if (this.currentScroll < 0.0F) {
        this.currentScroll = 0.0F;
      }

      if (this.currentScroll > 1.0F) {
        this.currentScroll = 1.0F;
      }

      ((ContainerCreative) this.inventorySlots).scrollTo(this.currentScroll);
    }

    super.drawScreen(par1, par2, par3);
    CreativeTabs[] var11 = CreativeTabs.creativeTabArray;
    int var12 = var11.length;

    for (int var13 = 0; var13 < var12; ++var13) {
      CreativeTabs var14 = var11[var13];

      if (this.renderCreativeInventoryHoveringText(var14, par1, par2)) {
        break;
      }
    }

    if (this.field_74235_v != null
        && selectedTabIndex == CreativeTabs.tabInventory.getTabIndex()
        && this.isPointInRegion(
            this.field_74235_v.xDisplayPosition,
            this.field_74235_v.yDisplayPosition,
            16,
            16,
            par1,
            par2)) {
      this.drawCreativeTabHoveringText(
          StringTranslate.getInstance().translateKey("inventory.binSlot"), par1, par2);
    }

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_LIGHTING);
  }