Search in sources :

Example 1 with AbstractClientPlayer

use of net.minecraft.client.entity.AbstractClientPlayer in project Totemic by TeamTotemic.

the class PlayerRender method onPlayerRender.

@SubscribeEvent
public void onPlayerRender(RenderPlayerEvent.Post event) {
    AbstractClientPlayer player = (AbstractClientPlayer) event.getEntityPlayer();
    if (ljfaUUID.equals(player.getUniqueID()) && annaSkinId.equals(player.getLocationSkin().getResourcePath())) {
        float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * event.getPartialRenderTick();
        float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * event.getPartialRenderTick();
        float pitchZ = (float) Math.toDegrees(event.getRenderer().getMainModel().bipedHead.rotateAngleZ);
        GlStateManager.pushMatrix();
        if (player.isSneaking())
            GlStateManager.translate(0, -0.25F, 0);
        GlStateManager.translate(event.getX(), event.getY() + 1.501F * 0.9375F, event.getZ());
        GlStateManager.rotate(pitchZ, 0, 0, 1);
        GlStateManager.rotate(yaw - 90, 0, -1, 0);
        GlStateManager.rotate(pitch + 180, 0, 0, 1);
        if (!player.inventory.armorItemInSlot(3).isEmpty())
            GlStateManager.translate(0.01F, -0.04F, 0);
        if (annaHatDisplayList == 0)
            createAnnaHatDisplayList();
        GlStateManager.callList(annaHatDisplayList);
        GlStateManager.popMatrix();
    }
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 2 with AbstractClientPlayer

use of net.minecraft.client.entity.AbstractClientPlayer in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class GuiPlayerPortrait method onRenderOverlayPost.

@SubscribeEvent
public void onRenderOverlayPost(RenderGameOverlayEvent event) {
    if (!MainConfig.displayGUI())
        return;
    Minecraft mc = Minecraft.getMinecraft();
    if (!mc.player.getCapability(ModCapabilities.PLAYER_STATS, null).getHudMode())
        return;
    int screenWidth = event.getResolution().getScaledWidth();
    int screenHeight = event.getResolution().getScaledHeight();
    if (event.getType() == RenderGameOverlayEvent.ElementType.TEXT) {
        GL11.glColor3f(1, 1, 1);
        ResourceLocation skin = ((AbstractClientPlayer) mc.player).getLocationSkin();
        mc.getTextureManager().bindTexture(skin);
        float scale = 0.5f;
        switch(mc.gameSettings.guiScale) {
            case Constants.SCALE_AUTO:
                scale = 0.85f;
                break;
            case Constants.SCALE_NORMAL:
                scale = 0.85f;
                break;
            default:
                scale = 0.65f;
                break;
        }
        DriveStateCapability.IDriveState DS = mc.player.getCapability(ModCapabilities.DRIVE_STATE, null);
        if (DS.getActiveDriveName().equals(Strings.Form_Anti))
            GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) this.alpha);
        // HEAD
        int headWidth = 32;
        int headHeight = 32;
        float headPosX = 16;
        float headPosY = 32;
        float scaledHeadPosX = headPosX * scale;
        float scaledHeadPosY = headPosY * scale;
        GL11.glPushMatrix();
        {
            GL11.glTranslatef((screenWidth - headWidth * scale) - scaledHeadPosX, (screenHeight - headHeight * scale) - scaledHeadPosY, 0);
            GL11.glScalef(scale, scale, scale);
            this.drawTexturedModalRect(0, 0, 32, 32, headWidth, headHeight);
        }
        GL11.glPopMatrix();
        // HAT
        int hatWidth = 32;
        int hatHeight = 32;
        float hatPosX = 16;
        float hatPosY = 32;
        float scaledHatPosX = hatPosX * scale;
        float scaledHatPosY = hatPosY * scale;
        GL11.glPushMatrix();
        {
            GL11.glTranslatef((screenWidth - hatWidth * scale) - scaledHatPosX, (screenHeight - hatHeight * scale) - scaledHatPosY, 0);
            GL11.glScalef(scale, scale, scale);
            this.drawTexturedModalRect(0, 0, 160, 32, hatWidth, hatHeight);
        }
        GL11.glPopMatrix();
        // BODY
        int bodyWidth = 32;
        int bodyHeight = 64;
        float bodyPosX = 16;
        float bodyPosY = -32;
        float scaledBodyPosX = bodyPosX * scale;
        float scaledBodyPosY = bodyPosY * scale;
        GL11.glPushMatrix();
        {
            GL11.glTranslatef((screenWidth - bodyWidth * scale) - scaledBodyPosX, (screenHeight - bodyHeight * scale) - scaledBodyPosY, 0);
            GL11.glScalef(scale, scale, scale);
            this.drawTexturedModalRect(0, 0, 80, 80, bodyWidth, bodyHeight);
        }
        GL11.glPopMatrix();
        // JACKET
        int jacketWidth = 32;
        int jacketHeight = 64;
        float jacketPosX = 16;
        float jacketPosY = -32;
        float scaledjacketPosX = jacketPosX * scale;
        float scaledjacketPosY = jacketPosY * scale;
        GL11.glPushMatrix();
        {
            GL11.glTranslatef((screenWidth - bodyWidth * scale) - scaledBodyPosX, (screenHeight - bodyHeight * scale) - scaledBodyPosY, 0);
            GL11.glScalef(scale, scale, scale);
            this.drawTexturedModalRect(0, 0, 80, 148, bodyWidth, bodyHeight);
        }
        GL11.glPopMatrix();
        // ARMS
        int armWidth = 16;
        int armHeight = 64;
        float armRPosX = 48;
        float armRPosY = -32;
        float scaledArmRPosX = armRPosX * scale;
        float scaledArmRPosY = armRPosY * scale;
        float armLPosX = 0;
        float armLPosY = -32;
        float scaledArmLPosX = armLPosX * scale;
        float scaledArmLPosY = armLPosY * scale;
        GL11.glPushMatrix();
        {
            GL11.glTranslatef((screenWidth - armWidth * scale) - scaledArmRPosX, (screenHeight - armHeight * scale) - scaledArmRPosY, 0);
            GL11.glScalef(scale, scale, scale);
            this.drawTexturedModalRect(0, 0, 176, 80, armWidth, armHeight);
        }
        GL11.glPopMatrix();
        GL11.glPushMatrix();
        {
            GL11.glTranslatef((screenWidth - armWidth * scale) - scaledArmLPosX, (screenHeight - armHeight * scale) - scaledArmLPosY, 0);
            GL11.glScalef(scale, scale, scale);
            this.drawTexturedModalRect(0, 0, 176, 80, armWidth, armHeight);
        }
        GL11.glPopMatrix();
        GL11.glColor4f(100.0F, 1.0F, 1.0F, 1.0F);
        // GLOVES
        int gloveWidth = 16;
        int gloveHeight = 64;
        float gloveRPosX = 48;
        float gloveRPosY = -32;
        float scaledgloveRPosX = gloveRPosX * scale;
        float scaledgloveRPosY = gloveRPosY * scale;
        float gloveLPosX = 0;
        float gloveLPosY = -32;
        float scaledgloveLPosX = gloveLPosX * scale;
        float scaledgloveLPosY = gloveLPosY * scale;
        GL11.glPushMatrix();
        {
            GL11.glTranslatef((screenWidth - gloveWidth * scale) - scaledgloveRPosX, (screenHeight - gloveHeight * scale) - scaledgloveRPosY, 0);
            GL11.glScalef(scale, scale, scale);
            this.drawTexturedModalRect(0, 0, 176, 150, gloveWidth, gloveHeight);
        }
        GL11.glPopMatrix();
        GL11.glPushMatrix();
        {
            GL11.glTranslatef((screenWidth - gloveWidth * scale) - scaledgloveLPosX, (screenHeight - gloveHeight * scale) - scaledgloveLPosY, 0);
            GL11.glScalef(scale, scale, scale);
            this.drawTexturedModalRect(0, 0, 176, 150, gloveWidth, gloveHeight);
        }
        GL11.glPopMatrix();
        GL11.glColor4f(100.0F, 1.0F, 1.0F, 1.0F);
        if (DS.getActiveDriveName().equals(Strings.Form_Valor)) {
            ResourceLocation texture = new ResourceLocation(Reference.MODID, "textures/armour/Valor.png");
            mc.renderEngine.bindTexture(texture);
            GL11.glPushMatrix();
            {
                GL11.glTranslatef((screenWidth - 32 * scale) - 16 * scale, (screenHeight - 80 * scale) - -48 * scale, 0);
                GL11.glScalef(2, 1, 1);
                GL11.glScalef(0.5f, 0.5f, 0.5f);
                GL11.glScalef(scale, scale, scale);
                this.drawTexturedModalRect(0, 0, 80, 140, 32, 80);
            }
            GL11.glPopMatrix();
            GL11.glPushMatrix();
            {
                GL11.glTranslatef((screenWidth - 16 * scale) - 48 * scale, (screenHeight - 80 * scale) - -48 * scale, 0);
                GL11.glScalef(2, 1, 1);
                GL11.glScalef(0.5f, 0.5f, 0.5f);
                GL11.glScalef(scale, scale, scale);
                this.drawTexturedModalRect(0, 0, 64, 140, 16, 80);
            }
            GL11.glPopMatrix();
            GL11.glPushMatrix();
            {
                GL11.glTranslatef((screenWidth - 16 * scale) - 0 * scale, (screenHeight - 80 * scale) - -48 * scale, 0);
                GL11.glScalef(2, 1, 1);
                GL11.glScalef(0.5f, 0.5f, 0.5f);
                GL11.glScalef(scale, scale, scale);
                this.drawTexturedModalRect(0, 0, 112, 140, 16, 80);
            }
            GL11.glPopMatrix();
        } else if (DS.getActiveDriveName().equals(Strings.Form_Wisdom)) {
            ResourceLocation texture = new ResourceLocation(Reference.MODID, "textures/armour/Wisdom.png");
            mc.renderEngine.bindTexture(texture);
            GL11.glPushMatrix();
            {
                GL11.glTranslatef((screenWidth - 32 * scale) - 16 * scale, (screenHeight - 80 * scale) - -48 * scale, 0);
                GL11.glScalef(2, 1, 1);
                GL11.glScalef(0.5f, 0.5f, 0.5f);
                GL11.glScalef(scale, scale, scale);
                this.drawTexturedModalRect(0, 0, 80, 140, 32, 80);
            }
            GL11.glPopMatrix();
            GL11.glPushMatrix();
            {
                GL11.glTranslatef((screenWidth - 16 * scale) - 48 * scale, (screenHeight - 80 * scale) - -48 * scale, 0);
                GL11.glScalef(2, 1, 1);
                GL11.glScalef(0.5f, 0.5f, 0.5f);
                GL11.glScalef(scale, scale, scale);
                this.drawTexturedModalRect(0, 0, 64, 140, 16, 80);
            }
            GL11.glPopMatrix();
            GL11.glPushMatrix();
            {
                GL11.glTranslatef((screenWidth - 16 * scale) - 0 * scale, (screenHeight - 80 * scale) - -48 * scale, 0);
                GL11.glScalef(2, 1, 1);
                GL11.glScalef(0.5f, 0.5f, 0.5f);
                GL11.glScalef(scale, scale, scale);
                this.drawTexturedModalRect(0, 0, 112, 140, 16, 80);
            }
            GL11.glPopMatrix();
        } else if (DS.getActiveDriveName().equals(Strings.Form_Limit)) {
            ResourceLocation texture = new ResourceLocation(Reference.MODID, "textures/armour/Limit.png");
            mc.renderEngine.bindTexture(texture);
            GL11.glPushMatrix();
            {
                GL11.glTranslatef((screenWidth - 32 * scale) - 16 * scale, (screenHeight - 80 * scale) - -48 * scale, 0);
                GL11.glScalef(2, 1, 1);
                GL11.glScalef(0.5f, 0.5f, 0.5f);
                GL11.glScalef(scale, scale, scale);
                this.drawTexturedModalRect(0, 0, 80, 140, 32, 80);
            }
            GL11.glPopMatrix();
            GL11.glPushMatrix();
            {
                GL11.glTranslatef((screenWidth - 16 * scale) - 48 * scale, (screenHeight - 80 * scale) - -48 * scale, 0);
                GL11.glScalef(2, 1, 1);
                GL11.glScalef(0.5f, 0.5f, 0.5f);
                GL11.glScalef(scale, scale, scale);
                this.drawTexturedModalRect(0, 0, 64, 140, 16, 80);
            }
            GL11.glPopMatrix();
            GL11.glPushMatrix();
            {
                GL11.glTranslatef((screenWidth - 16 * scale) - 0 * scale, (screenHeight - 80 * scale) - -48 * scale, 0);
                GL11.glScalef(2, 1, 1);
                GL11.glScalef(0.5f, 0.5f, 0.5f);
                GL11.glScalef(scale, scale, scale);
                this.drawTexturedModalRect(0, 0, 112, 140, 16, 80);
            }
            GL11.glPopMatrix();
        } else if (DS.getActiveDriveName().equals(Strings.Form_Master)) {
            ResourceLocation texture = new ResourceLocation(Reference.MODID, "textures/armour/Master.png");
            mc.renderEngine.bindTexture(texture);
            GL11.glPushMatrix();
            {
                GL11.glTranslatef((screenWidth - 32 * scale) - 16 * scale, (screenHeight - 80 * scale) - -48 * scale, 0);
                GL11.glScalef(2, 1, 1);
                GL11.glScalef(0.5f, 0.5f, 0.5f);
                GL11.glScalef(scale, scale, scale);
                this.drawTexturedModalRect(0, 0, 80, 140, 32, 80);
            }
            GL11.glPopMatrix();
            GL11.glPushMatrix();
            {
                GL11.glTranslatef((screenWidth - 16 * scale) - 48 * scale, (screenHeight - 80 * scale) - -48 * scale, 0);
                GL11.glScalef(2, 1, 1);
                GL11.glScalef(0.5f, 0.5f, 0.5f);
                GL11.glScalef(scale, scale, scale);
                this.drawTexturedModalRect(0, 0, 64, 140, 16, 80);
            }
            GL11.glPopMatrix();
            GL11.glPushMatrix();
            {
                GL11.glTranslatef((screenWidth - 16 * scale) - 0 * scale, (screenHeight - 80 * scale) - -48 * scale, 0);
                GL11.glScalef(2, 1, 1);
                GL11.glScalef(0.5f, 0.5f, 0.5f);
                GL11.glScalef(scale, scale, scale);
                this.drawTexturedModalRect(0, 0, 112, 140, 16, 80);
            }
            GL11.glPopMatrix();
        } else if (DS.getActiveDriveName().equals(Strings.Form_Final)) {
            ResourceLocation texture = new ResourceLocation(Reference.MODID, "textures/armour/Final.png");
            mc.renderEngine.bindTexture(texture);
            GL11.glPushMatrix();
            {
                GL11.glTranslatef((screenWidth - 32 * scale) - 16 * scale, (screenHeight - 80 * scale) - -48 * scale, 0);
                GL11.glScalef(2, 1, 1);
                GL11.glScalef(0.5f, 0.5f, 0.5f);
                GL11.glScalef(scale, scale, scale);
                this.drawTexturedModalRect(0, 0, 80, 140, 32, 80);
            }
            GL11.glPopMatrix();
            GL11.glPushMatrix();
            {
                GL11.glTranslatef((screenWidth - 16 * scale) - 48 * scale, (screenHeight - 80 * scale) - -48 * scale, 0);
                GL11.glScalef(2, 1, 1);
                GL11.glScalef(0.5f, 0.5f, 0.5f);
                GL11.glScalef(scale, scale, scale);
                this.drawTexturedModalRect(0, 0, 64, 140, 16, 80);
            }
            GL11.glPopMatrix();
            GL11.glPushMatrix();
            {
                GL11.glTranslatef((screenWidth - 16 * scale) - 0 * scale, (screenHeight - 80 * scale) - -48 * scale, 0);
                GL11.glScalef(2, 1, 1);
                GL11.glScalef(0.5f, 0.5f, 0.5f);
                GL11.glScalef(scale, scale, scale);
                this.drawTexturedModalRect(0, 0, 112, 140, 16, 80);
            }
            GL11.glPopMatrix();
        }
    }
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) ResourceLocation(net.minecraft.util.ResourceLocation) DriveStateCapability(uk.co.wehavecookies56.kk.common.capability.DriveStateCapability) Minecraft(net.minecraft.client.Minecraft) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 3 with AbstractClientPlayer

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

