Skip to content

Commit 81887b7

Browse files
committed
feat: AOFix LittleTiles patch
Closes: 211
1 parent b02c73b commit 81887b7

File tree

6 files changed

+81
-0
lines changed

6 files changed

+81
-0
lines changed

build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,7 @@ dependencies {
134134
compileOnly(deobfCurse("thermal-foundation-222880:2388752"))
135135
// Thermal Expansion [1.7.10]4.1.5-248
136136
compileOnly(deobfCurse("thermal-expansion-69163:2388758"))
137+
// LittleTiles 1.2.0
138+
compileOnly(deobfCurse("littletiles-257818:2462370"))
139+
// runtimeOnlyNonPublishable(deobfCurse("creativecore-257814:2462369"))
137140
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ public class AOFixConfig {
4343
@Config.RequiresMcRestart
4444
public static boolean universalPatch;
4545

46+
@Config.Comment("Modifies the LittleTiles renderer to use the FalseTweaks AO system")
47+
@Config.LangKey
48+
@Config.DefaultBoolean(true)
49+
@Config.RequiresMcRestart
50+
public static boolean patchLittleTiles;
51+
4652
static {
4753
ConfigurationManager.selfInit();
4854
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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.littletiles;
24+
25+
import com.creativemd.littletiles.client.render.LittleBlockRenderHelper;
26+
import com.creativemd.littletiles.common.tileentity.TileEntityLittleTiles;
27+
import com.creativemd.littletiles.common.utils.LittleTile;
28+
import org.objectweb.asm.Opcodes;
29+
import org.spongepowered.asm.mixin.Mixin;
30+
import org.spongepowered.asm.mixin.injection.At;
31+
import org.spongepowered.asm.mixin.injection.Constant;
32+
import org.spongepowered.asm.mixin.injection.ModifyConstant;
33+
import org.spongepowered.asm.mixin.injection.Redirect;
34+
import org.spongepowered.asm.mixin.injection.Slice;
35+
36+
@Mixin(value = LittleBlockRenderHelper.class,
37+
remap = false)
38+
public abstract class LittleBlockRenderHelperMixin {
39+
@ModifyConstant(method = "renderBlock",
40+
constant = @Constant(intValue = 1,
41+
ordinal = 0),
42+
slice = @Slice(from = @At(value = "INVOKE",
43+
target = "Lnet/minecraft/client/Minecraft;getMinecraft()Lnet/minecraft/client/Minecraft;",
44+
ordinal = 0)),
45+
require = 1)
46+
private static int noNeedThread(int constant) {
47+
return 0;
48+
}
49+
@Redirect(method = "renderBlock",
50+
at = @At(value = "INVOKE",
51+
target = "Lcom/creativemd/littletiles/common/utils/LittleTile;canBlockBeThreaded()Z"),
52+
require = 1)
53+
private static boolean forceNonThreaded(LittleTile instance) {
54+
return false;
55+
}
56+
57+
@Redirect(method = "renderBlock",
58+
at = @At(value = "FIELD",
59+
target = "Lcom/creativemd/littletiles/common/tileentity/TileEntityLittleTiles;needFullRenderUpdate:Z",
60+
opcode = Opcodes.GETFIELD),
61+
require = 1)
62+
private static boolean forceNoNeedThread(TileEntityLittleTiles instance) {
63+
return false;
64+
}
65+
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import static com.falsepattern.falsetweaks.mixin.plugin.standard.TargetMod.ExtraCells;
4646
import static com.falsepattern.falsetweaks.mixin.plugin.standard.TargetMod.FastCraft;
4747
import static com.falsepattern.falsetweaks.mixin.plugin.standard.TargetMod.FoamFix;
48+
import static com.falsepattern.falsetweaks.mixin.plugin.standard.TargetMod.LittleTiles;
4849
import static com.falsepattern.falsetweaks.mixin.plugin.standard.TargetMod.Malisis;
4950
import static com.falsepattern.falsetweaks.mixin.plugin.standard.TargetMod.Malisis_NH;
5051
import static com.falsepattern.falsetweaks.mixin.plugin.standard.TargetMod.NotFine;
@@ -134,6 +135,10 @@ public enum Mixin implements IMixins {
134135
AOFix_Perf(Phase.EARLY,
135136
() -> ModuleConfig.aoFix && !AOFixConfig.renderHookCompatMode,
136137
client("ao.RenderBlocksPerformanceMixin")),
138+
AOFix_LittleTiles(Phase.LATE,
139+
() -> ModuleConfig.aoFix && AOFixConfig.patchLittleTiles,
140+
require(LittleTiles),
141+
client("ao.littletiles.LittleBlockRenderHelperMixin")),
137142

138143
ClippingHelper(Phase.EARLY,
139144
() -> ModuleConfig.CLIPPING_HELPER_OPTS,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public enum TargetMod implements ITargetMod {
5353
Automagy("tuhljin.automagy.Automagy"),
5454
Computronics("pl.asie.computronics.Computronics"),
5555
ExtraCells("extracells.Extracells"),
56+
LittleTiles("com.creativemd.littletiles.LittleTiles"),
5657
NuclearControl("shedar.mods.ic2.nuclearcontrol.IC2NuclearControl"),
5758
RailCraft("mods.railcraft.common.core.Railcraft"),
5859
RedstonePaste("fyber.redstonepastemod.RedstonePasteMod"),

src/main/resources/assets/falsetweaks/lang/en_US.lang

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ config.falsetweaks.ao_fix=Ambient Occlusion Fix
3838
config.falsetweaks.ao_fix.tooltip=Improves ambient occlusion and smooth lighting on blocks.
3939
config.falsetweaks.ao_fix.renderHookCompatMode=Render hook compatibility mode
4040
config.falsetweaks.ao_fix.universalPatch=Universal patch
41+
config.falsetweaks.ao_fix.patchLittleTiles=Patch LittleTiles
4142

4243
config.falsetweaks.crack_fix=Block Crack Fix
4344
config.falsetweaks.crack_fix.tooltip=Block corners and edges between chunks might have "cracks" in them. This option fixes it.

0 commit comments

Comments
 (0)