Exemplo n.º 1
0
  @Override
  public void drawButton(Minecraft mc, int x, int y) {
    if (this.drawButton) {

      int k = this.getHoverState(this.field_82253_i) - 1;
      if (icon == null) {
        k = 0;
        if (screen.AnvilEntity != null && screen.AnvilEntity.workRecipe != null) {
          PlanRecipe p = AnvilManager.getInstance().getPlan(screen.AnvilEntity.craftingPlan);
          if (p == null) return;
          RuleEnum[] Rules = p.rules;
          int[] ItemRules = screen.AnvilEntity.getItemRules();
          this.displayString = StringUtil.localize(Rules[ruleIndex].Name);
        }
      }

      TFC_Core.bindTexture(GuiAnvil.texture);
      GL11.glColor4ub(red, green, blue, (byte) 255);
      this.drawTexturedModalRect(
          this.xPosition,
          this.yPosition,
          this.bX + k * 16,
          this.bY + (ruleIndex * 22),
          this.bW,
          this.bH);

      this.field_82253_i =
          x >= this.xPosition
              && y >= this.yPosition
              && x < this.xPosition + this.width
              && y < this.yPosition + this.height;

      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      if (icon != null) {
        TFC_Core.bindTexture(TextureMap.locationBlocksTexture);
        this.drawTexturedModelRectFromIcon(
            this.xPosition, this.yPosition, icon, this.width, this.height);
      }

      this.mouseDragged(mc, x, y);

      if (field_82253_i) {
        FontRenderer fontrenderer = Minecraft.getMinecraft().fontRenderer;
        screen.drawTooltip(x, y, this.displayString);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      }
    }
  }
Exemplo n.º 2
0
  @Override
  public void drawButton(Minecraft mc, int x, int y) {
    if (this.drawButton) {

      int k = this.getHoverState(this.field_82253_i) - 1;
      if (icon == null) {
        k = 0;
        if (screen.AnvilEntity != null && screen.AnvilEntity.workRecipe != null) {
          CraftingRuleEnum[] Rules = screen.AnvilEntity.workRecipe.getRules();
          int[] ItemRules = screen.AnvilEntity.getItemRules();
          this.displayString = Rules[ruleIndex].Name;
        }
      }

      mc.func_110434_K().func_110577_a(GuiAnvil.texture);
      GL11.glColor4ub(red, green, blue, (byte) 255);
      this.drawTexturedModalRect(
          this.xPosition,
          this.yPosition,
          this.bX + k * 16,
          this.bY + (ruleIndex * 22),
          this.bW,
          this.bH);

      this.field_82253_i =
          x >= this.xPosition
              && y >= this.yPosition
              && x < this.xPosition + this.width
              && y < this.yPosition + this.height;

      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      if (icon != null) {
        mc.func_110434_K().func_110577_a(TextureMap.field_110575_b);
        this.drawTexturedModelRectFromIcon(
            this.xPosition, this.yPosition, icon, this.width, this.height);
      }

      this.mouseDragged(mc, x, y);

      if (field_82253_i) {
        FontRenderer fontrenderer = Minecraft.getMinecraft().fontRenderer;
        screen.drawTooltip(x, y, this.displayString);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      }
    }
  }