コード例 #1
0
  public static String getFluidName(Fluid fluid) {

    String name = "" + END;
    if (fluid.getRarity() == EnumRarity.uncommon) {
      name += YELLOW;
    } else if (fluid.getRarity() == EnumRarity.rare) {
      name += BRIGHT_BLUE;
    } else if (fluid.getRarity() == EnumRarity.epic) {
      name += PINK;
    }
    name += fluid.getLocalizedName() + END;

    return name;
  }
コード例 #2
0
 private static String getFluidName(FluidStack fluidStack) {
   final Fluid fluid = fluidStack.getFluid();
   String localizedName = fluid.getLocalizedName(fluidStack);
   if (!Strings.isNullOrEmpty(localizedName)
       && !localizedName.equals(fluid.getUnlocalizedName())) {
     return fluid.getRarity(fluidStack).rarityColor.toString() + localizedName;
   } else {
     return EnumChatFormatting.OBFUSCATED + "LOLNOPE" + EnumChatFormatting.RESET;
   }
 }
コード例 #3
0
 @Override
 public void refresh() {
   toolTip.clear();
   int amount = 0;
   if (getFluid() != null && getFluid().amount > 0 && getFluid().getFluid() != null) {
     Fluid fluidType = getFluidType();
     EnumRarity rarity = fluidType.getRarity();
     if (rarity == null) rarity = EnumRarity.common;
     ToolTipLine fluidName =
         new ToolTipLine(fluidType.getLocalizedName(), rarity.rarityColor);
     fluidName.setSpacing(2);
     toolTip.add(fluidName);
     amount = getFluid().amount;
   } else {
     toolTip.add(new ToolTipLine(StringUtil.localize("gui.empty")));
   }
   if (Config.tooltipLiquidAmount)
     toolTip.add(
         new ToolTipLine(String.format(Locale.ENGLISH, "%,d / %,d", amount, getCapacity())));
 }