Fix resource location for mcpatcher/optifine

This commit is contained in:
PeytonPlayz595 2024-04-14 02:33:45 -04:00
parent ab3bf15fec
commit 33347dc322

View File

@ -335,25 +335,7 @@ public class TextureMap extends AbstractTexture implements ITickableTextureObjec
} }
try { try {
boolean isFuckedUp = false; IResource iresource = resourceManager.getResource(resourcelocation1);
ResourceLocation shit = null;
if(resourcelocation1.toString().contains("mcpatcher") || resourcelocation1.toString().contains("optifine")) {
if(resourcelocation1.toString().contains("textures/")) {
String s = resourcelocation1.toString().replace("textures/", "");
shit = new ResourceLocation(s);
isFuckedUp = true;
}
}
IResource iresource;
if(isFuckedUp) {
if(shit != null) { //Just in case
iresource = resourceManager.getResource(shit);
} else {
iresource = resourceManager.getResource(resourcelocation1);
}
} else {
iresource = resourceManager.getResource(resourcelocation1);
}
ImageData[] abufferedimage = new ImageData[1 + this.mipmapLevels]; ImageData[] abufferedimage = new ImageData[1 + this.mipmapLevels];
abufferedimage[0] = TextureUtil.readBufferedImage(iresource.getInputStream()); abufferedimage[0] = TextureUtil.readBufferedImage(iresource.getInputStream());
TextureMetadataSection texturemetadatasection = (TextureMetadataSection) iresource TextureMetadataSection texturemetadatasection = (TextureMetadataSection) iresource
@ -557,12 +539,18 @@ public class TextureMap extends AbstractTexture implements ITickableTextureObjec
_wglBindFramebuffer(_GL_FRAMEBUFFER, null); _wglBindFramebuffer(_GL_FRAMEBUFFER, null);
} }
private ResourceLocation completeResourceLocation(ResourceLocation location, int parInt1) { public ResourceLocation completeResourceLocation(ResourceLocation location, int p_147634_2_) {
return parInt1 == 0 return this.isAbsoluteLocation(location) ? new ResourceLocation(location.getResourceDomain(), location.getResourcePath() + ".png") : (p_147634_2_ == 0 ? new ResourceLocation(location.getResourceDomain(), String.format("%s/%s%s", new Object[] {this.basePath, location.getResourcePath(), ".png"})): new ResourceLocation(location.getResourceDomain(), String.format("%s/mipmaps/%s.%d%s", new Object[] {this.basePath, location.getResourcePath(), Integer.valueOf(p_147634_2_), ".png"})));
? new ResourceLocation(location.getResourceDomain(), }
HString.format("%s/%s%s", new Object[] { this.basePath, location.getResourcePath(), ".png" }))
: new ResourceLocation(location.getResourceDomain(), HString.format("%s/mipmaps/%s.%d%s", private boolean isAbsoluteLocation(ResourceLocation p_isAbsoluteLocation_1_) {
new Object[] { this.basePath, location.getResourcePath(), Integer.valueOf(parInt1), ".png" })); String s = p_isAbsoluteLocation_1_.getResourcePath();
return this.isAbsoluteLocationPath(s);
}
private boolean isAbsoluteLocationPath(String p_isAbsoluteLocationPath_1_) {
String s = p_isAbsoluteLocationPath_1_.toLowerCase();
return s.startsWith("mcpatcher/") || s.startsWith("optifine/");
} }
public EaglerTextureAtlasSprite getAtlasSprite(String iconName) { public EaglerTextureAtlasSprite getAtlasSprite(String iconName) {