Small Changes to ImageBuffer/LoadSkin

Attempting to Fix ImageBuffer add two different versions of LoadSkin
This commit is contained in:
KAMKEEL committed 2021-04-29 05:21:54 -04:00
1 parent 5f2b7a0142
commit e7424227e8
4 files changed
+17 -17

No files matched your search

@@ -54,7 +54,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
for(Object name : mapping.keySet()){
Class<?> c = (Class<?>) mapping.get(name);
try {
if( (!EntityCustomNpc.class.isAssignableFrom(c) && !EntityCustomNpc.class.isAssignableFrom(c)) && EntityLiving.class.isAssignableFrom(c) && c.getConstructor(new Class[] {World.class}) != null && !Modifier.isAbstract(c.getModifiers())){
if(!EntityCustomNpc.class.isAssignableFrom(c) && !EntityCustomNpc64.class.isAssignableFrom(c) && EntityLiving.class.isAssignableFrom(c) && c.getConstructor(new Class[] {World.class}) != null && !Modifier.isAbstract(c.getModifiers())){
if(RenderManager.instance.getEntityClassRenderObject(c) instanceof RendererLivingEntity)
data.put(name.toString(),c.asSubclass(EntityLivingBase.class));
}
@@ -63,7 +63,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
} catch (NoSuchMethodException e) {
}
}
data.put("CustomNPC64x64", EntityCustomNpc64.class);
data.put("CustomNPC64", EntityCustomNpc64.class);
list = new ArrayList<String>(data.keySet());
Collections.sort(list,String.CASE_INSENSITIVE_ORDER);
}
@@ -18,8 +18,8 @@ public class ImageBufferDownloadAlt extends ImageBufferDownload
NPC64 = false;
}
public ImageBufferDownloadAlt(boolean newVersion){
NPC64 = newVersion;
public ImageBufferDownloadAlt(boolean value){
NPC64 = value;
}
@@ -21,7 +21,7 @@ public class RenderCustomNpc extends RenderNPCHumanMale{
private RendererLivingEntity renderEntity;
private EntityLivingBase entity;
private ModelRenderPassHelper renderpass = new ModelRenderPassHelper();
// Default Renderer
@@ -34,6 +34,7 @@ public class RenderCustomNpc extends RenderNPCHumanMale{
// False = Steve Arms
public RenderCustomNpc(boolean arms) {
super(new ModelMPM(0, arms), new ModelMPM(1, arms), new ModelMPM(0.5f, arms));
this.setNewVersion(true);
}
@Override
@@ -35,10 +35,16 @@ import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
public class RenderNPCInterface extends RenderLiving{
public static long LastTextureTick = 0;
private boolean newVersion = false;
public RenderNPCInterface(ModelBase model, float f){
super(model, f);
}
protected void setNewVersion(boolean value){
newVersion = value;
}
protected void renderName(EntityNPCInterface npc, double d, double d1, double d2) {
if (!this.func_110813_b(npc))
return;
@@ -284,6 +290,7 @@ public class RenderNPCInterface extends RenderLiving{
@Override
public ResourceLocation getEntityTexture(Entity entity) {
EntityNPCInterface npc = (EntityNPCInterface) entity;
if(npc.textureLocation == null){
if(npc.display.skinType == 0)
npc.textureLocation = new ResourceLocation(npc.display.texture);
@@ -307,12 +314,7 @@ public class RenderNPCInterface extends RenderLiving{
sb.append(String.format("%02x", b&0xff));
}
npc.textureLocation = new ResourceLocation("skins/" + sb.toString());
if(entity instanceof EntityCustomNpc64){
loadSkin(null, npc.textureLocation, npc.display.url, true);
}
loadSkin(null, npc.textureLocation, npc.display.url, false);
loadSkin(null, npc.textureLocation, npc.display.url, newVersion);
LastTextureTick = 0;
}
catch(Exception ex){
@@ -326,12 +328,9 @@ public class RenderNPCInterface extends RenderLiving{
}
// True = 64x64 Skin
private void loadSkin(File file, ResourceLocation resource, String par1Str, boolean newVersion){
private void loadSkin(File file, ResourceLocation resource, String par1Str, boolean value){
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
ITextureObject object = new ImageDownloadAlt(file, par1Str, SkinManager.field_152793_a, new ImageBufferDownloadAlt());
if(newVersion){
object = new ImageDownloadAlt(file, par1Str, SkinManager.field_152793_a, new ImageBufferDownloadAlt(newVersion));
}
ITextureObject object = new ImageDownloadAlt(file, par1Str, SkinManager.field_152793_a, new ImageBufferDownloadAlt(value));
texturemanager.loadTexture(resource, object);
}