/** The tools name completely without material information */ @Override public String getLocalizedToolName() { return Util.translate(getUnlocalizedName() + ".name"); }
@Override public List<String> getExtraInfo(ItemStack tool, NBTTagCompound modifierTag) { String loc = Util.translate(LOC_Extra, getIdentifier()); return ImmutableList.of(Util.translateFormatted(loc, Util.df.format(bonusDamage))); } }
@Override public String getLocalizedName() { return Util.translate(LOC_Name, BEHEADING_ID); } }
@Nonnull @Override public String getTitle() { return Util.translate("gui.jei.smelting.title"); }
@Nonnull @Override public String getTitle() { return Util.translate("gui.jei.alloy.title"); }
@Nonnull @Override public String getTitle() { return Util.translate("gui.jei.casting.title"); }
public static String formatNumber(String loc, String color, float number) { return String.format("%s: %s%s", Util.translate(loc), color, Util.df.format(number)) + TextFormatting.RESET; }
public static String formatNumberPercent(String loc, String color, float number) { return String.format("%s: %s%s", Util.translate(loc), color, Util.dfPercent.format(number)) + TextFormatting.RESET; } }
@Override public List<String> getInformation(ItemStack stack) { int nourishment = getHealAmount(stack); float saturation = getSaturationModifier(stack); return ImmutableList.of( Util.translate(LOC_DESC), String.format("%s: %s", Util.translate(LOC_USES), getUses(stack)) + TextFormatting.RESET, String.format("%s: %s", Util.translate(LOC_NOURISHMENT), nourishment) + TextFormatting.RESET, String.format("%s: %s", Util.translate(LOC_SATURATION), Util.dfPercent.format(saturation)) + TextFormatting.RESET ); } }
@Override public String getLocalizedName() { String locName = Util.translate(LOC_Name, name); if(levels > 1) { locName += " " + TinkerUtil.getRomanNumeral(levels); } return locName; }
/** * Adds information to the tooltip based on the fluid amount * @param amount Fluid amount * @param text Text to add information to. */ public static void amountToString(int amount, List<String> text) { amount = calcLiquidText(amount, 1000000, Util.translate("gui.smeltery.liquid.kilobucket"), text); amount = calcLiquidText(amount, 1000, Util.translate("gui.smeltery.liquid.bucket"), text); calcLiquidText(amount, 1, Util.translate("gui.smeltery.liquid.millibucket"), text); }
public static String formatAmmo(int durability, int ref) { return String.format("%s: %s%s%s/%s%s", Util.translate(LOC_Ammo), CustomFontColor.valueToColorCode((float) durability / (float) ref), df.format(durability), TextFormatting.GRAY.toString(), COLOR_Durability, df.format(ref)) + TextFormatting.RESET; }
public TooltipBuilder addDurability(boolean textIfBroken) { if(ToolHelper.isBroken(stack) && textIfBroken) { tips.add(String.format("%s: %s%s%s", Util.translate(HeadMaterialStats.LOC_Durability), TextFormatting.DARK_RED, TextFormatting.BOLD, Util.translate("tooltip.tool.broken"))); } else { tips.add(HeadMaterialStats.formatDurability(ToolHelper.getCurrentDurability(stack), ToolHelper.getMaxDurability(stack))); } return this; }
public TooltipBuilder addAmmo(boolean textIfEmpty) { if(stack.getItem() instanceof IAmmo) { if(ToolHelper.isBroken(stack) && textIfEmpty) { tips.add(String.format("%s: %s%s%s", Util.translate(LOC_Ammo), TextFormatting.DARK_RED, TextFormatting.BOLD, Util.translate(LOC_Empty))); } else { IAmmo ammoItem = (IAmmo) stack.getItem(); tips.add(formatAmmo(ammoItem.getCurrentAmmo(stack), ammoItem.getMaxAmmo(stack))); } } return this; }
@SubscribeEvent public static void addTooltip(ItemTooltipEvent itemTooltipEvent) { if( itemTooltipEvent.getItemStack().getItem() == Item.getItemFromBlock(TinkerGadgets.woodenHopper)) { itemTooltipEvent.getToolTip().add(Util.translate("item.tconstruct.wooden_hopper.tooltip")); } }
@Override public boolean canApply(ItemStack stack, ItemStack original) throws TinkerGuiException { NBTTagList modifierList = TagUtil.getModifiersTagList(original); for(int i = 0; i < modifierList.tagCount(); i++) { NBTTagCompound tag = modifierList.getCompoundTagAt(i); ModifierNBT data = ModifierNBT.readTag(tag); if(data.identifier.startsWith(EXTRA_TRAIT_IDENTIFIER)) { throw new TinkerGuiException(Util.translate("gui.error.already_has_extratrait")); } } return true; }