Search in sources :

Example 1 with TileEntitySpecialRenderer

use of net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer 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)

Example 2 with TileEntitySpecialRenderer

use of net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer in project NewHorizonsCoreMod by GTNewHorizons.

the class ClientProxy method registerRenderInfo.

public void registerRenderInfo() {
    BlockBabyChest.pRenderID = RenderingRegistry.getNextAvailableRenderId();
    TileEntitySpecialRenderer render = new RenderBabyChest();
    MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(MainRegistry._mBlockBabyChest), new RenderItemBabyChest());
    ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBabyChest.class, render);
    MinecraftForge.EVENT_BUS.register(ch);
}
Also used : RenderBabyChest(com.dreammaster.modbabychest.RenderBabyChest) TileEntitySpecialRenderer(net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer) RenderItemBabyChest(com.dreammaster.modbabychest.RenderItemBabyChest)

Example 3 with TileEntitySpecialRenderer

use of net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer in project Binnie by ForestryMC.

the class ManagerMachine method postInit.

@Override
public void postInit() {
    // TODO fix rendering
    // BinnieCore.proxy.createObject("binnie.core.machines.RendererMachine");
    Object rendererMachine = null;
    BinnieCore.getBinnieProxy().registerTileEntity(TileEntityMachine.class, "binnie.tile.machine");
    BinnieCore.getBinnieProxy().registerTileEntity(TileEntityTESRMachine.class, "binnie.tile.machine.tesr", new IBinnieProxy.ClientSupplier<TileEntitySpecialRenderer<TileEntityTESRMachine>>() {

        @SideOnly(Side.CLIENT)
        @Override
        public TileEntitySpecialRenderer<TileEntityTESRMachine> get() {
            return new RenderTESRMachine();
        }
    });
}
Also used : IBinnieProxy(binnie.core.proxy.IBinnieProxy) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) TileEntitySpecialRenderer(net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer) RenderTESRMachine(binnie.core.machines.render.RenderTESRMachine)

Aggregations

TileEntitySpecialRenderer (net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer)3 RenderTESRMachine (binnie.core.machines.render.RenderTESRMachine)1 IBinnieProxy (binnie.core.proxy.IBinnieProxy)1 RenderBabyChest (com.dreammaster.modbabychest.RenderBabyChest)1 RenderItemBabyChest (com.dreammaster.modbabychest.RenderItemBabyChest)1 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 TileEntity (net.minecraft.tileentity.TileEntity)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1