Search in sources :

Example 1 with LocomotiveRenderType

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

the class LocomotiveRenderer method render.

@Override
public boolean render(ICartRenderer renderer, EntityMinecart cart, float light, float time) {
    EntityLocomotive loco = (EntityLocomotive) cart;
    EnumColor pColor = SeasonPlugin.isGhostTrain(cart) ? EnumColor.SILVER : EnumColor.fromDye(loco.getPrimaryColor());
    EnumColor sColor = SeasonPlugin.isGhostTrain(cart) ? EnumColor.SILVER : EnumColor.fromDye(loco.getSecondaryColor());
    int primaryColor = pColor.getHexColor();
    int secondaryColor = sColor.getHexColor();
    String emblem = loco.getEmblem();
    ResourceLocation emblemTexture = null;
    if (!StringUtils.isNullOrEmpty(emblem) && EmblemToolsClient.packageManager != null)
        emblemTexture = EmblemToolsClient.packageManager.getEmblemTextureLocation(emblem);
    LocomotiveRenderType renderType = loco.getRenderType();
    mods.railcraft.api.carts.locomotive.LocomotiveModelRenderer locoRenderer = renderType.getRenderer(loco.getModel());
    locoRenderer.renderLocomotive(renderer, loco, primaryColor, secondaryColor, emblemTexture, light, time);
    return false;
}
Also used : LocomotiveRenderType(mods.railcraft.api.carts.locomotive.LocomotiveRenderType) EnumColor(mods.railcraft.common.plugins.color.EnumColor) ResourceLocation(net.minecraft.util.ResourceLocation) EntityLocomotive(mods.railcraft.common.carts.EntityLocomotive)

Aggregations

LocomotiveRenderType (mods.railcraft.api.carts.locomotive.LocomotiveRenderType)1 EntityLocomotive (mods.railcraft.common.carts.EntityLocomotive)1 EnumColor (mods.railcraft.common.plugins.color.EnumColor)1 ResourceLocation (net.minecraft.util.ResourceLocation)1