Compare commits

...
2 Commits
Author SHA1 Message Date
tiffit 5d1fabfca9 Add API for allowing other mods to have celeritas support (#1936) 2026-07-16 09:54:55 -05:00
tiffit 555b2b7dd2 Fix typo in PR template (#1937) 2026-07-14 00:10:41 -05:00
3 changed files with 24 additions and 4 deletions

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
# Description or your *PR* and other info
# Description of your *PR* and other info
<!-- Please include a summary of the change -->
<!-- Any details that you think are important to review this PR? -->
<!-- Are there any Issues / PRs related to this one? -->
@@ -0,0 +1,9 @@
package com.gtnewhorizons.angelica.api;
public interface ExtCeleritasRenderBlocks {
boolean angelica$shouldApplyCeleritasAO();
void angelica$setApplyingCeleritasAO(boolean val);
}
@@ -1,5 +1,6 @@
package com.gtnewhorizons.angelica.mixins.early.rendering;
import com.gtnewhorizons.angelica.api.ExtCeleritasRenderBlocks;
import com.gtnewhorizons.angelica.common.BlockError;
import com.gtnewhorizons.angelica.loading.AngelicaClientTweaker;
import com.gtnewhorizons.angelica.proxy.ClientProxy;
@@ -33,7 +34,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(RenderBlocks.class)
public abstract class MixinRenderBlocks {
public abstract class MixinRenderBlocks implements ExtCeleritasRenderBlocks {
@Shadow
public abstract boolean renderStandardBlockWithColorMultiplier(Block p_147736_1_, int p_147736_2_, int p_147736_3_, int p_147736_4_, float p_147736_5_, float p_147736_6_, float p_147736_7_);
@@ -109,8 +110,7 @@ public abstract class MixinRenderBlocks {
*/
@Inject(method = { "renderStandardBlockWithAmbientOcclusion", "renderStandardBlockWithAmbientOcclusionPartial" }, at = @At("HEAD"), cancellable = true)
private void handleCeleritasAo(Block block, int x, int y, int z, float r, float g, float b, CallbackInfoReturnable<Boolean> cir) {
if ((this.isRenderingByType && Minecraft.isAmbientOcclusionEnabled() && ClientProxy.options().quality.useCeleritasSmoothLighting) ||
(Iris.enabled && BlockRenderingSettings.INSTANCE.shouldUseSeparateAo())) {
if (angelica$shouldApplyCeleritasAO()) {
this.applyingCeleritasAO = true;
try {
cir.setReturnValue(this.renderStandardBlockWithColorMultiplier(block, x, y, z, r, g, b));
@@ -120,6 +120,17 @@ public abstract class MixinRenderBlocks {
}
}
@Override
public boolean angelica$shouldApplyCeleritasAO() {
return (this.isRenderingByType && Minecraft.isAmbientOcclusionEnabled() && ClientProxy.options().quality.useCeleritasSmoothLighting) ||
(Iris.enabled && BlockRenderingSettings.INSTANCE.shouldUseSeparateAo());
}
@Override
public void angelica$setApplyingCeleritasAO(boolean val) {
this.applyingCeleritasAO = val;
}
/**
* Widen the grass identity check ({@code block != Blocks.grass}) to cover any BlockGrass subclass
* (e.g. BOP's loamy/sandy/silty grass). When the block being rendered IS a BlockGrass, we return