Skip to content

Commit

Permalink
Fix Indigo too
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Jul 9, 2023
1 parent eda5821 commit 1fc3e76
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
/**
* Small tweak to Indigo to make it obey our separateAo setting.
*/
@Mixin(targets = "net/fabricmc/fabric/impl/client/indigo/renderer/render/AbstractQuadRenderer", remap = false)
@Mixin(targets = "net/fabricmc/fabric/impl/client/indigo/renderer/render/AbstractBlockRenderContext", remap = false)
@Pseudo
public class MixinAbstractQuadRenderer {
public class MixinAbstractBlockRenderContext {
// One of these injections must pass, or else the game will crash.
@Group(name = "iris_separateIndigoAO", min = 2, max = 2)
@Redirect(method = {"tessellateSmooth", "tessellateSmoothEmissive"},
@Redirect(method = {"shadeQuad", "shadeFlatQuad"},
at = @At(value = "INVOKE",
target = "Lnet/fabricmc/fabric/impl/client/indigo/renderer/helper/ColorHelper;multiplyRGB(IF)I"), require = 0)
private int iris$separateAoColorMultiply(int color, float ao) {
Expand All @@ -29,21 +28,6 @@ public class MixinAbstractQuadRenderer {
}
}

@Group(name = "iris_separateIndigoAO", min = 2, max = 2)
@Redirect(method = {"tesselateSmooth", "tesselateSmoothEmissive"},
at = @At(value = "INVOKE",
target = "Lnet/fabricmc/fabric/impl/client/indigo/renderer/helper/ColorHelper;multiplyRGB(IF)I"), require = 0)
private int iris$separateAoColorMultiplyOld(int color, float ao) {
if (BlockRenderingSettings.INSTANCE.shouldUseSeparateAo()) {
color &= 0x00FFFFFF;
color |= ((int) (ao * 255.0f)) << 24;

return color;
} else {
return iris$multiplyRGB(color, ao);
}
}

// Copied from ColorHelper from Indigo, licensed under the Apache v2 license.
private static int iris$multiplyRGB(int color, float shade) {
final int alpha = ((color >> 24) & 0xFF);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/mixins.iris.compat.indigo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"package": "net.coderbot.iris.compat.indigo.mixin",
"compatibilityLevel": "JAVA_8",
"client": [
"MixinAbstractQuadRenderer"
"MixinAbstractBlockRenderContext"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit 1fc3e76

Please sign in to comment.