Search in sources :

Example 1 with EntityRendererClayCam

use of de.sanandrew.mods.claysoldiers.client.render.EntityRendererClayCam in project ClaySoldiersMod by SanAndreasP.

the class RenderClayCamHandler method onRenderTick.

@SubscribeEvent
public void onRenderTick(TickEvent.RenderTickEvent event) {
    Minecraft mc = Minecraft.getMinecraft();
    if (event.phase == Phase.START) {
        if (mc.thePlayer != null && ClientProxy.s_clayCamEntity != null) {
            if (this.viewMode == -1) {
                this.viewMode = mc.gameSettings.thirdPersonView;
            }
            mc.gameSettings.thirdPersonView = 1;
            if (this.p_clayCamRenderer == null) {
                this.p_clayCamRenderer = new EntityRendererClayCam(mc, mc.getResourceManager());
            }
            if (mc.entityRenderer != this.p_clayCamRenderer) {
                // be sure to store the previous renderer
                this.p_prevEntityRenderer = mc.entityRenderer;
                mc.entityRenderer = this.p_clayCamRenderer;
            }
            if (mc.thePlayer.isSneaking() || ClientProxy.s_clayCamEntity.isDead) {
                mc.gameSettings.thirdPersonView = this.viewMode;
                this.viewMode = -1;
                ClaySoldiersMod.proxy.switchClayCam(false, null);
            }
        } else if (this.p_prevEntityRenderer != null && mc.entityRenderer != this.p_prevEntityRenderer) {
            // reset the renderer
            mc.entityRenderer = this.p_prevEntityRenderer;
        }
    } else if (ClientProxy.s_clayCamEntity != null) {
        mc.gameSettings.thirdPersonView = this.viewMode;
    }
}
Also used : EntityRendererClayCam(de.sanandrew.mods.claysoldiers.client.render.EntityRendererClayCam) Minecraft(net.minecraft.client.Minecraft) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Aggregations

SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)1 EntityRendererClayCam (de.sanandrew.mods.claysoldiers.client.render.EntityRendererClayCam)1 Minecraft (net.minecraft.client.Minecraft)1