}
@SubscribeEvent
public void onPostRender(RenderPlayerEvent.Specials.Post event)
{
AbstractClientPlayer player = (AbstractClientPlayer) event.entityPlayer;
boolean flag = ClientProxyCore.capeMap.containsKey(event.entityPlayer.getCommandSenderName());
float f4;
if (flag && !player.isInvisible() && !player.getHideCape())
{
String url = ClientProxyCore.capeMap.get(player.getCommandSenderName());
ResourceLocation capeLoc = capesMap.get(url);
if (!capesMap.containsKey(url))
{
try
{
String dirName = Minecraft.getMinecraft().mcDataDir.getAbsolutePath();
File directory = new File(dirName, "assets");
boolean success = true;
if (!directory.exists())
{
success = directory.mkdir();
}
if (success)
{
directory = new File(directory, "gcCapes");
if (!directory.exists())
{
success = directory.mkdir();
}
if (success)
{
String hash = String.valueOf(player.getCommandSenderName().hashCode());
File file1 = new File(directory, hash.substring(0, 2));
File file2 = new File(file1, hash);
final ResourceLocation resourcelocation = new ResourceLocation("gcCapes/" + hash);
ThreadDownloadImageDataGC threaddownloadimagedata = new ThreadDownloadImageDataGC(file2, url, null, new IImageBuffer()
{
public BufferedImage parseUserSkin(BufferedImage p_78432_1_)
{
if (p_78432_1_ == null)
{
return null;
}
else
{
BufferedImage bufferedimage1 = new BufferedImage(512, 256, 2);
Graphics graphics = bufferedimage1.getGraphics();
graphics.drawImage(p_78432_1_, 0, 0, null);
graphics.dispose();
p_78432_1_ = bufferedimage1;
}
return p_78432_1_;
}
public void func_152634_a()
{
}
});
if (ClientProxyCore.mc.getTextureManager().loadTexture(resourcelocation, threaddownloadimagedata))
{
capeLoc = resourcelocation;
}
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
capesMap.put(url, capeLoc);
}
if (capeLoc != null)
{
ClientProxyCore.mc.getTextureManager().bindTexture(capeLoc);
GL11.glPushMatrix();
GL11.glTranslatef(0.0F, 0.0F, 0.125F);
double d3 = player.field_71091_bM + (player.field_71094_bP - player.field_71091_bM) * event.partialRenderTick - (player.prevPosX + (player.posX - player.prevPosX) * event.partialRenderTick);
double d4 = player.field_71096_bN + (player.field_71095_bQ - player.field_71096_bN) * event.partialRenderTick - (player.prevPosY + (player.posY - player.prevPosY) * event.partialRenderTick);
double d0 = player.field_71097_bO + (player.field_71085_bR - player.field_71097_bO) * event.partialRenderTick - (player.prevPosZ + (player.posZ - player.prevPosZ) * event.partialRenderTick);
f4 = (player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * event.partialRenderTick) / 57.29578F;
double d1 = MathHelper.sin(f4);
double d2 = -MathHelper.cos(f4);
float f5 = (float) d4 * 10.0F;
if (f5 < -6.0F)
{
f5 = -6.0F;
}
if (f5 > 32.0F)
{
f5 = 32.0F;
}
float f6 = (float) (d3 * d1 + d0 * d2) * 100.0F;
float f7 = (float) (d3 * d2 - d0 * d1) * 100.0F;
if (f6 < 0.0F)
{
f6 = 0.0F;
}
float f8 = player.prevCameraYaw + (player.cameraYaw - player.prevCameraYaw) * event.partialRenderTick;
f5 += MathHelper.sin((player.prevDistanceWalkedModified + (player.distanceWalkedModified - player.prevDistanceWalkedModified) * event.partialRenderTick) * 6.0F) * 32.0F * f8;
if (player.isSneaking())
{
f5 += 25.0F;
}
GL11.glRotatef(6.0F + f6 / 2.0F + f5, 1.0F, 0.0F, 0.0F);