Search in sources :

Example 1 with LocomotiveModelRenderer

use of mods.railcraft.client.render.carts.LocomotiveModelRenderer in project Railcraft by Railcraft.

the class ItemLocomotive method addInformation.

// @Override
// @SideOnly(Side.CLIENT)
// public IIcon getIcon(ItemStack stack, int pass) {
// String rendererTag = getModel(stack);
// LocomotiveModelRenderer renderer = renderType.getRenderer(rendererTag);
// if (renderer == null)
// return RenderTools.getMissingTexture();
// IIcon[] icons = renderer.getItemIcons();
// if (pass >= icons.length || icons[pass] == null)
// return blankIcon;
// return renderer.getItemIcons()[pass];
// }
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable World world, List<String> info, ITooltipFlag adv) {
    super.addInformation(stack, world, info, adv);
    GameProfile owner = getOwner(stack);
    if (owner.getName() != null && !RailcraftConstantsAPI.UNKNOWN_PLAYER.equalsIgnoreCase(owner.getName())) {
        String format = LocalizationPlugin.translate("gui.railcraft.locomotive.tips.item.owner");
        info.add(String.format(format, owner.getName()));
    }
    String model = getModel(stack);
    LocomotiveModelRenderer renderer = renderType.getRenderer(model);
    String modelName = renderer.getDisplayName();
    String format = LocalizationPlugin.translate("gui.railcraft.locomotive.tips.item.model");
    info.add(String.format(format, modelName));
    EnumColor primary = getPrimaryColor(stack);
    format = LocalizationPlugin.translate("gui.railcraft.locomotive.tips.item.primary");
    info.add(String.format(format, primary.getTranslatedName()));
    EnumColor secondary = getSecondaryColor(stack);
    format = LocalizationPlugin.translate("gui.railcraft.locomotive.tips.item.secondary");
    info.add(String.format(format, secondary.getTranslatedName()));
    float whistle = getWhistlePitch(stack);
    format = LocalizationPlugin.translate("gui.railcraft.locomotive.tips.item.whistle");
    info.add(String.format(format, whistle < 0 ? "???" : String.format("%.2f", whistle)));
    String emblemIdent = getEmblem(stack);
    if (!Strings.isEmpty(emblemIdent) && EmblemToolsClient.packageManager != null) {
        Emblem emblem = EmblemToolsClient.packageManager.getEmblem(emblemIdent);
        if (emblem != null) {
            format = LocalizationPlugin.translate("gui.railcraft.locomotive.tips.item.emblem");
            info.add(String.format(format, emblem.displayName));
        }
    }
}
Also used : EnumColor(mods.railcraft.common.plugins.color.EnumColor) GameProfile(com.mojang.authlib.GameProfile) Emblem(mods.railcraft.client.emblems.Emblem) LocomotiveModelRenderer(mods.railcraft.client.render.carts.LocomotiveModelRenderer) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

GameProfile (com.mojang.authlib.GameProfile)1 Emblem (mods.railcraft.client.emblems.Emblem)1 LocomotiveModelRenderer (mods.railcraft.client.render.carts.LocomotiveModelRenderer)1 EnumColor (mods.railcraft.common.plugins.color.EnumColor)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1