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

@@ -184,7 +184,6 @@ public class DataDisplay {
if(prevSkinType != skinType || !texture.equals(prevTexture))
npc.textureLocation = null;
npc.textureGlowLocation = null;
npc.textureCloakLocation = null;
npc.updateHitbox();
}
@@ -90,7 +90,6 @@ public class EntityUtil {
EntityNPCInterface target = (EntityNPCInterface) entity;
target.textureLocation = npc.textureLocation;
target.textureGlowLocation = npc.textureGlowLocation;
target.textureCloakLocation = npc.textureCloakLocation;
target.display = npc.display;
target.inventory = npc.inventory;
@@ -77,7 +77,7 @@ public class GuiNpcTextureOverlays extends GuiNpcSelectionInterface{
public void elementClicked(){
if(dataTextures.contains(slot.selected) && slot.selected != null){
//npc.display.glowTexture = assets.getAsset(slot.selected);
npc.textureGlowLocation = null;
//npc.textureGlowLocation = null;
npc.display.skinOverlayData.overlayList.put(0,new SkinOverlay(
assets.getAsset(slot.selected), true, 1.0F, 1.0F, 0.0F, 0.0F,
@@ -129,12 +129,14 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
display.cloakTexture = textfield.getText();
}
else if(textfield.id == 9){
npc.textureGlowLocation = null;
//npc.textureGlowLocation = null;
//display.glowTexture = textfield.getText();
npc.display.skinOverlayData.overlayList.put(0,new SkinOverlay(
textfield.getText(), true, 1.0F, 1.0F, 0.0F, 0.0F,
1.0F, 1.0F, 0.0F, 0.0F, 0.0F
));
if (!textfield.getText().isEmpty()) {
npc.display.skinOverlayData.overlayList.put(0, new SkinOverlay(
textfield.getText(), true, 1.0F, 1.0F, 0.0F, 0.0F,
1.0F, 1.0F, 0.0F, 0.0F, 0.0F
));
}
}
else if(textfield.id == 11){
display.title = textfield.getText();
@@ -231,7 +231,6 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
//npc.display.glowTexture = "";
npc.display.skinOverlayData.overlayList.remove(0);
npc.textureLocation = null;
npc.textureGlowLocation = null;
npc.updateHitbox();
}
catch(Exception ex){
@@ -286,6 +285,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
}
npc.display.modelType = 0;
}
npc.textureLocation = null;
}
if(button.id == 8){
@@ -339,7 +339,6 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
//npc.display.glowTexture = "";
npc.display.skinOverlayData.overlayList.remove(0);
npc.textureLocation = null;
npc.textureGlowLocation = null;
npc.updateHitbox();
}
catch(Exception ex){
@@ -129,7 +129,6 @@ public class GuiEntitySelection extends GuiNPCInterface
//npc.display.glowTexture = "";
npc.display.skinOverlayData.overlayList.remove(0);
npc.textureLocation = null;
npc.textureGlowLocation = null;
npc.updateHitbox();
}
catch(Exception ex){
@@ -48,6 +48,9 @@ public class RenderCNPCPlayer extends RenderPlayer {
private boolean preRenderOverlay(EntityPlayer player, ResourceLocation overlayLocation, boolean glow,
float alpha, float size, float speedX, float speedY, float scaleX, float scaleY,
float offsetX, float offsetY, float offsetZ) {
if (overlayLocation.getResourcePath().isEmpty())
return false;
try {
this.bindTexture(overlayLocation);
} catch (Exception exception) {
@@ -112,6 +115,9 @@ public class RenderCNPCPlayer extends RenderPlayer {
{
if (Client.skinOverlays.containsKey(player.getUniqueID())) {
for (SkinOverlay overlayData : Client.skinOverlays.get(player.getUniqueID()).values()) {
if (overlayData.texture.isEmpty())
continue;
if (overlayData.location == null) {
overlayData.location = new ResourceLocation(overlayData.texture);
} else {
@@ -312,6 +318,9 @@ public class RenderCNPCPlayer extends RenderPlayer {
if (Client.skinOverlays.containsKey(player.getUniqueID())) {
for (SkinOverlay overlayData : Client.skinOverlays.get(player.getUniqueID()).values()) {
if (overlayData.texture.isEmpty())
continue;
if (overlayData.location == null) {
overlayData.location = new ResourceLocation(overlayData.texture);
} else {
@@ -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) {
@@ -128,7 +128,6 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
public List<EntityLivingBase> interactingEntities = new ArrayList<EntityLivingBase>();
public ResourceLocation textureLocation = null;
public ResourceLocation textureGlowLocation = null;
public ResourceLocation textureCloakLocation = null;
public EnumAnimation currentAnimation = EnumAnimation.NONE;