Package mods.railcraft.client.render.carts

Source Code of mods.railcraft.client.render.carts.LocomotiveRenderer

/*
* Copyright (c) CovertJaguar, 2014 http://railcraft.info
*
* This code is the property of CovertJaguar
* and may only be used with explicit written
* permission unless otherwise specified on the
* license page at http://railcraft.info/wiki/info:license.
*/
package mods.railcraft.client.render.carts;

import mods.railcraft.api.carts.locomotive.IRenderer;
import mods.railcraft.api.carts.locomotive.LocomotiveRenderType;
import mods.railcraft.client.emblems.EmblemToolsClient;
import net.minecraft.entity.item.EntityMinecart;
import mods.railcraft.common.carts.EntityLocomotive;
import mods.railcraft.common.util.misc.EnumColor;
import net.minecraft.util.ResourceLocation;

/**
*
* @author CovertJaguar <http://www.railcraft.info>
*/
public class LocomotiveRenderer extends CartModelRenderer {

    public static final LocomotiveRenderer INSTANCE = new LocomotiveRenderer();

    @Override
    public boolean render(IRenderer renderer, EntityMinecart cart, float light, float time) {
        EntityLocomotive loco = (EntityLocomotive) cart;

        int primaryColor = EnumColor.fromId(loco.getPrimaryColor()).getHexColor();
        int secondaryColor = EnumColor.fromId(loco.getSecondaryColor()).getHexColor();

        String emblem = loco.getEmblem();
        ResourceLocation emblemTexture = null;
        if (emblem != null && !emblem.equals("") && 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, cart, primaryColor, secondaryColor, emblemTexture, light, time);
        return false;
    }

}
TOP

Related Classes of mods.railcraft.client.render.carts.LocomotiveRenderer

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.