public class ItemTinkerBook extends Item { public ItemTinkerBook() { this.setCreativeTab(TinkerRegistry.tabGeneral); this.setMaxStackSize(1); } @Nonnull @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { ItemStack itemStack = playerIn.getHeldItem(handIn); if(worldIn.isRemote) { TinkerBook.INSTANCE.openGui(itemStack); } return new ActionResult<>(EnumActionResult.SUCCESS, itemStack); } @Override public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) { if(I18n.canTranslate(super.getUnlocalizedName(stack) + ".tooltip")) { tooltip.addAll(LocUtils.getTooltips(TextFormatting.GRAY.toString() + LocUtils.translateRecursive(super.getUnlocalizedName(stack) + ".tooltip"))); } } }
protected void setTooltips(List<String> tooltips) { // convert \n in localized text to actual newlines if(tooltips != null) { for(int i = 0; i < tooltips.size(); i++) { tooltips.set(i, LocUtils.convertNewlines(tooltips.get(i))); } } this.tooltips = tooltips; }
int meta = stack.getMetadata(); // should call getMetadata below if(meta < ThrowballType.values().length) { return super.getUnlocalizedName(stack) + "." + LocUtils.makeLocString(ThrowballType.values()[meta].name()); public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) { if(I18n.canTranslate(this.getUnlocalizedName(stack) + ".tooltip")) { tooltip.add(TextFormatting.GRAY.toString() + LocUtils.translateRecursive(this.getUnlocalizedName(stack) + ".tooltip"));
public boolean checkMissingMaterialTooltip(ItemStack stack, List<String> tooltip, String statIdentifier) { Material material = getMaterial(stack); if(material == Material.UNKNOWN) { NBTTagCompound tag = TagUtil.getTagSafe(stack); String materialID = tag.getString(Tags.PART_MATERIAL); String error; if(!materialID.isEmpty()) { error = I18n.translateToLocalFormatted("tooltip.part.missing_material", materialID); } else { error = I18n.translateToLocal("tooltip.part.missing_info"); } tooltip.addAll(LocUtils.getTooltips(error)); return true; } else if(statIdentifier != null && material.getStats(statIdentifier) == null) { tooltip.addAll(LocUtils.getTooltips(Util.translateFormatted("tooltip.part.missing_stats", material.getLocalizedName(), statIdentifier))); return true; } return false; } }
int meta = stack.getMetadata(); // should call getMetadata below if(meta < SlimeType.values().length) { return super.getUnlocalizedName(stack) + "." + LocUtils.makeLocString(SlimeType.values()[meta].name());
tooltip.addAll(LocUtils.getTooltips(Util.translateFormatted(desc, items.tagCount()))); tooltip.addAll(LocUtils.getTooltips(Util.translateFormatted("tooltip.chest.has_items", items.tagCount())));
int meta = stack.getMetadata(); // should call getMetadata below if(meta < SlimeType.values().length) { return super.getUnlocalizedName(stack) + "." + LocUtils.makeLocString(SlimeType.values()[meta].name());
public static void addOptionalTooltip(ItemStack stack, List<String> tooltip) { if (I18n.canTranslate(stack.getUnlocalizedName() + ".tooltip")) { tooltip.addAll(LocUtils.getTooltips(TextFormatting.GRAY.toString() + LocUtils.translateRecursive(stack.getUnlocalizedName() + ".tooltip"))); } else if (I18n.canTranslate(stack.getUnlocalizedName() + ".tooltip")) { tooltip.addAll(LocUtils.getTooltips(TextFormatting.GRAY.toString() + LocUtils.translateRecursive(stack.getUnlocalizedName() + ".tooltip"))); } }
tooltip.addAll(LocUtils.getTooltips(Util.translate("item.tconstruct.sharpening_kit.tooltip"))); if(!checkMissingMaterialTooltip(stack, tooltip, MaterialTypes.HEAD)) { Material material = getMaterial(stack);
int meta = stack.getMetadata(); // should call getMetadata below if(isValid(meta)) { return super.getUnlocalizedName(stack) + "." + LocUtils.makeLocString(names.get(meta));
public void setText(List<String> text, List<String> tooltips) { // convert \n in localized text to actual newlines if(text != null) { text = Lists.newArrayList(text); for(int i = 0; i < text.size(); i++) { text.set(i, LocUtils.convertNewlines(text.get(i))); } } this.text = text; updateSliderParameters(); setTooltips(tooltips); }
public static void addOptionalTooltip(ItemStack stack, List<String> tooltip) { if(I18n.canTranslate(stack.getUnlocalizedName() + ".tooltip")) { tooltip.addAll(LocUtils.getTooltips(TextFormatting.GRAY.toString() + LocUtils.translateRecursive(stack.getUnlocalizedName() + ".tooltip"))); } else if(I18n.canTranslate(stack.getUnlocalizedName() + ".tooltip")) { tooltip.addAll(LocUtils.getTooltips( TextFormatting.GRAY.toString() + LocUtils.translateRecursive(stack.getUnlocalizedName() + ".tooltip"))); } } }
i = 2; tooltip.addAll(LocUtils.getTooltips(Util.translate(LOC_TOOLTIP + i)));
public static List<TextData> getStatLines(IMaterialStats stats) { List<TextData> lineData = new ArrayList<>(); for(int i = 0; i < stats.getLocalizedInfo().size(); i++) { TextData text = new TextData(stats.getLocalizedInfo().get(i)); text.tooltip = LocUtils.convertNewlines(stats.getLocalizedDesc().get(i)).split("\n"); lineData.add(text); lineData.add(new TextData("\n")); } return lineData; }
public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List<String> tooltip, ITooltipFlag flagIn) { if(I18n.canTranslate(this.getUnlocalizedName(stack) + ".tooltip")) { tooltip.addAll(LocUtils.getTooltips(TextFormatting.GRAY.toString() + LocUtils.translateRecursive(this.getUnlocalizedName(stack) + ".tooltip"))); tooltip.addAll(LocUtils.getTooltips( TextFormatting.GRAY.toString() + LocUtils.translateRecursive(super.getUnlocalizedName(stack) + ".tooltip")));
public static List<TextData> getTraitLines(List<ITrait> traits, Material material) { List<TextData> lineData = new ArrayList<>(); for(ITrait trait : traits) { TextData text = new TextData(trait.getLocalizedName()); text.tooltip = LocUtils.convertNewlines(material.getTextColor() + trait.getLocalizedDesc()).split("\n"); text.color = TextFormatting.DARK_GRAY.getFriendlyName(); text.underlined = true; lineData.add(text); lineData.add(new TextData("\n")); } return lineData; }