Search in sources :

Example 6 with RenderPlayer

use of net.minecraft.client.renderer.entity.RenderPlayer in project RebornCore by TechReborn.

the class HolidayRenderEvent method holidayRender.

@SubscribeEvent
public static void holidayRender(RenderPlayerEvent.Pre event) {
    if (!CalenderUtils.christmas || !RebornCoreConfig.easterEggs) {
        return;
    }
    Render render = Minecraft.getMinecraft().getRenderManager().getEntityRenderObject(event.getEntityPlayer());
    if (render instanceof RenderPlayer) {
        RenderPlayer renderPlayer = (RenderPlayer) render;
        if (!renderPlayerList.contains(renderPlayer)) {
            renderPlayer.addLayer(new LayerRender());
            renderPlayerList.add(renderPlayer);
        }
    }
}
Also used : Render(net.minecraft.client.renderer.entity.Render) RenderPlayer(net.minecraft.client.renderer.entity.RenderPlayer) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 7 with RenderPlayer

use of net.minecraft.client.renderer.entity.RenderPlayer in project Armourers-Workshop by RiskyKen.

the class SkinModelRenderer method onRenderSpecialsPost.

@SubscribeEvent
public void onRenderSpecialsPost(RenderPlayerEvent.Specials.Post event) {
    if (ClientProxy.getSkinRenderType() != SkinRenderType.RENDER_EVENT) {
        return;
    }
    EntityPlayer player = event.entityPlayer;
    RenderPlayer render = event.renderer;
    if (player.getGameProfile() == null) {
        return;
    }
    PlayerPointer playerPointer = new PlayerPointer(player);
    if (!playerEquipmentMap.containsKey(playerPointer)) {
        return;
    }
    double distance = Minecraft.getMinecraft().thePlayer.getDistance(player.posX, player.posY, player.posZ);
    if (distance > ConfigHandlerClient.maxSkinRenderDistance) {
        return;
    }
    EquipmentWardrobeData ewd = ClientProxy.equipmentWardrobeHandler.getEquipmentWardrobeData(new PlayerPointer(player));
    byte[] extraColours = null;
    if (ewd != null) {
        Color skinColour = new Color(ewd.skinColour);
        Color hairColour = new Color(ewd.hairColour);
        extraColours = new byte[] { (byte) skinColour.getRed(), (byte) skinColour.getGreen(), (byte) skinColour.getBlue(), (byte) hairColour.getRed(), (byte) hairColour.getGreen(), (byte) hairColour.getBlue() };
    }
    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_BLEND);
    for (int slot = 0; slot < 4; slot++) {
        for (int skinIndex = 0; skinIndex < ExPropsPlayerSkinData.MAX_SLOTS_PER_SKIN_TYPE; skinIndex++) {
            if (slot == SkinTypeRegistry.skinHead.getVanillaArmourSlotId()) {
                Skin data = getPlayerCustomArmour(player, SkinTypeRegistry.skinHead, skinIndex);
                ISkinDye dye = getPlayerDyeData(player, SkinTypeRegistry.skinHead, skinIndex);
                if (data != null) {
                    customHead.render(player, render.modelBipedMain, data, false, dye, extraColours, false, distance, true);
                }
            }
            if (slot == SkinTypeRegistry.skinChest.getVanillaArmourSlotId()) {
                Skin data = getPlayerCustomArmour(player, SkinTypeRegistry.skinChest, skinIndex);
                ISkinDye dye = getPlayerDyeData(player, SkinTypeRegistry.skinChest, skinIndex);
                if (data != null) {
                    customChest.render(player, render.modelBipedMain, data, false, dye, extraColours, false, distance, true);
                }
            }
            if (slot == SkinTypeRegistry.skinLegs.getVanillaArmourSlotId()) {
                Skin data = getPlayerCustomArmour(player, SkinTypeRegistry.skinLegs, skinIndex);
                ISkinDye dye = getPlayerDyeData(player, SkinTypeRegistry.skinLegs, skinIndex);
                if (data != null) {
                    customLegs.render(player, render.modelBipedMain, data, false, dye, extraColours, false, distance, true);
                }
            }
            if (slot == SkinTypeRegistry.skinSkirt.getVanillaArmourSlotId()) {
                Skin data = getPlayerCustomArmour(player, SkinTypeRegistry.skinSkirt, skinIndex);
                ISkinDye dye = getPlayerDyeData(player, SkinTypeRegistry.skinSkirt, skinIndex);
                if (data != null) {
                    customSkirt.render(player, render.modelBipedMain, data, false, dye, extraColours, false, distance, true);
                }
            }
            if (slot == SkinTypeRegistry.skinFeet.getVanillaArmourSlotId()) {
                Skin data = getPlayerCustomArmour(player, SkinTypeRegistry.skinFeet, skinIndex);
                ISkinDye dye = getPlayerDyeData(player, SkinTypeRegistry.skinFeet, skinIndex);
                if (data != null) {
                    customFeet.render(player, render.modelBipedMain, data, false, dye, extraColours, false, distance, true);
                }
            }
            if (slot == 0) {
                Skin data = getPlayerCustomArmour(player, SkinTypeRegistry.skinWings, skinIndex);
                ISkinDye dye = getPlayerDyeData(player, SkinTypeRegistry.skinWings, skinIndex);
                if (data != null) {
                    customWings.render(player, render.modelBipedMain, data, false, dye, extraColours, false, distance, true);
                }
            }
        }
    }
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glPopMatrix();
}
Also used : PlayerPointer(riskyken.armourersWorkshop.common.data.PlayerPointer) EquipmentWardrobeData(riskyken.armourersWorkshop.common.skin.EquipmentWardrobeData) ISkinDye(riskyken.armourersWorkshop.api.common.skin.data.ISkinDye) Color(java.awt.Color) EntityPlayer(net.minecraft.entity.player.EntityPlayer) Skin(riskyken.armourersWorkshop.common.skin.data.Skin) AbstractModelSkin(riskyken.armourersWorkshop.client.model.skin.AbstractModelSkin) RenderPlayer(net.minecraft.client.renderer.entity.RenderPlayer) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Example 8 with RenderPlayer

