Search in sources :

Example 1 with RenderEntity

use of ebf.tim.models.RenderEntity in project Trains-In-Motion-1.7.10 by EternalBlueFlame.

the class ClientProxy method register.

/**
     * <h2>Client Register</h2>
     * Used for registering client only functions and redirecting registering the items in the train registry with their own textures and models.
     */
@Override
public void register() {
    super.register();
    GameRegistry.registerBlock(lampBlock, "lampblock");
    lampBlock.setLightLevel(1f);
    //register the fluid icons
    fluidOil.setIcons(BlockLiquid.getLiquidIcon("water_still"), BlockLiquid.getLiquidIcon("water_flow"));
    //trains and rollingstock
    int index = 0;
    while (TransportRegistry.listTrains(index) != null) {
        TransportRegistry reg = TransportRegistry.listTrains(index);
        RenderingRegistry.registerEntityRenderingHandler(reg.trainClass, new RenderEntity(reg.model, reg.texture, reg.bogieModels));
        index++;
    }
    //hitboxes
    RenderingRegistry.registerEntityRenderingHandler(HitboxHandler.MultipartHitbox.class, nullRender);
    //bogies
    RenderingRegistry.registerEntityRenderingHandler(EntityBogie.class, nullRender);
    //seats
    RenderingRegistry.registerEntityRenderingHandler(EntitySeat.class, nullRender);
    //player scaler
    RenderingRegistry.registerEntityRenderingHandler(EntityPlayer.class, new RenderScaledPlayer());
    //GameRegistry.registerBlock(new BlockRailOverride(), Item);
    ClientRegistry.bindTileEntitySpecialRenderer(BlockRailOverride.renderTileEntity.class, new TileEntitySpecialRenderer() {

        @Override
        public void renderTileEntityAt(TileEntity p_147500_1_, double p_147500_2_, double p_147500_4_, double p_147500_6_, float p_147500_8_) {
            GL11.glPushMatrix();
            GL11.glTranslated(p_147500_2_ + 0.5, p_147500_4_ + 0.3, p_147500_6_ + 0.5);
            GL11.glScaled(1, 0.5, 1);
            switch(p_147500_1_.getBlockMetadata()) {
                //straight
                case 1:
                    {
                        GL11.glRotatef(180, 1, 0, 0);
                        Minecraft.getMinecraft().getTextureManager().bindTexture(URIRegistry.MODEL_RAIL_TEXTURE.getResource("RailStraight.png"));
                        railStraightModel.render(null, 0, 0, 0, 0, 0, 0);
                        break;
                    }
                case 0:
                    {
                        GL11.glRotatef(180, 1, 0, 1f);
                        Minecraft.getMinecraft().getTextureManager().bindTexture(URIRegistry.MODEL_RAIL_TEXTURE.getResource("RailStraight.png"));
                        railStraightModel.render(null, 0, 0, 0, 0, 0, 0);
                        break;
                    }
                //TODO: model is upsidedown i think...
                case 6:
                    {
                        GL11.glRotatef(180, 1, 0, 0);
                        GL11.glRotatef(270, 0, 1, 0);
                        Minecraft.getMinecraft().getTextureManager().bindTexture(URIRegistry.MODEL_RAIL_TEXTURE.getResource("RailCurveVerySmall.png"));
                        railCurveModel.render(null, 0, 0, 0, 0, 0, 0);
                        break;
                    }
                case 7:
                    {
                        GL11.glRotatef(180, 1, 0, 0);
                        Minecraft.getMinecraft().getTextureManager().bindTexture(URIRegistry.MODEL_RAIL_TEXTURE.getResource("RailCurveVerySmall.png"));
                        railCurveModel.render(null, 0, 0, 0, 0, 0, 0);
                        break;
                    }
                case 8:
                    {
                        GL11.glRotatef(180, 1, 0, 0);
                        GL11.glRotatef(90, 0, 1, 0);
                        Minecraft.getMinecraft().getTextureManager().bindTexture(URIRegistry.MODEL_RAIL_TEXTURE.getResource("RailCurveVerySmall.png"));
                        railCurveModel.render(null, 0, 0, 0, 0, 0, 0);
                        break;
                    }
                case 9:
                    {
                        GL11.glRotatef(180, 1, 0, 0);
                        GL11.glRotatef(180, 0, 1, 0);
                        Minecraft.getMinecraft().getTextureManager().bindTexture(URIRegistry.MODEL_RAIL_TEXTURE.getResource("RailCurveVerySmall.png"));
                        railCurveModel.render(null, 0, 0, 0, 0, 0, 0);
                        break;
                    }
            }
            GL11.glPopMatrix();
        }
    });
    //keybinds
    ClientRegistry.registerKeyBinding(KeyLamp);
    ClientRegistry.registerKeyBinding(KeyInventory);
    ClientRegistry.registerKeyBinding(KeyAccelerate);
    ClientRegistry.registerKeyBinding(KeyReverse);
    //register the transport HUD.
    HUDTrain hud = new HUDTrain();
    FMLCommonHandler.instance().bus().register(hud);
    MinecraftForge.EVENT_BUS.register(hud);
}
Also used : RenderScaledPlayer(ebf.tim.models.RenderScaledPlayer) TileEntity(net.minecraft.tileentity.TileEntity) RenderEntity(ebf.tim.models.RenderEntity) BlockRailOverride(ebf.tim.blocks.BlockRailOverride) HUDTrain(ebf.tim.gui.HUDTrain) TransportRegistry(ebf.tim.registry.TransportRegistry) TileEntitySpecialRenderer(net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer) BlockRailOverride(ebf.tim.blocks.BlockRailOverride) BlockRailOverride(ebf.tim.blocks.BlockRailOverride)

Aggregations

BlockRailOverride (ebf.tim.blocks.BlockRailOverride)1 HUDTrain (ebf.tim.gui.HUDTrain)1 RenderEntity (ebf.tim.models.RenderEntity)1 RenderScaledPlayer (ebf.tim.models.RenderScaledPlayer)1 TransportRegistry (ebf.tim.registry.TransportRegistry)1 TileEntitySpecialRenderer (net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer)1 TileEntity (net.minecraft.tileentity.TileEntity)1