@Override
  public void addInformation(ItemStack is, EntityPlayer player, List arraylist, boolean flag) {
    if (is.hasTagCompound() && is.getTagCompound().hasKey("foodWeight")) {
      float ounces = is.getTagCompound().getFloat("foodWeight");
      if (ounces > 0) arraylist.add(ounces + " oz");
      float decay = is.getTagCompound().getFloat("foodDecay");
      if (decay > 0) {
        float perc = decay / ounces;
        String s = EnumChatFormatting.DARK_GRAY + StringUtil.localize("gui.milk.fresh");
        if (perc > 50) s = EnumChatFormatting.DARK_GRAY + StringUtil.localize("gui.milk.old");
        if (perc > 70) s = EnumChatFormatting.DARK_GRAY + StringUtil.localize("gui.milk.sour");

        arraylist.add(s);
      }
      if (TFCOptions.enableDebugMode)
        arraylist.add(EnumChatFormatting.DARK_GRAY + "Decay: " + decay);
    }
  }
Beispiel #2
0
  @Override
  public void initGui() {
    super.initGui();

    if (TFCOptions.enableDebugMode) {
      buttonList.clear();
      int l = (width - xSize) / 2;
      int i1 = (height - ySize) / 2;
      buttonList.add(
          new GuiButton(0, l + 20, i1 + 118, 66, 20, StringUtil.localize("gui.Calendar.1Hour")));
      buttonList.add(
          new GuiButton(1, l + 20, i1 + 137, 66, 20, StringUtil.localize("gui.Calendar.1Day")));
      buttonList.add(
          new GuiButton(2, l + 20, i1 + 156, 66, 20, StringUtil.localize("gui.Calendar.1Week")));
      buttonList.add(
          new GuiButton(3, l + 85, i1 + 118, 66, 20, StringUtil.localize("gui.Calendar.1Month")));
      buttonList.add(
          new GuiButton(4, l + 85, i1 + 137, 66, 20, StringUtil.localize("gui.Calendar.1Year")));
    }
  }
Beispiel #3
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);
      }
    }
  }
 @Override
 public String getItemDisplayName(ItemStack itemstack) {
   return StringUtil.localize(getUnlocalizedName(itemstack).replace(" ", ""));
 }
Beispiel #5
0
  @Override
  public void drawScreen(int par1, int par2, float par3) {
    this.mc.func_110434_K().func_110577_a(texture);

    int var4 = this.guiLeft;
    int var5 = this.guiTop;

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int l = (width - xSize) / 2;
    int i1 = (height - ySize) / 2;
    drawTexturedModalRect(l, i1, 0, 0, xSize, ySize);

    drawCenteredString(
        fontRenderer, StringUtil.localize("gui.Calendar.Calendar"), l + 87, i1 + 16, 0xFFFFFF);
    drawCenteredString(
        fontRenderer,
        StringUtil.localize("gui.Calendar.Season") + " : " + TFC_Time.seasons[TFC_Time.getMonth()],
        l + 87,
        i1 + 26,
        0x000000);

    drawCenteredString(
        fontRenderer,
        StringUtil.localize("gui.Calendar.Day") + " : " + TFC_Time.Days[TFC_Time.getDayOfWeek()],
        l + 87,
        i1 + 36,
        0x000000);
    int dom = TFC_Time.getDayOfMonth();
    int month = TFC_Time.currentMonth;

    if (dom == 7 && month == 4) {
      drawCenteredString(
          fontRenderer,
          StringUtil.localize("gui.Calendar.DateBioxx") + ", " + (1000 + TFC_Time.getYear()),
          l + 87,
          i1 + 46,
          0x000000);
    } else {
      drawCenteredString(
          fontRenderer,
          StringUtil.localize("gui.Calendar.Date")
              + " : "
              + dom
              + " "
              + TFC_Time.months[month]
              + ", "
              + (1000 + TFC_Time.getYear()),
          l + 87,
          i1 + 46,
          0x000000);
    }

    float temp =
        Math.round(
            (TFC_Climate.getHeightAdjustedTemp(
                (int) player.posX, (int) player.posY, (int) player.posZ)));

    // drawCenteredString(fontRenderer,"Temperature : " + (int)temp + "C", l + 87, i1+56, 0x000000);
    // drawCenteredString(fontRenderer,"Month : " + , l + 87, i1+36, 0x000000);

    long h = TFC_Time.getHour();
    String hour = "";
    if (h == 0) {
      hour = StringUtil.localize("gui.Calendar.WitchHour");
    } else {
      hour += h;
    }
    drawCenteredString(
        fontRenderer,
        StringUtil.localize("gui.Calendar.Hour") + " : " + hour,
        l + 87,
        i1 + 56,
        0x000000);
    // drawCenteredString(fontRenderer,"EVT : " +
    // ((TFCWorldChunkManager)world.provider.worldChunkMgr).getEVTLayerAt((int) player.posX, (int)
    // player.posZ).floatdata1, l + 87, i1+76, 0x000000);

    // int rain = (int) TFC_Climate.getRainfall((int) player.posX,(int) player.posY, (int)
    // player.posZ);
    // drawCenteredString(fontRenderer,"Rain : " + rain, l + 87, i1+86, 0x000000);

    for (int var6 = 0; var6 < this.buttonList.size(); ++var6) {
      GuiButton var7 = (GuiButton) this.buttonList.get(var6);
      var7.drawButton(this.mc, par1, par2);
    }
  }