Skip to content

Commit

Permalink
Add API for finding current capturing state
Browse files Browse the repository at this point in the history
  • Loading branch information
ah-OOG-ah committed Nov 11, 2024
1 parent bb1602f commit edd48e3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ replaceGradleTokenInFile =
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
apiPackage =
apiPackage = api

# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# There can be multiple files in a space-separated list.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.gtnewhorizon.gtnhlib.api;

import com.gtnewhorizon.gtnhlib.client.renderer.TessellatorManager;

public class CapturingTesselator {

public static boolean isCapturing() {
return TessellatorManager.isCurrentlyCapturing();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public static Tessellator get() {
}
}

public static boolean isCurrentlyCapturing() {
return currentlyCapturing.get();
}

public static boolean isOnMainThread() {
return Thread.currentThread() == mainThread;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/gtnewhorizon/gtnhlib/mixins/Mixins.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

public enum Mixins {

TESSELLATOR(new Builder("Sodium").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT).setPhase(Phase.EARLY)
TESSELLATOR(new Builder("Thread safety checks for the Tesselator").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT).setPhase(Phase.EARLY)
.setApplyIf(() -> true).addMixinClasses("MixinTessellator")),
WAVEFRONT_VBO(new Builder("WavefrontObject").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
.setPhase(Phase.EARLY).setApplyIf(() -> true).addMixinClasses("MixinWavefrontObject")),
Expand Down

0 comments on commit edd48e3

Please sign in to comment.