Skip to content

Commit

Permalink
Fix entity PBR
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Dec 15, 2024
1 parent 0d2f166 commit 44730ee
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
import net.irisshaders.iris.mixin.texture.ReloadableTextureAccessor;
import net.irisshaders.iris.pbr.texture.PBRType;
import net.minecraft.client.renderer.texture.AbstractTexture;
import net.minecraft.client.renderer.texture.ReloadableTexture;
import net.minecraft.client.renderer.texture.SimpleTexture;
import net.minecraft.client.renderer.texture.TextureContents;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.resources.ResourceManager;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -31,12 +34,16 @@ protected AbstractTexture createPBRTexture(ResourceLocation imageLocation, Resou
ResourceLocation pbrImageLocation = imageLocation.withPath(pbrType::appendSuffix);

SimpleTexture pbrTexture = new SimpleTexture(pbrImageLocation);
try {
pbrTexture.loadContents(resourceManager);
} catch (IOException e) {
return null;
}
pbrTexture.apply(loadContentsSafe(pbrTexture, resourceManager));

return pbrTexture;
}

private TextureContents loadContentsSafe(ReloadableTexture texture, ResourceManager manager) {
try {
return texture.loadContents(manager);
} catch (Exception var4) {
return TextureContents.createMissing();
}
}
}

0 comments on commit 44730ee

Please sign in to comment.