Skip to content

Commit 681eadb

Browse files
committed
feat(aofix): Better stair ambient occlusion
1 parent 6b98055 commit 681eadb

6 files changed

Lines changed: 241 additions & 69 deletions

File tree

src/main/java/com/falsepattern/falsetweaks/config/AOFixConfig.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ public class AOFixConfig {
4949
@Config.RequiresMcRestart
5050
public static boolean patchLittleTiles;
5151

52+
@Config.Comment({
53+
"Stairs and slabs need additional AO workarounds to look good.",
54+
"You can toggle these fixes here (requires f3+a world renderer refresh to see the changes)"
55+
})
56+
@Config.LangKey
57+
@Config.DefaultBoolean(true)
58+
public static boolean stairAOFix;
59+
5260
static {
5361
ConfigurationManager.selfInit();
5462
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* This file is part of FalseTweaks.
3+
*
4+
* Copyright (C) 2022-2025 FalsePattern
5+
* All Rights Reserved
6+
*
7+
* The above copyright notice and this permission notice shall be included
8+
* in all copies or substantial portions of the Software.
9+
*
10+
* FalseTweaks is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU Lesser General Public License as published by
12+
* the Free Software Foundation, only version 3 of the License.
13+
*
14+
* FalseTweaks is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public License
20+
* along with FalseTweaks. If not, see <https://www.gnu.org/licenses/>.
21+
*/
22+
23+
package com.falsepattern.falsetweaks.mixin.mixins.client.ao;
24+
25+
import com.falsepattern.falsetweaks.modules.ao.AOChunkCache;
26+
import org.spongepowered.asm.mixin.Mixin;
27+
import org.spongepowered.asm.mixin.Unique;
28+
import org.spongepowered.asm.mixin.injection.At;
29+
import org.spongepowered.asm.mixin.injection.Redirect;
30+
31+
import net.minecraft.block.Block;
32+
import net.minecraft.world.ChunkCache;
33+
34+
@Mixin(ChunkCache.class)
35+
public abstract class ChunkCacheMixin implements AOChunkCache {
36+
@Unique
37+
private boolean ft$useNeighborBrightness = true;
38+
@Override
39+
public void ft$setUseNeighborBrightness(boolean value) {
40+
ft$useNeighborBrightness = value;
41+
}
42+
43+
@Redirect(method = "getSkyBlockTypeBrightness",
44+
at = @At(value = "INVOKE",
45+
target = "Lnet/minecraft/block/Block;getUseNeighborBrightness()Z"),
46+
require = 1)
47+
private boolean bypassUseNeighborBrightness(Block instance) {
48+
return ft$useNeighborBrightness && instance.getUseNeighborBrightness();
49+
}
50+
}

src/main/java/com/falsepattern/falsetweaks/mixin/plugin/standard/Mixin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ public enum Mixin implements IMixins {
141141

142142
AOFix_Universal(Phase.EARLY,
143143
() -> ModuleConfig.aoFix && AOFixConfig.universalPatch,
144-
client("ao.RenderBlocksUniversalMixin")),
144+
client("ao.RenderBlocksUniversalMixin",
145+
"ao.ChunkCacheMixin")),
145146
AOFix_Compat(Phase.EARLY,
146147
() -> ModuleConfig.aoFix && AOFixConfig.renderHookCompatMode,
147148
client("ao.RenderBlocksCompatMixin")),
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* This file is part of FalseTweaks.
3+
*
4+
* Copyright (C) 2022-2025 FalsePattern
5+
* All Rights Reserved
6+
*
7+
* The above copyright notice and this permission notice shall be included
8+
* in all copies or substantial portions of the Software.
9+
*
10+
* FalseTweaks is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU Lesser General Public License as published by
12+
* the Free Software Foundation, only version 3 of the License.
13+
*
14+
* FalseTweaks is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public License
20+
* along with FalseTweaks. If not, see <https://www.gnu.org/licenses/>.
21+
*/
22+
23+
package com.falsepattern.falsetweaks.modules.ao;
24+
25+
public interface AOChunkCache {
26+
void ft$setUseNeighborBrightness(boolean value);
27+
}

0 commit comments

Comments
 (0)