the class SkinModelRenderer method getPlayerCustomArmour.

public Skin getPlayerCustomArmour(Entity entity, ISkinType skinType, int slotIndex) {
    if (!(entity instanceof AbstractClientPlayer)) {
        return null;
    }
    AbstractClientPlayer player = (AbstractClientPlayer) entity;
    EntityEquipmentData equipmentData = playerEquipmentMap.get(new PlayerPointer(player));
    // Look for skinned armourer.
    if (skinType.getVanillaArmourSlotId() >= 0 && skinType.getVanillaArmourSlotId() < 4 && slotIndex == 0) {
        int slot = 3 - skinType.getVanillaArmourSlotId();
        ItemStack armourStack = player.getCurrentArmor(slot);
        if (SkinNBTHelper.stackHasSkinData(armourStack)) {
            SkinPointer sp = SkinNBTHelper.getSkinPointerFromStack(armourStack);
            return getCustomArmourItemData(sp);
        }
    }
    // No skinned armour found checking the equipment wardrobe.
    if (equipmentData == null) {
        return null;
    }
    if (!equipmentData.haveEquipment(skinType, slotIndex)) {
        return null;
    }
    ISkinPointer skinPointer = equipmentData.getSkinPointer(skinType, slotIndex);
    return getCustomArmourItemData(skinPointer);
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer) ISkinPointer(riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer) EntityEquipmentData(riskyken.armourersWorkshop.common.skin.EntityEquipmentData) PlayerPointer(riskyken.armourersWorkshop.common.data.PlayerPointer) ItemStack(net.minecraft.item.ItemStack) ISkinPointer(riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer)

