Skip to content

Commit

Permalink
Overwrite TextureAtlasSprite#uvShrinkRatio (#2746)
Browse files Browse the repository at this point in the history
Mods, especially on Fabric, typically don't use FaceBakery to create custom quads outside of baked models, but they may still use uvShrinkRatio to manually shrink the UVs.
  • Loading branch information
PepperCode1 authored Sep 13, 2024
1 parent 3c81fa6 commit 31d08b0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package net.caffeinemc.mods.sodium.mixin.core.model;

import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;

@Mixin(TextureAtlasSprite.class)
public class TextureAtlasSpriteMixin {
@Overwrite
public float uvShrinkRatio() {
// Vanilla tries to apply a bias to texture coordinates to avoid texture bleeding (see FaceBakery#bakeQuad).
// This is counterproductive with Sodium's terrain rendering, since the bias is applied in the shader instead.
// Overwrite this method instead of adjusting its return value in FaceBakery as other mods may use it to
// manually apply the bias.
return 0.0f;
}
}
2 changes: 1 addition & 1 deletion common/src/main/resources/sodium.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"core.gui.LevelLoadStatusManagerMixin",
"core.model.colors.BlockColorsMixin",
"core.model.colors.ItemColorsMixin",
"core.model.FaceBakeryMixin",
"core.model.TextureAtlasSpriteMixin",
"core.render.BlockEntityTypeMixin",
"core.render.TextureAtlasMixin",
"core.render.VertexFormatMixin",
Expand Down

0 comments on commit 31d08b0

Please sign in to comment.