Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.client.entity;
- import com.mojang.authlib.GameProfile;
- import java.io.File;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.network.NetworkPlayerInfo;
- import net.minecraft.client.renderer.IImageBuffer;
- import net.minecraft.client.renderer.ImageBufferDownload;
- import net.minecraft.client.renderer.ThreadDownloadImageData;
- import net.minecraft.client.renderer.texture.ITextureObject;
- import net.minecraft.client.renderer.texture.TextureManager;
- import net.minecraft.client.resources.DefaultPlayerSkin;
- import net.minecraft.entity.SharedMonsterAttributes;
- import net.minecraft.entity.ai.attributes.IAttributeInstance;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.init.Items;
- import net.minecraft.util.ResourceLocation;
- import net.minecraft.util.StringUtils;
- import net.minecraft.world.World;
- import net.minecraft.world.WorldSettings;
- public abstract class AbstractClientPlayer extends EntityPlayer
- {
- private NetworkPlayerInfo field_175157_a;
- private static final String __OBFID = "CL_00000935";
- public static final ResourceLocation locationStevePng = new ResourceLocation("textures/entity/steve.png");
- private ThreadDownloadImageData downloadImageSkin;
- private ThreadDownloadImageData downloadImageCape;
- private ResourceLocation locationSkin;
- private ResourceLocation locationCape;
- public AbstractClientPlayer(World worldIn, GameProfile p_i45074_2_)
- {
- super(worldIn, p_i45074_2_);
- this.setupCustomSkin();
- }
- protected void setupCustomSkin()
- {
- System.out.println("Loading ExtremeMinecraftCapes");
- if (this.getName() != null && !this.getName().isEmpty())
- {
- this.locationSkin = getLocationSkin(this.getName());
- this.locationCape = getLocationCape(this.getName());
- this.downloadImageSkin = getDownloadImageSkin(this.locationSkin, this.getName());
- this.downloadImageCape = getDownloadImageCape(this.locationCape, this.getName());
- }
- }
- public ThreadDownloadImageData getTextureSkin()
- {
- return this.downloadImageSkin;
- }
- public ThreadDownloadImageData getTextureCape()
- {
- return this.downloadImageCape;
- }
- public ResourceLocation getLocationSkin()
- {
- return this.locationSkin;
- }
- public ResourceLocation getLocationCape()
- {
- return this.locationCape;
- }
- public static ThreadDownloadImageData getDownloadImageSkin(ResourceLocation par0ResourceLocation, String par1Str)
- {
- return getDownloadImage(par0ResourceLocation, getSkinUrl(par1Str), locationStevePng, new ImageBufferDownload());
- }
- public static ThreadDownloadImageData getDownloadImageCape(ResourceLocation par0ResourceLocation, String par1Str)
- {
- return getDownloadImage(par0ResourceLocation, getCapeUrl(par1Str), (ResourceLocation)null, (IImageBuffer)null);
- }
- private static ThreadDownloadImageData getDownloadImage(ResourceLocation par0ResourceLocation, String par1Str, ResourceLocation par2ResourceLocation, IImageBuffer par3IImageBuffer)
- {
- TextureManager var4 = Minecraft.getMinecraft().getTextureManager();
- Object var5 = var4.getTexture(par0ResourceLocation);
- if (var5 == null)
- {
- var5 = new ThreadDownloadImageData(null, par1Str, par2ResourceLocation, par3IImageBuffer);
- var4.loadTexture(par0ResourceLocation, (ITextureObject)var5);
- }
- return (ThreadDownloadImageData)var5;
- }
- public static String getSkinUrl(String username)
- {
- return String.format("http://skins.minecraft.net/MinecraftSkins/" + username + ".png");
- }
- public static String getCapeUrl(String username)
- {
- return String.format("http://s.craftlifegaming.com/capes/" + username + ".png");
- }
- public static ResourceLocation getLocationSkin(String username)
- {
- return new ResourceLocation("skins/" + StringUtils.stripControlCodes(username));
- }
- public static ResourceLocation getLocationCape(String username)
- {
- return new ResourceLocation("cloaks/" + StringUtils.stripControlCodes(username));
- }
- public static ResourceLocation getLocationSkull(String par0Str)
- {
- return new ResourceLocation("skull/" + StringUtils.stripControlCodes(par0Str));
- }
- public boolean func_175149_v()
- {
- NetworkPlayerInfo var1 = Minecraft.getMinecraft().getNetHandler().func_175102_a(this.getGameProfile().getId());
- return var1 != null && var1.getGameType() == WorldSettings.GameType.SPECTATOR;
- }
- public boolean hasCape()
- {
- return this.func_175155_b() != null;
- }
- protected NetworkPlayerInfo func_175155_b()
- {
- if (this.field_175157_a == null)
- {
- this.field_175157_a = Minecraft.getMinecraft().getNetHandler().func_175102_a(this.getUniqueID());
- }
- return this.field_175157_a;
- }
- public boolean hasSkin()
- {
- NetworkPlayerInfo var1 = this.func_175155_b();
- return var1 != null && var1.func_178856_e();
- }
- public ResourceLocation getLocationSkinOG()
- {
- NetworkPlayerInfo var1 = this.func_175155_b();
- return var1 == null ? DefaultPlayerSkin.func_177334_a(this.getUniqueID()) : var1.func_178837_g();
- }
- public ResourceLocation getLocationCapeOG()
- {
- NetworkPlayerInfo var1 = this.func_175155_b();
- return var1 == null ? null : var1.func_178861_h();
- }
- public String func_175154_l()
- {
- NetworkPlayerInfo var1 = this.func_175155_b();
- return var1 == null ? DefaultPlayerSkin.func_177332_b(this.getUniqueID()) : var1.func_178851_f();
- }
- public float func_175156_o()
- {
- float var1 = 1.0F;
- if (this.capabilities.isFlying)
- {
- var1 *= 1.1F;
- }
- IAttributeInstance var2 = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
- var1 = (float)((double)var1 * ((var2.getAttributeValue() / (double)this.capabilities.getWalkSpeed() + 1.0D) / 2.0D));
- if (this.capabilities.getWalkSpeed() == 0.0F || Float.isNaN(var1) || Float.isInfinite(var1))
- {
- var1 = 1.0F;
- }
- if (this.isUsingItem() && this.getItemInUse().getItem() == Items.bow)
- {
- int var3 = this.getItemInUseDuration();
- float var4 = (float)var3 / 20.0F;
- if (var4 > 1.0F)
- {
- var4 = 1.0F;
- }
- else
- {
- var4 *= var4;
- }
- var1 *= 1.0F - var4 * 0.15F;
- }
- return var1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement