Search in sources :

Example 1 with Emblem

use of mods.railcraft.client.emblems.Emblem in project Railcraft by Railcraft.

the class ItemPost method addInformation.

@Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> info, boolean adv) {
    if (stack.getItemDamage() == EnumPost.EMBLEM.ordinal() && stack.hasTagCompound()) {
        NBTTagCompound nbt = stack.getTagCompound();
        NBTTagString emblemIdent = (NBTTagString) nbt.getTag("emblem");
        if (emblemIdent == null || EmblemToolsClient.packageManager == null)
            return;
        Emblem emblem = EmblemToolsClient.packageManager.getEmblem(emblemIdent.getString());
        if (emblem != null)
            info.add(TextFormatting.GRAY + emblem.displayName);
    }
}
Also used : Emblem(mods.railcraft.client.emblems.Emblem) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) NBTTagString(net.minecraft.nbt.NBTTagString)

Example 2 with Emblem

use of mods.railcraft.client.emblems.Emblem 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];
//    }
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> info, boolean adv) {
    super.addInformation(stack, player, info, adv);
    GameProfile owner = getOwner(stack);
    if (owner.getName() != null && !owner.getName().equals("[Unknown]")) {
        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;
    if (renderer != null)
        modelName = renderer.getDisplayName();
    else
        modelName = LocalizationPlugin.translate("gui.railcraft.locomotive.tips.item.model.default");
    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 (emblemIdent != null && !emblemIdent.isEmpty() && 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.api.carts.locomotive.LocomotiveModelRenderer)

Aggregations

Emblem (mods.railcraft.client.emblems.Emblem)2 GameProfile (com.mojang.authlib.GameProfile)1 LocomotiveModelRenderer (mods.railcraft.api.carts.locomotive.LocomotiveModelRenderer)1 EnumColor (mods.railcraft.common.plugins.color.EnumColor)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 NBTTagString (net.minecraft.nbt.NBTTagString)1