Fix several crashes

This commit is contained in:
PeytonPlayz595 2024-09-24 18:53:09 -07:00
parent 64f00f82df
commit dc6aaa125e
2 changed files with 28 additions and 56 deletions

View File

@ -164,7 +164,7 @@ public class Minecraft implements Runnable {
ColorizerFoliage.func_28152_a(this.renderEngine.func_28149_a("/misc/foliagecolor.png")); ColorizerFoliage.func_28152_a(this.renderEngine.func_28149_a("/misc/foliagecolor.png"));
this.entityRenderer = new EntityRenderer(this); this.entityRenderer = new EntityRenderer(this);
RenderManager.instance.itemRenderer = new ItemRenderer(this); RenderManager.instance.itemRenderer = new ItemRenderer(this);
this.statFileWriter = new StatFileWriter(this.session, minecraftDir + "/statsNew"); this.statFileWriter = new StatFileWriter(this.session, minecraftDir + "/misc");
AchievementList.openInventory.setStatStringFormatter(new StatStringFormatKeyInv(this)); AchievementList.openInventory.setStatStringFormatter(new StatStringFormatKeyInv(this));
this.loadScreen(); this.loadScreen();
this.mouseHelper = new MouseHelper(); this.mouseHelper = new MouseHelper();

View File

@ -14,6 +14,7 @@ import java.util.Map;
import net.PeytonPlayz585.awt.image.BufferedImage; import net.PeytonPlayz585.awt.image.BufferedImage;
import net.PeytonPlayz585.opengl.GL11; import net.PeytonPlayz585.opengl.GL11;
import net.PeytonPlayz585.profile.Profile; import net.PeytonPlayz585.profile.Profile;
import net.PeytonPlayz585.textures.TextureLocation;
import net.lax1dude.eaglercraft.SpriteSheetTexture; import net.lax1dude.eaglercraft.SpriteSheetTexture;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -137,8 +138,8 @@ public class RenderEngine {
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10240 /* GL_TEXTURE_MAG_FILTER */, 9729 /* GL_LINEAR */); GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10240 /* GL_TEXTURE_MAG_FILTER */, 9729 /* GL_LINEAR */);
} }
if (clampTexture) { if (clampTexture) {
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10242 /* GL_TEXTURE_WRAP_S */, 10496 /* GL_CLAMP */); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10243 /* GL_TEXTURE_WRAP_T */, 10496 /* GL_CLAMP */); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);
} else { } else {
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10242 /* GL_TEXTURE_WRAP_S */, 10497 /* GL_REPEAT */); GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10242 /* GL_TEXTURE_WRAP_S */, 10497 /* GL_REPEAT */);
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10243 /* GL_TEXTURE_WRAP_T */, 10497 /* GL_REPEAT */); GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10243 /* GL_TEXTURE_WRAP_T */, 10497 /* GL_REPEAT */);
@ -348,64 +349,35 @@ public class RenderEngine {
} }
public void refreshTextures() { public void refreshTextures() {
TextureLocation.freeTextures();
TexturePackBase var1 = this.texturePack.selectedTexturePack; TexturePackBase var1 = this.texturePack.selectedTexturePack;
Iterator var2 = this.textureNameToImageMap.keySet().iterator(); int i;
BufferedImage bufferedimage;
BufferedImage var4; for (Iterator iterator = textureNameToImageMap.keySet().iterator(); iterator
while(var2.hasNext()) { .hasNext(); setupTexture(bufferedimage, i)) {
int var3 = ((Integer)var2.next()).intValue(); i = ((Integer) iterator.next()).intValue();
var4 = (BufferedImage)this.textureNameToImageMap.get(Integer.valueOf(var3)); bufferedimage = (BufferedImage) textureNameToImageMap.get(Integer.valueOf(i));
this.setupTexture(var4, var3);
} }
var2 = this.textureMap.keySet().iterator(); for (Iterator iterator2 = textureMap.keySet().iterator(); iterator2.hasNext();) {
String s = (String) iterator2.next();
String var9;
while(var2.hasNext()) {
var9 = (String)var2.next();
try { try {
if(var9.startsWith("%clamp%")) { BufferedImage bufferedimage1;
this.clampTexture = true; if (s.startsWith("%clamp%")) {
var4 = this.readTextureImage(var1.getResourceAsStream(var9.substring(7))); clampTexture = true;
} else if(var9.startsWith("%blur%")) { bufferedimage1 = readTextureImage(var1.getResourceAsStream(s.substring(7)));
this.blurTexture = true; } else if (s.startsWith("%blur%")) {
var4 = this.readTextureImage(var1.getResourceAsStream(var9.substring(6))); blurTexture = true;
bufferedimage1 = readTextureImage(var1.getResourceAsStream(s.substring(6)));
} else { } else {
var4 = this.readTextureImage(var1.getResourceAsStream(var9)); bufferedimage1 = readTextureImage(var1.getResourceAsStream(s));
} }
int j = ((Integer) textureMap.get(s)).intValue();
int var5 = ((Integer)this.textureMap.get(var9)).intValue(); setupTexture(bufferedimage1, j);
this.setupTexture(var4, var5); blurTexture = false;
this.blurTexture = false; clampTexture = false;
this.clampTexture = false; } catch (IOException ioexception) {
} catch (IOException var7) { ioexception.printStackTrace();
var7.printStackTrace();
}
}
var2 = this.field_28151_c.keySet().iterator();
while(var2.hasNext()) {
var9 = (String)var2.next();
try {
if(var9.startsWith("%clamp%")) {
this.clampTexture = true;
var4 = this.readTextureImage(var1.getResourceAsStream(var9.substring(7)));
} else if(var9.startsWith("%blur%")) {
this.blurTexture = true;
var4 = this.readTextureImage(var1.getResourceAsStream(var9.substring(6)));
} else {
var4 = this.readTextureImage(var1.getResourceAsStream(var9));
}
int j = ((Integer) textureMap.get(var9)).intValue();
setupTexture(var4, j);
this.blurTexture = false;
this.clampTexture = false;
} catch (IOException var6) {
var6.printStackTrace();
} }
} }