Fixed x64 texture bug, breaking textures after switching the model type from x64 to x32

Fixed crash report handler issue with custom overlays.

Removed "textureGlowLocation" field, which is unused now.
This commit is contained in:
Luis C.M committed 2022-05-28 02:12:33 -05:00
1 parent 76802d1926
commit 2b15ba9197
9 files changed
+36 -23

No files matched your search

@@ -22,6 +22,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.boss.BossStatus;
import net.minecraft.util.ReportedException;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.client.ImageDownloadAlt;
import noppes.npcs.client.model.ModelMPM;
@@ -221,6 +222,9 @@ public class RenderNPCInterface extends RenderLiving{
if (!npc.display.skinOverlayData.overlayList.isEmpty()) {
for (ISkinOverlay overlayData : npc.display.skinOverlayData.overlayList.values()) {
try {
if (overlayData.getTexture().isEmpty())
continue;
if (overlayData.getLocation() == null) {
overlayData.setLocation(new ResourceLocation(overlayData.getTexture()));
} else {
@@ -230,7 +234,12 @@ public class RenderNPCInterface extends RenderLiving{
}
}
this.bindTexture(overlayData.getLocation());
if (overlayData.getLocation().getResourcePath().isEmpty())
continue;
try {
this.bindTexture(overlayData.getLocation());
} catch (Exception e) { continue; }
// Overlay & Glow
GL11.glEnable(GL11.GL_BLEND);
@@ -340,13 +349,12 @@ public class RenderNPCInterface extends RenderLiving{
}
private ResourceLocation adjustLocalTexture(EntityNPCInterface npc, ResourceLocation location) throws IOException {
if (npc.display.modelType != 0) {
return location;
}
InputStream inputstream = null;
try {
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
texturemanager.deleteTexture(location);
IResource iresource = Minecraft.getMinecraft().getResourceManager().getResource(location);
inputstream = iresource.getInputStream();
@@ -355,15 +363,14 @@ public class RenderNPCInterface extends RenderLiving{
int totalWidth = bufferedimage.getWidth();
int totalHeight = bufferedimage.getHeight();
if (totalHeight > 32) {
if (totalHeight > 32 && npc.display.modelType == 0) {
bufferedimage = bufferedimage.getSubimage(0, 0, totalWidth, 32);
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
ImageDownloadAlt object = new ImageDownloadAlt(null, npc.display.texture, SkinManager.field_152793_a, new ImageBufferDownloadAlt(false));
object.setBufferedImage(bufferedimage);
texturemanager.loadTexture(location, object);
}
ImageDownloadAlt object = new ImageDownloadAlt(null, npc.display.texture, SkinManager.field_152793_a, new ImageBufferDownloadAlt(false));
object.setBufferedImage(bufferedimage);
texturemanager.loadTexture(location, object);
return location;
} finally {
if (inputstream != null) {