Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper gtnhlib compat #197

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ dependencies {

compileOnly(deobf("optifine:optifine:1.7.10_hd_u_e7"))

compileOnly("com.github.GTNewHorizons:GTNHLib:0.5.19:dev")
compileOnly("com.github.GTNewHorizons:GTNHLib:0.5.20:api")

implementation("org.joml:joml:1.10.5")
implementation("it.unimi.dsi:fastutil:8.5.13")
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/falsepattern/falsetweaks/FalseTweaks.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
guiFactory = Tags.ROOT_PKG + ".config.FalseTweaksGuiFactory",
acceptableRemoteVersions = "*",
dependencies = "required-after:falsepatternlib@[1.4.2,);" +
"after:neodymium@[0.3.2,);"
"after:neodymium@[0.3.2,);" +
"after:gtnhlib@[0.5.20,);"
)
public class FalseTweaks {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,6 @@ private static void pleaseDontBreakMyThreadedRendering() {

@Override
public String[] getASMTransformerClass() {
if (ModuleConfig.THREADED_CHUNK_UPDATES()) {
try {
val f = LaunchClassLoader.class.getDeclaredField("transformerExceptions");
f.setAccessible(true);
@SuppressWarnings("unchecked") val s = (Set<String>) f.get(Launch.classLoader);
s.remove("com.gtnewhorizon.gtnhlib.client.renderer.TessellatorManager");
} catch (Throwable ignored) {
}
}
return new String[]{Tags.ROOT_PKG + ".asm.FalseTweaksTransformer"};
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,6 @@ public enum Mixin implements IMixin {
ThreadedUpdates_Automagy_RenderBlockGlowOverlayMixin(Side.CLIENT,
THREADING.and(require(TargetedMod.AUTOMAGY)),
"threadedupdates.automagy.RenderBlockGlowOverlayMixin"),

// GTNHLib
ThreadedUpdates_GTNHLib_TessellatorManagerMixin(Side.CLIENT,
THREADING.and(require(TargetedMod.GTNHLIB)),
"threadedupdates.gtnhlib.TessellatorManagerMixin"),

//endregion Threaded Chunk Updates

//region Texture Optimizations Module
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public enum TargetedMod implements ITargetedMod {
COMPUTRONICS("Computronics", false, contains("Computronics-")),
EXTRA_CELLS("Extra Cells 2", false, contains("ExtraCells-")),
AUTOMAGY("Automagy", false, contains("Automagy-")),
GTNHLIB("GTNHLib", false, contains("gtnhlib-"))
;

public static Predicate<List<ITargetedMod>> REQUIRE_OPTIFINE_WITHOUT_SHADERS = require(OPTIFINE_WITHOUT_SHADERS).or(require(OPTIFINE_WITH_DYNAMIC_LIGHTS));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.falsepattern.falsetweaks.modules.threadexec.ThreadedTask;
import com.falsepattern.falsetweaks.modules.triangulator.ToggleableTessellatorManager;
import com.google.common.base.Preconditions;
import com.gtnewhorizon.gtnhlib.api.CapturingTesselator;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.FMLCommonHandler;
Expand Down Expand Up @@ -516,6 +517,16 @@ public Tessellator getThreadTessellator() {
}
}

public static class GTNHLibCompat extends ThreadedChunkUpdateHelper {
@Override
public Tessellator getThreadTessellator() {
if (CapturingTesselator.isCapturing()) {
return CapturingTesselator.getThreadTesselator();
}
return super.getThreadTessellator();
}
}

@RequiredArgsConstructor
private static class PendingTaskUpdate {
public final List<WorldRenderer> tasks;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import com.falsepattern.falsetweaks.modules.triangulator.calibration.Calibration;
import com.falsepattern.falsetweaks.modules.voxelizer.loading.LayerMetadataSection;
import com.falsepattern.falsetweaks.modules.voxelizer.loading.LayerMetadataSerializer;
import cpw.mods.fml.common.Loader;
import lombok.val;

import net.minecraft.client.Minecraft;
Expand Down Expand Up @@ -104,7 +105,11 @@ public String call() {
public void init(FMLInitializationEvent e) {
super.init(e);
if (ModuleConfig.THREADED_CHUNK_UPDATES()) {
ThreadedChunkUpdateHelper.instance = new ThreadedChunkUpdateHelper();
if (Loader.isModLoaded("gtnhlib")) {
ThreadedChunkUpdateHelper.instance = new ThreadedChunkUpdateHelper.GTNHLibCompat();
} else {
ThreadedChunkUpdateHelper.instance = new ThreadedChunkUpdateHelper();
}
ThreadedChunkUpdateHelper.instance.init();
}
}
Expand Down