Search in sources :

Example 1 with ModelTextured

use of mods.railcraft.client.render.models.programmatic.ModelTextured in project Railcraft by Railcraft.

the class CartContentRenderer method render.

public void render(RenderCart renderer, T cart, float light, float partialTicks) {
    int blockOffset = cart.getDisplayTileOffset();
    IBlockState blockState = cart.getDisplayTile();
    if (blockState.getRenderType() != EnumBlockRenderType.INVISIBLE) {
        GlStateManager.pushMatrix();
        renderer.bindTex(TextureMap.LOCATION_BLOCKS_TEXTURE);
        OpenGL.glTranslatef(-0.5F, (float) (blockOffset - 8) / 16.0F, 0.5F);
        Minecraft.getMinecraft().getBlockRendererDispatcher().renderBlockBrightness(blockState, cart.getBrightness(light));
        GlStateManager.popMatrix();
        renderer.bindTex(cart);
        return;
    }
    ModelTextured contents = CartModelManager.getContentModel(cart.getClass());
    if (contents == CartModelManager.emptyModel)
        return;
    ResourceLocation texture = contents.getTexture();
    if (texture == null)
        return;
    renderer.bindTex(texture);
    OpenGL.glPushAttrib(GL11.GL_ENABLE_BIT);
    if (!contents.cullBackFaces())
        OpenGL.glDisable(GL11.GL_CULL_FACE);
    OpenGL.glPushMatrix();
    OpenGL.glTranslatef(-0.5F, blockOffset / 16.0F - 0.5F, -0.5F);
    contents.render(cart, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    OpenGL.glEnable(GL11.GL_CULL_FACE);
    OpenGL.glPopMatrix();
    OpenGL.glPopAttrib();
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) ModelTextured(mods.railcraft.client.render.models.programmatic.ModelTextured) ResourceLocation(net.minecraft.util.ResourceLocation)

Example 2 with ModelTextured

use of mods.railcraft.client.render.models.programmatic.ModelTextured in project Railcraft by Railcraft.

the class CartModelManager method getContentModel.

public static ModelTextured getContentModel(Class eClass) {
    ModelTextured render = modelsContents.get(eClass);
    if (render == null && eClass != EntityMinecart.class) {
        render = getContentModel(eClass.getSuperclass());
        modelsContents.put(eClass, render);
    }
    return render != null ? render : emptyModel;
}
Also used : ModelTextured(mods.railcraft.client.render.models.programmatic.ModelTextured) EntityMinecart(net.minecraft.entity.item.EntityMinecart)

Aggregations

ModelTextured (mods.railcraft.client.render.models.programmatic.ModelTextured)2 IBlockState (net.minecraft.block.state.IBlockState)1 EntityMinecart (net.minecraft.entity.item.EntityMinecart)1 ResourceLocation (net.minecraft.util.ResourceLocation)1