Jump to content

Maxk

Members
  • Posts

    2
  • Joined

  • Last visited

Maxk's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Can I have more details on this? Should I not do this because it is against the rules or because it is not possible?
  2. I have a link that gives out custom skins based on player name, e.g. "http://myserver/skins/name.png". The mod is client side, I need it to download the skin for a player from this link, store it somewhere (cache it?) and use it for rendering players. Here is what I have: public class mySkins{ Minecraft mc; public static String skinsURL = "http://myserver/skins/%s.png"; public HashMap<String,ResourceLocation> skins = new HashMap<>(); ... @SubscribeEvent public void onMyEvent(RenderPlayerEvent.Pre event){ AbstractClientPlayer acp = (AbstractClientPlayer)event.getEntityPlayer(); if (skins.containsKey(acp.getName())){ } else { System.out.println("downloadskin started " + acp.getName() + " " + acp.getLocationSkin()); ThreadDownloadImageData tdid = new ThreadDownloadImageData( (File)null, String.format(skinsURL,acp.getName()), acp.getLocationSkin(), new ImageBufferDownload()); mc.getTextureManager().loadTexture(acp.getLocationSkin(),tdid); skins.put(acp.getName(),acp.getLocationSkin()); System.out.println("downloadskin ended"); } } This does download proper skin but applies it to "minecraft:textures/entity/alex.png", obviously. So basically this only shows that link and download is working fine. I need to 1. cache downloaded skin and get its ResourceLocation 2. apply this ResourceLocation while rendering player Now if I go like this @SubscribeEvent public void onMyEvent(RenderPlayerEvent.Pre event){ AbstractClientPlayer acp = (AbstractClientPlayer)event.getEntityPlayer(); if (skins.containsKey(acp.getName())){ //i want to somehow appply skins.get(acp.getName()) } else { System.out.println("downloadskin started " + acp.getName() + " " + acp.getLocationSkin()); ResourceLocation res = new ResourceLocation("myskins/" + acp.getName().toLowerCase() + ".png"); ThreadDownloadImageData tdid = new ThreadDownloadImageData((File)null,String.format(skinsURL,acp.getName()),res,new ImageBufferDownload()); mc.getTextureManager().loadTexture(res,tdid); skins.put(acp.getName(),res); System.out.println("downloadskin ended"); } } it gives NullPointer at loadTexture [18:28:01] [Client thread/WARN]: Failed to load texture: minecraft:myskins/nickname.png java.io.FileNotFoundException: minecraft:myskins/nickname.png How do I go about this? I've tried changing first File argument in new ThreadDownloadImageData to non-null, also tried different ResrourceLocation's for res and still cant get it to work. To clarify, I dont need skins to be stored on hard drive, but only cached in memory while minecraft is running, so basically every time client joins the game, it will redownload skins for every player he meets
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.