Skip to content

Commit

Permalink
Enable block atlas mipmaps in composite (fixes #2501)
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Nov 24, 2024
1 parent bd8b68a commit 9899fb9
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.irisshaders.iris.mixin.LightTextureAccessor;
import net.irisshaders.iris.pbr.format.TextureFormat;
import net.irisshaders.iris.pbr.format.TextureFormatLoader;
import net.irisshaders.iris.pbr.texture.PBRAtlasTexture;
import net.irisshaders.iris.pbr.texture.PBRTextureHolder;
import net.irisshaders.iris.pbr.texture.PBRTextureManager;
import net.irisshaders.iris.pbr.texture.PBRType;
Expand All @@ -25,6 +26,7 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.AbstractTexture;
import net.minecraft.client.renderer.texture.MissingTextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.resources.ResourceLocation;
import org.apache.commons.io.FilenameUtils;
Expand Down Expand Up @@ -145,6 +147,9 @@ private TextureAccess createCustomTexture(CustomTextureData textureData) throws
// now.
return new TextureWrapper(() -> {
AbstractTexture texture = textureManager.getTexture(textureLocation);
if (texture instanceof TextureAtlas || texture instanceof PBRAtlasTexture) {
texture.setFilter(false, Minecraft.getInstance().options.mipmapLevels().get() > 0);
}
return texture != null ? texture.getId() : MissingTextureAtlasSprite.getTexture().getId();
}, TextureType.TEXTURE_2D);
} else {
Expand All @@ -155,6 +160,9 @@ private TextureAccess createCustomTexture(CustomTextureData textureData) throws
AbstractTexture texture = textureManager.getTexture(textureLocation);

if (texture != null) {
if (texture instanceof TextureAtlas || texture instanceof PBRAtlasTexture) {
texture.setFilter(false, Minecraft.getInstance().options.mipmapLevels().get() > 0);
}
int id = texture.getId();
PBRTextureHolder pbrHolder = PBRTextureManager.INSTANCE.getOrLoadHolder(id);
AbstractTexture pbrTexture = switch (pbrType) {
Expand Down

0 comments on commit 9899fb9

Please sign in to comment.