@SideOnly(Side.CLIENT) public ResourceLocation getSkinResourceLocation() { if (owner != null) { final SkinManager manager = Minecraft.getMinecraft().getSkinManager(); Map<Type, MinecraftProfileTexture> map = manager.loadSkinFromCache(owner); if (map.containsKey(Type.SKIN)) { final MinecraftProfileTexture skin = map.get(Type.SKIN); return manager.loadSkin(skin, Type.SKIN); } else { UUID uuid = EntityPlayer.getUUID(owner); return DefaultPlayerSkin.getDefaultSkin(uuid); } } return null; }
protected void loadPlayerTextures() { synchronized (this) { if (!this.playerTexturesLoaded) { this.playerTexturesLoaded = true; Minecraft.getMinecraft().getSkinManager().loadProfileTextures(this.gameProfile, new SkinManager.SkinAvailableCallback() { public void skinAvailable(Type p_180521_1_, ResourceLocation location, MinecraftProfileTexture profileTexture) { switch (p_180521_1_) { case SKIN: NetworkPlayerInfo.this.locationSkin = location; NetworkPlayerInfo.this.skinType = profileTexture.getMetadata("model"); if (NetworkPlayerInfo.this.skinType == null) { NetworkPlayerInfo.this.skinType = "default"; } break; case CAPE: NetworkPlayerInfo.this.locationCape = location; } } }, true); } } }
@Override public ResourceLocation func_152789_a(final MinecraftProfileTexture texture, final Type type, final SkinManager.SkinAvailableCallback callBack) { if (type != Type.SKIN) return super.func_152789_a(texture, type, callBack); final boolean isSpecialCallBack = callBack instanceof ISkinDownloadCallback; final ResourceLocation resLocationOld = new ResourceLocation("skins/" + texture.getHash()); final ResourceLocation resLocation = new ResourceLocation(Reference.MOD_ID, resLocationOld.getResourcePath()); ITextureObject itextureobject = textureManager.getTexture(resLocation); if (itextureobject != null) { if (callBack != null) callBack.func_152121_a(type, resLocation); } else { File file1 = new File(skinFolder, texture.getHash().substring(0, 2)); File file2 = new File(file1, texture.getHash()); final NewImageBufferDownload imgDownload = new NewImageBufferDownload(); ITextureObject imgData = new NewThreadDownloadImageData(file2, texture.getUrl(), field_152793_a, imgDownload, resLocationOld, new IImageBuffer() { @Override public BufferedImage parseUserSkin(BufferedImage buffImg) { if (buffImg != null) PlayerModelManager.analyseTexture(buffImg, resLocation); return imgDownload.parseUserSkin(buffImg); } @Override public void func_152634_a() { imgDownload.func_152634_a(); if (callBack != null) callBack.func_152121_a(type, isSpecialCallBack ? resLocation : resLocationOld); } }); textureManager.loadTexture(resLocation, imgData); textureManager.loadTexture(resLocationOld, imgData); // Avoid thrown exception if the image is requested before the download is done } return isSpecialCallBack ? resLocation : resLocationOld; }
protected void loadPlayerTextures() { synchronized (this) { if (!this.playerTexturesLoaded) { this.playerTexturesLoaded = true; Minecraft.getMinecraft().getSkinManager().loadProfileTextures(this.gameProfile, new SkinManager.SkinAvailableCallback() { public void skinAvailable(Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture) { switch (typeIn) { case SKIN: NetworkPlayerInfo.this.playerTextures.put(Type.SKIN, location); NetworkPlayerInfo.this.skinType = profileTexture.getMetadata("model"); if (NetworkPlayerInfo.this.skinType == null) { NetworkPlayerInfo.this.skinType = "default"; } break; case CAPE: NetworkPlayerInfo.this.playerTextures.put(Type.CAPE, location); break; case ELYTRA: NetworkPlayerInfo.this.playerTextures.put(Type.ELYTRA, location); } } }, true); } } }
public void reloadRemoteSkin(SkinManager.SkinAvailableCallback listener) { this.remoteSkin = true; if (this.remoteSkinTexture != null) { this.textureManager.deleteTexture(this.remoteSkinResource); } if (this.remoteElytraTexture != null) { this.textureManager.deleteTexture(this.remoteElytraResource); } this.remoteSkinTexture = HDSkinManager.getPreviewTexture(this.remoteSkinResource, this.profile, Type.SKIN, NO_SKIN, listener); this.remoteElytraTexture = HDSkinManager.getPreviewTexture(this.remoteElytraResource, this.profile, Type.ELYTRA, NO_ELYTRA, null); }
@Override public void init(final FMLInitializationEvent event) { super.init(event); final SkinManager skinManager = Minecraft.getMinecraft().getSkinManager(); ClientRegistry.bindTileEntitySpecialRenderer(DeathMarkerTileEntity.class, new DeathMarkerRenderer(skinManager)); }
@Override public void run() { try { Thread.sleep(1000); } catch (InterruptedException e1) { e1.printStackTrace(); } running = true; String response = null; try { response = MiscUtils.post(new URL("https://www.wurst-capes.tk/cosmetics/"), JsonUtils.gson.toJson(JsonUtils.gson.toJsonTree(callbacks.keySet()).getAsJsonArray()), "application/json"); JsonObject cosmetics = JsonUtils.jsonParser.parse(response).getAsJsonObject(); for (Entry<String, JsonElement> entry : cosmetics.entrySet()) { JsonObject playerCosmetics = entry.getValue().getAsJsonObject(); Minecraft.getMinecraft().addScheduledTask(() -> { SkinManager skinManager = Minecraft.getMinecraft().getSkinManager(); if (playerCosmetics.has("skin")) { skinManager .loadSkin(new MinecraftProfileTexture(playerCosmetics.get("skin").getAsString(), null), Type.SKIN, callbacks.get(entry.getKey())); } if (playerCosmetics.has("cape")) { skinManager .loadSkin(new MinecraftProfileTexture(playerCosmetics.get("cape").getAsString(), null), Type.CAPE, callbacks.get(entry.getKey())); } }); } } catch (Exception e) { System.err.println("[Wurst] Failed to load " + callbacks.size() + " cosmetic(s) from wurst-capes.tk!"); System.out.println("Server response:\n" + response); e.printStackTrace(); } }
public AbstractClientPlayer(World p_i45074_1_, GameProfile p_i45074_2_) { super(p_i45074_1_, p_i45074_2_); String s = this.getCommandSenderName(); if (!s.isEmpty()) { SkinManager skinmanager = Minecraft.getMinecraft().func_152342_ad(); skinmanager.func_152790_a(p_i45074_2_, this, true); } }
public SkinManager getSkinManager() { return this.skinManager; }
public NewSkinManager(SkinManager oldManager, TextureManager textureManager, File skinFolder, MinecraftSessionService sessionService) { super(textureManager, skinFolder, sessionService); this.textureManager = textureManager; this.skinFolder = skinFolder; }
public DeathMarkerRenderer(final SkinManager skinManager) { this.skinManager = skinManager; }
public SkinManager func_152342_ad() { return this.field_152350_aA; }