Example 4 with AbstractClientPlayer

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

the class SkinModelRenderer method getPlayerCustomEquipmentData.

public IEntityEquipment getPlayerCustomEquipmentData(Entity entity) {
    if (!(entity instanceof AbstractClientPlayer)) {
        return null;
    }
    AbstractClientPlayer player = (AbstractClientPlayer) entity;
    EntityEquipmentData equipmentData = playerEquipmentMap.get(new PlayerPointer(player));
    return equipmentData;
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) EntityEquipmentData(riskyken.armourersWorkshop.common.skin.EntityEquipmentData) PlayerPointer(riskyken.armourersWorkshop.common.data.PlayerPointer)

Example 5 with AbstractClientPlayer

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

the class SkinModelRenderer method getPlayerDyeData.

public ISkinDye getPlayerDyeData(Entity entity, ISkinType skinType, int slotIndex) {
    if (!(entity instanceof AbstractClientPlayer)) {
        return null;
    }
    AbstractClientPlayer player = (AbstractClientPlayer) entity;
    EntityEquipmentData equipmentData = playerEquipmentMap.get(new PlayerPointer(player));
    // Look for skinned armourer.
    if (skinType.getVanillaArmourSlotId() >= 0 && skinType.getVanillaArmourSlotId() < 4 && slotIndex == 0) {
        int slot = 3 - skinType.getVanillaArmourSlotId();
        ItemStack armourStack = player.getCurrentArmor(slot);
        if (SkinNBTHelper.stackHasSkinData(armourStack)) {
            SkinPointer sp = SkinNBTHelper.getSkinPointerFromStack(armourStack);
            return sp.getSkinDye();
        }
    }
    // No skinned armour found checking the equipment wardrobe.
    if (equipmentData == null) {
        return null;
    }
    if (!equipmentData.haveEquipment(skinType, slotIndex)) {
        return null;
    }
    ISkinDye skinDye = equipmentData.getSkinPointer(skinType, slotIndex).getSkinDye();
    return skinDye;
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer) ISkinPointer(riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer) EntityEquipmentData(riskyken.armourersWorkshop.common.skin.EntityEquipmentData) PlayerPointer(riskyken.armourersWorkshop.common.data.PlayerPointer) ISkinDye(riskyken.armourersWorkshop.api.common.skin.data.ISkinDye) ItemStack(net.minecraft.item.ItemStack)

