Search in sources :

Example 1 with IWoodFireproof

use of forestry.arboriculture.IWoodFireproof in project ForestryMC by ForestryMC.

the class ItemWoodBlock method getItemStackDisplayName.

@Override
public String getItemStackDisplayName(ItemStack itemstack) {
    if (this.getBlock() instanceof IWoodTyped) {
        IWoodTyped block = (IWoodTyped) getBlock();
        int meta = itemstack.getItemDamage();
        WoodType woodType = block.getWoodType(meta);
        if (woodType == null) {
            return null;
        }
        String displayName;
        String customUnlocalizedName = block.getBlockKind() + "." + woodType.ordinal() + ".name";
        if (StringUtil.canTranslateTile(customUnlocalizedName)) {
            displayName = StringUtil.localizeTile(customUnlocalizedName);
        } else {
            String woodGrammar = StringUtil.localize(block.getBlockKind() + ".grammar");
            String woodTypeName = StringUtil.localize("trees.woodType." + woodType);
            displayName = woodGrammar.replaceAll("%TYPE", woodTypeName);
        }
        if (this.getBlock() instanceof IWoodFireproof) {
            displayName = StringUtil.localizeAndFormatRaw("tile.for.fireproof", displayName);
        }
        return displayName;
    }
    return super.getItemStackDisplayName(itemstack);
}
Also used : IWoodTyped(forestry.arboriculture.IWoodTyped) WoodType(forestry.arboriculture.WoodType) IWoodFireproof(forestry.arboriculture.IWoodFireproof)

Aggregations

IWoodFireproof (forestry.arboriculture.IWoodFireproof)1 IWoodTyped (forestry.arboriculture.IWoodTyped)1 WoodType (forestry.arboriculture.WoodType)1