use of net.minecraft.client.renderer.entity.RenderPlayer in project takumicraft by TNTModders.

the class TakumiClientEvents method renderPlayer.

@SubscribeEvent
public void renderPlayer(Pre event) {
    if (TakumiUtils.isApril(Minecraft.getMinecraft().world) && (event.getRenderer() instanceof RenderPlayer && !(event.getRenderer() instanceof RenderPlayerSP)) && event.getEntity() instanceof AbstractClientPlayer) {
        event.setCanceled(true);
        RenderPlayerSP sp = new RenderPlayerSP(event.getRenderer().getRenderManager());
        sp.doRender(((AbstractClientPlayer) event.getEntity()), event.getX(), event.getY(), event.getZ(), ((AbstractClientPlayer) event.getEntity()).rotationYaw, event.getPartialRenderTick());
    }
    if (event.getEntity().isPotionActive(TakumiPotionCore.INVERSION)) {
        GlStateManager.popMatrix();
        GlStateManager.rotate(180, 1, 0, 0);
        GlStateManager.translate(0, -1.9, 0);
    }
    if (event.getEntity().isPotionActive(TakumiPotionCore.CREEPERED)) {
        GlStateManager.popMatrix();
        float f = this.getCreeperFlashIntensity(event.getEntity(), event.getPartialRenderTick());
        if (f > 0) {
            float f1 = 1.0F + MathHelper.sin(f * 100.0F) * f * 0.01F;
            f = MathHelper.clamp(f, 0.0F, 1.0F);
            f = f * f;
            f = f * f;
            float f2 = (1.0F + f * 0.4F) * f1;
            float f3 = (1.0F + f * 0.1F) / f1;
            GlStateManager.scale(f2, f3, f2);
        }
    }
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) RenderPlayerSP(com.tntmodders.takumi.client.render.sp.RenderPlayerSP) RenderPlayer(net.minecraft.client.renderer.entity.RenderPlayer) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 9 with RenderPlayer

use of net.minecraft.client.renderer.entity.RenderPlayer in project Armourers-Workshop by RiskyKen.

the class EquipmentWardrobeHandler method onRender.