Aggregations

AbstractClientPlayer (net.minecraft.client.entity.AbstractClientPlayer)16 PlayerPointer (riskyken.armourersWorkshop.common.data.PlayerPointer)7 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)4 EntityEquipmentData (riskyken.armourersWorkshop.common.skin.EntityEquipmentData)4 Skin (riskyken.armourersWorkshop.common.skin.data.Skin)4 SkinPointer (riskyken.armourersWorkshop.common.skin.data.SkinPointer)4 RenderBlocks (net.minecraft.client.renderer.RenderBlocks)3 ResourceLocation (net.minecraft.util.ResourceLocation)3 ISkinDye (riskyken.armourersWorkshop.api.common.skin.data.ISkinDye)3 MannequinFakePlayer (riskyken.armourersWorkshop.client.render.MannequinFakePlayer)3 EquipmentWardrobeData (riskyken.armourersWorkshop.common.skin.EquipmentWardrobeData)3 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)2 ItemStack (net.minecraft.item.ItemStack)2 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)2 ISkinPointer (riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer)2 EntityTextureInfo (riskyken.armourersWorkshop.client.render.EntityTextureInfo)2 SkinPart (riskyken.armourersWorkshop.common.skin.data.SkinPart)2 ICape (com.jadarstudios.developercapes.cape.ICape)1 User (com.jadarstudios.developercapes.user.User)1 UserManager (com.jadarstudios.developercapes.user.UserManager)1