Skip to content

Commit e82936e

Browse files
committed
feat!: Shatter triangulator
- VertexAPI, AOFix, Block crack fix are now separate modules - Threaded rendering no longer depends on triangulator - BSP sorting no longer depends on triangulator - Tessellator render pass state tracking no longer depends on triangulator
1 parent b90d097 commit e82936e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1742
-1128
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ dependencies {
8787
compileOnly("com.ventooth:swansong-mc1.7.10:1.0.0:dev")
8888
compileOnly("maven.modrinth:etfuturum:2.6.2:dev")
8989

90-
val beddiumVersion = "1.0.0"
90+
val beddiumVersion = "1.0.4"
9191
val beddiumVersionJ21 = "$beddiumVersion-j21"
9292
val beddiumVersionJ8 = "$beddiumVersion-j8"
9393
compileOnly("com.ventooth:beddium-mc1.7.10:$beddiumVersionJ8:dev")

src/main/java/com/falsepattern/falsetweaks/api/Modules.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static boolean itemVoxelizerActive() {
4646

4747
@StableAPI.Expose
4848
public static boolean triangulatorActive() {
49-
return ModuleConfig.TRIANGULATOR();
49+
return ModuleConfig.TRIANGULATOR;
5050
}
5151

5252
@StableAPI.Expose
@@ -76,7 +76,7 @@ public static boolean threadingActive() {
7676

7777
@StableAPI.Expose
7878
public static boolean bspSortingActive() {
79-
return ModuleConfig.BSP_SORTING();
79+
return ModuleConfig.BSP_SORTING;
8080
}
8181

8282
@StableAPI.Expose
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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.api;
24+
25+
import cpw.mods.fml.relauncher.Side;
26+
import cpw.mods.fml.relauncher.SideOnly;
27+
28+
/**
29+
* @since 4.1.0
30+
*/
31+
@SideOnly(Side.CLIENT)
32+
public interface PassTrackingTessellator {
33+
/**
34+
* Utility for keeping track of current render pass.
35+
*/
36+
void pass(int pass);
37+
38+
/**
39+
* Utility for keeping track of current render pass.
40+
*/
41+
int pass();
42+
}

src/main/java/com/falsepattern/falsetweaks/api/triangulator/ToggleableTessellator.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@
2222

2323
package com.falsepattern.falsetweaks.api.triangulator;
2424

25+
import com.falsepattern.falsetweaks.api.PassTrackingTessellator;
2526
import com.falsepattern.lib.StableAPI;
2627

2728
import cpw.mods.fml.relauncher.Side;
2829
import cpw.mods.fml.relauncher.SideOnly;
2930

3031
@SideOnly(Side.CLIENT)
3132
@StableAPI(since = "2.0.0")
32-
public interface ToggleableTessellator {
33+
public interface ToggleableTessellator extends PassTrackingTessellator {
3334
/**
3435
* Temporarily disables triangulation mode <em>when already rendering</em>. This is useful for rendering triangle-based meshes
3536
* into the chunk, which is quad based.
@@ -73,16 +74,10 @@ public interface ToggleableTessellator {
7374
@StableAPI.Expose
7475
void enableTriangulatorLocal();
7576

76-
/**
77-
* Utility for keeping track of current render pass.
78-
*/
79-
@StableAPI.Expose
77+
@Override
8078
void pass(int pass);
8179

82-
/**
83-
* Utility for keeping track of current render pass.
84-
*/
85-
@StableAPI.Expose
80+
@Override
8681
int pass();
8782

8883
@StableAPI.Expose

src/main/java/com/falsepattern/falsetweaks/api/triangulator/VertexAPI.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
package com.falsepattern.falsetweaks.api.triangulator;
2424

25-
import com.falsepattern.falsetweaks.modules.triangulator.VertexInfo;
25+
import com.falsepattern.falsetweaks.modules.vertexapi.VertexInfo;
2626
import com.falsepattern.lib.StableAPI;
2727

2828
/**
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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.config;
24+
25+
import com.falsepattern.falsetweaks.Tags;
26+
import com.falsepattern.lib.config.Config;
27+
import com.falsepattern.lib.config.ConfigurationManager;
28+
29+
@Config.Comment("")
30+
@Config(modid = Tags.MOD_ID,
31+
category = "ao_fix")
32+
@Config.LangKey
33+
public class AOFixConfig {
34+
@Config.Comment({"Try setting this to true if the game crashes with a mixin conflict inside RenderBlocks."})
35+
@Config.LangKey
36+
@Config.DefaultBoolean(false)
37+
@Config.RequiresMcRestart
38+
public static boolean renderHookCompatMode;
39+
40+
@Config.Comment({"Disable this if some modded blocks have weird smooth lighting."})
41+
@Config.LangKey
42+
@Config.DefaultBoolean(true)
43+
@Config.RequiresMcRestart
44+
public static boolean universalPatch;
45+
46+
static {
47+
ConfigurationManager.selfInit();
48+
}
49+
50+
//This is here to make the static initializer run
51+
public static void init() {
52+
53+
}
54+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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.config;
24+
25+
import com.falsepattern.falsetweaks.Tags;
26+
import com.falsepattern.lib.config.Config;
27+
import com.falsepattern.lib.config.ConfigurationManager;
28+
29+
@Config.Comment("Block crack fix configuration")
30+
@Config(modid = Tags.MOD_ID,
31+
category = "crack_fix")
32+
@Config.LangKey
33+
public class CrackFixConfig {
34+
@Config.Comment({"The \"epsilon\" value for the block crack fix inside chunks." +
35+
"Set this a bit higher if you can still see light leaking" +
36+
"between solid blocks in dark areas.",
37+
"Advanced setting.",
38+
"FPS impact: None"})
39+
@Config.LangKey
40+
@Config.RangeDouble(min = 0,
41+
max = 0.005)
42+
@Config.DefaultDouble(0.0005)
43+
public static double epsilon;
44+
45+
@Config.Comment("Block classes that have bugs when rendering with the crack fix can be put here to avoid manipulating them.")
46+
@Config.LangKey
47+
@Config.DefaultStringList({"net.minecraft.block.BlockCauldron", "net.minecraft.block.BlockStairs"})
48+
public static String[] blacklist;
49+
50+
static {
51+
ConfigurationManager.selfInit();
52+
}
53+
54+
//This is here to make the static initializer run
55+
public static void init() {
56+
57+
}
58+
}

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

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,35 +40,41 @@ public FalseTweaksGuiConfig(GuiScreen parent) throws ConfigException {
4040
private static Class<?>[] getConfigClasses() {
4141
val result = new ArrayList<Class<?>>();
4242
result.add(ModuleConfig.class);
43-
if (Compat.dynamicLightsPresent()) {
44-
result.add(DynamicLightsConfig.class);
43+
if (ModuleConfig.aoFix) {
44+
result.add(AOFixConfig.class);
4545
}
46-
if (ModuleConfig.TRIANGULATOR()) {
47-
result.add(TriangulatorConfig.class);
46+
if (ModuleConfig.blockCrackFix) {
47+
result.add(CrackFixConfig.class);
4848
}
49-
if (ModuleConfig.ITEM_RENDER_LISTS) {
50-
result.add(RenderListConfig.class);
49+
if (Compat.dynamicLightsPresent()) {
50+
result.add(DynamicLightsConfig.class);
5151
}
52-
if (ModuleConfig.VOXELIZER) {
53-
result.add(VoxelizerConfig.class);
52+
if (ModuleConfig.OPTIFINE_LOGSPAM_FIX && Compat.optiFineHasShaders()) {
53+
result.add(OptiSpamConfig.class);
5454
}
5555
if (ModuleConfig.ADVANCED_PROFILER) {
5656
result.add(ProfilerConfig.class);
5757
}
58-
if (ModuleConfig.BLOCK_LAYER_TRANSPARENCY_FIX) {
59-
result.add(TranslucentBlockLayersConfig.class);
60-
}
6158
if (ModuleConfig.UNLOCK_RENDER_DISTANCE) {
6259
result.add(RenderDistanceConfig.class);
6360
}
61+
if (ModuleConfig.RENDERING_SAFETY) {
62+
result.add(RenderingSafetyConfig.class);
63+
}
64+
if (ModuleConfig.ITEM_RENDER_LISTS) {
65+
result.add(RenderListConfig.class);
66+
}
6467
if (ModuleConfig.THREADED_CHUNK_UPDATES()) {
6568
result.add(ThreadingConfig.class);
6669
}
67-
if (ModuleConfig.RENDERING_SAFETY) {
68-
result.add(RenderingSafetyConfig.class);
70+
if (ModuleConfig.BLOCK_LAYER_TRANSPARENCY_FIX) {
71+
result.add(TranslucentBlockLayersConfig.class);
6972
}
70-
if (ModuleConfig.OPTIFINE_LOGSPAM_FIX && Compat.optiFineHasShaders()) {
71-
result.add(OptiSpamConfig.class);
73+
if (ModuleConfig.TRIANGULATOR) {
74+
result.add(TriangulatorConfig.class);
75+
}
76+
if (ModuleConfig.VOXELIZER) {
77+
result.add(VoxelizerConfig.class);
7278
}
7379
return result.toArray(new Class<?>[0]);
7480
}

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

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,8 @@ public class ModuleConfig {
6363
public static boolean VOXELIZER;
6464

6565
@Config.Comment({
66-
"Enables the Triangulator module. This also includes the ambient occlusion and smooth lighting fix,",
67-
"along with the block crack fix. Also provides the VertexAPI used by the BSP sorter and the threading system.",
68-
"If you want to use those fixes without having triangulated meshes, set the ENABLE_QUAD_TRIANGULATION",
69-
"property to false in the triangulator category.",
70-
"Force-enabled if bspSorting is enabled.",
71-
"FPS impact: Tiny performance decrease, but smooth lighting will look way better."})
66+
"Enables the Triangulator module, which fixes the smooth lighting along block diagonals.",
67+
"FPS impact: Minimal."})
7268
@Config.LangKey("config.falsetweaks.triangulator")
7369
@Config.Name(value = "triangulator",
7470
migrations = "")
@@ -77,7 +73,6 @@ public class ModuleConfig {
7773
public static boolean TRIANGULATOR;
7874

7975
@Config.Comment({"Enable an optimized, BSP-tree based vertex sorting algorithm for transparent blocks.",
80-
"Force-enables TRIANGULATOR.",
8176
"FPS impact: A little bit less stuttering when moving around with a lot of stained glass-like blocks around"})
8277
@Config.LangKey
8378
@Config.Name(value = "bspSorting",
@@ -291,6 +286,23 @@ public class ModuleConfig {
291286
@Config.RequiresMcRestart
292287
public static boolean FAST_ITEM_ENTITY_PHYSICS;
293288

289+
290+
@Config.Comment({"Block corners and edges between chunks might have \"cracks\" in them. This option fixes it.",
291+
"FPS impact: None"})
292+
@Config.LangKey("config.falsetweaks.crack_fix")
293+
@Config.Name(value = "blockCrackFix",
294+
migrations = "")
295+
@Config.DefaultBoolean(true)
296+
@Config.RequiresMcRestart
297+
public static boolean blockCrackFix;
298+
299+
@Config.Comment({"Improves ambient occlusion and smooth lighting on blocks.",
300+
"FPS impact: None"})
301+
@Config.LangKey("config.falsetweaks.ao_fix")
302+
@Config.DefaultBoolean(true)
303+
@Config.RequiresMcRestart
304+
public static boolean aoFix;
305+
294306
static {
295307
ConfigurationManager.selfInit();
296308
ProfilerConfig.init();
@@ -303,20 +315,14 @@ public class ModuleConfig {
303315
DynamicLightsConfig.init();
304316
RenderingSafetyConfig.init();
305317
OptiSpamConfig.init();
306-
}
307-
308-
public static boolean TRIANGULATOR() {
309-
return TRIANGULATOR || BSP_SORTING();
318+
CrackFixConfig.init();
319+
AOFixConfig.init();
310320
}
311321

312322
public static boolean THREADED_CHUNK_UPDATES() {
313323
return Compat.beddiumInstalled() && THREADED_CHUNK_UPDATES;
314324
}
315325

316-
public static boolean BSP_SORTING() {
317-
return BSP_SORTING || THREADED_CHUNK_UPDATES();
318-
}
319-
320326
//This is here to make the static initializer run
321327
public static void init() {
322328

0 commit comments

Comments
 (0)