@SubscribeEvent
public void onRender(RenderPlayerEvent.Post event) {
    EntityPlayer player = event.entityPlayer;
    if (player instanceof MannequinFakePlayer) {
        return;
    }
    if (player.getGameProfile() == null) {
        return;
    }
    if (player instanceof FakePlayer) {
        return;
    }
    // Restore the head overlay.
    PlayerPointer playerPointer = new PlayerPointer(player);
    RenderPlayer renderer = event.renderer;
    if (equipmentWardrobeMap.containsKey(playerPointer)) {
        renderer.modelBipedMain.bipedHeadwear.isHidden = false;
    }
}
Also used : PlayerPointer(riskyken.armourersWorkshop.common.data.PlayerPointer) MannequinFakePlayer(riskyken.armourersWorkshop.client.render.MannequinFakePlayer) EntityPlayer(net.minecraft.entity.player.EntityPlayer) RenderPlayer(net.minecraft.client.renderer.entity.RenderPlayer) MannequinFakePlayer(riskyken.armourersWorkshop.client.render.MannequinFakePlayer) FakePlayer(net.minecraftforge.common.util.FakePlayer) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Example 10 with RenderPlayer

use of net.minecraft.client.renderer.entity.RenderPlayer in project Armourers-Workshop by RiskyKen.

the class EquipmentWardrobeHandler method onRender.

@SubscribeEvent
public void onRender(RenderPlayerEvent.Pre event) {
    EntityPlayer player = event.entityPlayer;
    if (player instanceof MannequinFakePlayer) {
        return;
    }
    if (player.getGameProfile() == null) {
        return;
    }
    if (player instanceof FakePlayer) {
        return;
    }
    // Hide the head overlay if the player has turned it off.
    PlayerPointer playerPointer = new PlayerPointer(player);
    RenderPlayer renderer = event.renderer;
    if (equipmentWardrobeMap.containsKey(playerPointer)) {
        EquipmentWardrobeData ewd = equipmentWardrobeMap.get(playerPointer);
        renderer.modelBipedMain.bipedHeadwear.isHidden = ewd.headOverlay;
        if (!ewd.headOverlay) {
            if (SkinModelRenderer.INSTANCE.playerHasCustomHead(player)) {
                renderer.modelBipedMain.bipedHeadwear.isHidden = true;
            }
        }
    }
}
Also used : PlayerPointer(riskyken.armourersWorkshop.common.data.PlayerPointer) MannequinFakePlayer(riskyken.armourersWorkshop.client.render.MannequinFakePlayer) EquipmentWardrobeData(riskyken.armourersWorkshop.common.skin.EquipmentWardrobeData) EntityPlayer(net.minecraft.entity.player.EntityPlayer) RenderPlayer(net.minecraft.client.renderer.entity.RenderPlayer) MannequinFakePlayer(riskyken.armourersWorkshop.client.render.MannequinFakePlayer) FakePlayer(net.minecraftforge.common.util.FakePlayer) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Aggregations

RenderPlayer (net.minecraft.client.renderer.entity.RenderPlayer)11 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)3 RenderManager (net.minecraft.client.renderer.entity.RenderManager)3 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)3 PlayerPointer (riskyken.armourersWorkshop.common.data.PlayerPointer)3 Field (java.lang.reflect.Field)2 ModelBiped (net.minecraft.client.model.ModelBiped)2 Render (net.minecraft.client.renderer.entity.Render)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 FakePlayer (net.minecraftforge.common.util.FakePlayer)2 MannequinFakePlayer (riskyken.armourersWorkshop.client.render.MannequinFakePlayer)2 EquipmentWardrobeData (riskyken.armourersWorkshop.common.skin.EquipmentWardrobeData)2 LayerBloodElytra (WayofTime.bloodmagic.client.render.LayerBloodElytra)1 InvokeEvent (cc.hyperium.event.InvokeEvent)1 IMixinThreadDownloadImageData (cc.hyperium.mixins.client.renderer.IMixinThreadDownloadImageData)1 IMixinTextureManager (cc.hyperium.mixins.client.renderer.texture.IMixinTextureManager)1 BloodRenderLayer (com.teamwizardry.wizardry.client.render.BloodRenderLayer)1 RenderHaloEntity (com.teamwizardry.wizardry.client.render.item.RenderHaloEntity)1 RenderHaloPlayer (com.teamwizardry.wizardry.client.render.item.RenderHaloPlayer)1