mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 23:52:19 +00:00
ITS WORKING!!!!!
Redesigned Steve 32 Model. Now USERNAMES work. Finally figured out the issue SkinUrls and it was becaused 64s overwrite the 64x32 versions. Needed to store 64x64 in separate folder.
This commit is contained in:
1 parent
66270715ac
commit
df6b631549
9 files changed
+49
-288
No files matched your search
@@ -20,7 +20,6 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.boss.BossStatus;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.client.ImageDownloadAlt;
|
||||
import noppes.npcs.client.ImageDownloadAlt32;
|
||||
import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.constants.EnumAnimation;
|
||||
import noppes.npcs.constants.EnumStandingType;
|
||||
@@ -281,7 +280,7 @@ public class RenderNPCInterface extends RenderLiving{
|
||||
}
|
||||
LastTextureTick = 0;
|
||||
}
|
||||
else if(npc.display.skinType == 2){
|
||||
else if(npc.display.skinType == 2 || npc.display.skinType == 3){
|
||||
try{
|
||||
MessageDigest digest = MessageDigest.getInstance("MD5");
|
||||
byte[] hash = digest.digest(npc.display.url.getBytes("UTF-8"));
|
||||
@@ -289,30 +288,15 @@ public class RenderNPCInterface extends RenderLiving{
|
||||
for(byte b : hash){
|
||||
sb.append(String.format("%02x", b&0xff));
|
||||
}
|
||||
npc.textureLocation = new ResourceLocation("skins/" + sb.toString());
|
||||
|
||||
loadSkin32(null, npc.textureLocation, npc.display.url);
|
||||
|
||||
LastTextureTick = 0;
|
||||
}
|
||||
catch(Exception ex){
|
||||
|
||||
}
|
||||
}
|
||||
// SKIN CHANGE
|
||||
// For 64 x 64 Textures
|
||||
else if(npc.display.skinType == 3){
|
||||
try{
|
||||
MessageDigest digestion = MessageDigest.getInstance("MD5");
|
||||
byte[] hash = digestion.digest(npc.display.url.getBytes("UTF-8"));
|
||||
StringBuilder sb = new StringBuilder(2*hash.length);
|
||||
for(byte b : hash){
|
||||
sb.append(String.format("%02x", b&0xff));
|
||||
// SKIN CHANGE
|
||||
if(npc.display.skinType == 2){
|
||||
npc.textureLocation = new ResourceLocation("skins/" + sb.toString());
|
||||
loadSkin(null, npc.textureLocation, npc.display.url, false);
|
||||
}
|
||||
else{
|
||||
npc.textureLocation = new ResourceLocation("skins64/" + sb.toString());
|
||||
loadSkin(null, npc.textureLocation, npc.display.url, true);
|
||||
}
|
||||
npc.textureLocation = new ResourceLocation("skins/" + sb.toString());
|
||||
|
||||
loadSkin(null, npc.textureLocation, npc.display.url);
|
||||
|
||||
LastTextureTick = 0;
|
||||
}
|
||||
catch(Exception ex){
|
||||
@@ -325,18 +309,11 @@ public class RenderNPCInterface extends RenderLiving{
|
||||
return npc.textureLocation;
|
||||
}
|
||||
|
||||
// 64x64 Skin
|
||||
private void loadSkin(File file, ResourceLocation resource, String par1Str){
|
||||
// 64x64 Skin is True
|
||||
private void loadSkin(File file, ResourceLocation resource, String par1Str, boolean version){
|
||||
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
|
||||
ITextureObject object = new ImageDownloadAlt(file, par1Str, SkinManager.field_152793_a, new ImageBufferDownloadAlt());
|
||||
ITextureObject object = new ImageDownloadAlt(file, par1Str, SkinManager.field_152793_a, new ImageBufferDownloadAlt(version));
|
||||
texturemanager.loadTexture(resource, object);
|
||||
}
|
||||
|
||||
// SORT OF WORKS
|
||||
private void loadSkin32(File file, ResourceLocation resource, String par1Str){
|
||||
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
|
||||
ITextureObject object = new ImageDownloadAlt32(file, par1Str, SkinManager.field_152793_a, new ImageBufferDownload32());
|
||||
texturemanager.loadTexture(resource, object);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user