Пример #1
0
 @Override
 public IChatComponent func_151519_b(EntityLivingBase living) {
   IChatComponent comp = (getEntity() == null ? damageSourceEntity : getEntity()).func_145748_c_();
   ItemStack item =
       getEntity() instanceof EntityLivingBase
           ? ((EntityLivingBase) getEntity()).getHeldItem()
           : null;
   String s = "death.attack.thrown.item";
   String s1 = s + ".item";
   return item != null && item.hasDisplayName() && StatCollector.canTranslate(s1)
       ? new ChatComponentTranslation(s1, living.func_145748_c_(), comp, item.func_151000_E())
       : new ChatComponentTranslation(s, living.func_145748_c_(), comp);
 }
 @Override
 public String getTranslatedName(int level) {
   String enchantedName = StatCollector.translateToLocal("enchantment.level." + level);
   if (StatCollector.canTranslate("minechem.enchantment.coated")) {
     return MinechemUtil.getLocalString(chemical.getUnlocalizedName())
         + " "
         + StatCollector.translateToLocalFormatted("minechem.enchantment.coated", enchantedName);
   } else {
     return MinechemUtil.getLocalString(chemical.getUnlocalizedName())
         + " "
         + enchantedName
         + " Coated";
   }
 }
  @Override
  public String getItemStackDisplayName(ItemStack stack) {
    tconstruct.library.tools.ToolMaterial toolmat =
        TConstructRegistry.getMaterial(getMaterialID(stack));
    if (toolmat == null) return super.getItemStackDisplayName(stack);

    String material = toolmat.localizationString.substring(9); // :(

    // custom name
    if (StatCollector.canTranslate("toolpart." + partName + "." + material)) {
      return StatCollector.translateToLocal("toolpart." + partName + "." + material);
    }
    // general name
    else {
      // specific material name for materials?
      String matName;
      if (StatCollector.canTranslate("toolpart.material." + material))
        matName = StatCollector.translateToLocal("toolpart.material." + material);
      else matName = toolmat.prefixName();

      return StatCollector.translateToLocal("toolpart." + partName)
          .replaceAll("%%material", matName);
    }
  }
 /*    */ public static String localize(String s) /*    */ {
   /* 46 */ if (!StatCollector.canTranslate(s)) /* 47 */ return null;
   /* 48 */ return StatCollector.translateToLocal(s);
   /*    */ }
 public String getLocalizedName(String str) {
   String name = getUnlocalizedName() + "." + str;
   if (StatCollector.canTranslate(name)) return StatCollector.translateToLocal(name);
   return null;
 }
Пример #6
0
 public static boolean canTranslate(String key) {
   return StatCollector.canTranslate(key);
 }