More AO Fixes (#578)

* Only use sodium AO for standard blocks and disable flat pipeline optimization

* Option for sodium smooth lighting. Currently default to true

* Remove tessellator ignore from renderQuadList

* Add back cull and sodium lighting check in renderQuadList

* Disable sodium AO by default

* fix culling

---------

Co-authored-by: Caedis <[email protected]>
This commit is contained in:
Darren EberlyandCaedis authored and GitHub committed 2024-08-02 23:51:30 +07:00
1 parent e33f2ff7e3
commit 1315d8971a
5 files changed
+45 -8

No files matched your search

@@ -1,14 +1,40 @@
package com.gtnewhorizons.angelica.mixins.early.sodium;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import me.jellysquid.mods.sodium.client.SodiumClientMod;
import net.coderbot.iris.block_rendering.BlockRenderingSettings;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderBlocks;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(RenderBlocks.class)
public abstract class MixinRenderBlocks {
@Unique
private boolean isRenderingByType = false;
@Inject(method = "renderBlockByRenderType", at = @At("HEAD"))
private void renderingByTypeEnable(CallbackInfoReturnable<Boolean> ci) {
this.isRenderingByType = true;
}
@Inject(method = "renderBlockByRenderType", at = @At("TAIL"))
private void renderingByTypeDisable(CallbackInfoReturnable<Boolean> ci) {
this.isRenderingByType = false;
}
@Redirect(method = "renderStandardBlock", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;isAmbientOcclusionEnabled()Z"))
private boolean checkAOEnabled() {
return false;
if ((this.isRenderingByType && Minecraft.isAmbientOcclusionEnabled() && SodiumClientMod.options().quality.useSodiumAO) ||
(AngelicaConfig.enableIris && BlockRenderingSettings.INSTANCE.shouldUseSeparateAo())) {
return false; // Force sodium pipeline with Iris or for standard blocks rendered from renderBlockByRenderType when using AO
}
return Minecraft.isAmbientOcclusionEnabled();
}
}