Skip to content

Commit

Permalink
WIP integrate with the gtnhlib api
Browse files Browse the repository at this point in the history
  • Loading branch information
FalsePattern committed Nov 11, 2024
1 parent bcdea82 commit 6234590
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
8 changes: 5 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ repositories {
includeGroup("com.falsepattern")
}
}
exclusive(maven("horizon", "https://mvn.falsepattern.com/horizon"), "com.github.GTNewHorizons")
//TODO
// exclusive(maven("horizon", "https://mvn.falsepattern.com/horizon"), "com.github.GTNewHorizons")
mavenLocal()
exclusive(jitpack(), "com.github.basdxz")
exclusive(maven("mega_uploads", "https://mvn.falsepattern.com/gtmega_uploads"), "optifine")
exclusive(mega(), "codechicken")
Expand All @@ -74,8 +76,8 @@ dependencies {
implementationSplit("com.falsepattern:falsepatternlib-mc1.7.10:1.4.4")

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

compileOnly("com.github.GTNewHorizons:GTNHLib:0.5.19:dev")
//TODO
compileOnly("com.github.GTNewHorizons:GTNHLib:0.5.19-ct-api.4+446e2dc21e:dev")

implementation("org.joml:joml:1.10.5")
implementation("it.unimi.dsi:fastutil:8.5.13")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
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.gtnewhorizon.gtnhlib.client.renderer.TessellatorManager;
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 +518,16 @@ public Tessellator getThreadTessellator() {
}
}

public static class GTNHLibCompat extends ThreadedChunkUpdateHelper {
@Override
public Tessellator getThreadTessellator() {
if (CapturingTesselator.isCapturing()) {
return TessellatorManager.get();
}
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

0 comments on commit 6234590

Please sign in to comment.