Search in sources :

Example 1 with LocomotiveModelRenderer

use of mods.railcraft.api.carts.locomotive.LocomotiveModelRenderer in project Railcraft by Railcraft.

the class RenderItemLocomotive method handleRenderType.

@Override
public boolean handleRenderType(ItemStack stack, ItemRenderType type) {
    switch(type) {
        case INVENTORY:
            String rendererTag = ItemLocomotive.getModel(stack);
            LocomotiveModelRenderer renderer = renderType.getRenderer(rendererTag);
            if (renderer == null || !renderer.renderItemIn3D())
                return false;
        case ENTITY:
        case EQUIPPED:
        case EQUIPPED_FIRST_PERSON:
            return true;
        default:
            return false;
    }
}
Also used : LocomotiveModelRenderer(mods.railcraft.api.carts.locomotive.LocomotiveModelRenderer)

Example 2 with LocomotiveModelRenderer

use of mods.railcraft.api.carts.locomotive.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];
//    }
@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

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