Search in sources :

Example 11 with AbstractClientPlayer

use of net.minecraft.client.entity.AbstractClientPlayer in project Galacticraft by micdoodle8.

the class PlayerUtil method makeOtherPlayerProfile.

@SideOnly(Side.CLIENT)
public static GameProfile makeOtherPlayerProfile(String strName, String strUUID) {
    GameProfile profile = null;
    for (Object e : FMLClientHandler.instance().getWorldClient().getLoadedEntityList()) {
        if (e instanceof AbstractClientPlayer) {
            GameProfile gp2 = ((AbstractClientPlayer) e).getGameProfile();
            if (gp2.getName().equals(strName)) {
                profile = gp2;
                break;
            }
        }
    }
    if (profile == null) {
        UUID uuid = strUUID.isEmpty() ? UUID.randomUUID() : UUID.fromString(strUUID);
        profile = new GameProfile(uuid, strName);
    }
    PlayerUtil.knownSkins.put(strName, profile);
    return profile;
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) GameProfile(com.mojang.authlib.GameProfile) UUID(java.util.UUID) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 12 with AbstractClientPlayer

use of net.minecraft.client.entity.AbstractClientPlayer in project EnderIO by SleepyTrousers.

the class UpgradeRenderManager method replaceCapeLayer.

private static void replaceCapeLayer(@Nonnull RenderPlayer renderLivingBase) {
    try {
        List<LayerRenderer<AbstractClientPlayer>> value = ReflectionHelper.getPrivateValue(RenderLivingBase.class, renderLivingBase, "layerRenderers", "field_177097_h");
        if (value != null) {
            LayerRenderer<AbstractClientPlayer> capeLayer = null;
            for (LayerRenderer<AbstractClientPlayer> layerRenderer : value) {
                if (layerRenderer instanceof LayerCape && !(layerRenderer instanceof CapeFilterLayer)) {
                    capeLayer = layerRenderer;
                    break;
                }
            }
            if (capeLayer != null) {
                renderLivingBase.addLayer(new CapeFilterLayer(capeLayer));
                value.remove(capeLayer);
            }
        }
    } catch (UnableToAccessFieldException e) {
        Log.warn("Unable to access RenderLivingBase.layerRenderers, reason: " + e);
    }
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) LayerCape(net.minecraft.client.renderer.entity.layers.LayerCape) LayerRenderer(net.minecraft.client.renderer.entity.layers.LayerRenderer) CapeFilterLayer(crazypants.enderio.base.item.darksteel.upgrade.elytra.CapeFilterLayer) UnableToAccessFieldException(net.minecraftforge.fml.relauncher.ReflectionHelper.UnableToAccessFieldException)

Example 13 with AbstractClientPlayer

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

the class RenderEventHandler method renderPlayer.

// mmdanggg2: renderPlayerEvent seems to be getting depreciated so this will
// do for now.
@SubscribeEvent
public void renderPlayer(RenderLivingEvent.Pre event) {
    if (event.getEntity() instanceof AbstractClientPlayer) {
        AbstractClientPlayer player = (AbstractClientPlayer) event.getEntity();
        UserManager manager = UserManager.getInstance();
        User user = manager.getUser(player.getUniqueID().toString());
        if (user == null)
            return;
        ICape cape = user.capes.get(0);
        if (cape == null)
            return;
        boolean flag = cape.isTextureLoaded(player);
        if (!flag)
            cape.loadTexture(player);
    }
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) User(com.jadarstudios.developercapes.user.User) UserManager(com.jadarstudios.developercapes.user.UserManager) ICape(com.jadarstudios.developercapes.cape.ICape) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 14 with AbstractClientPlayer

use of net.minecraft.client.entity.AbstractClientPlayer 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 15 with AbstractClientPlayer

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

the class SkinModelRenderer method getPlayerExtraColours.

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

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