Skip to content

Commit

Permalink
add lwjgl3 conflict warning
Browse files Browse the repository at this point in the history
  • Loading branch information
FalsePattern committed Dec 26, 2024
1 parent b830001 commit e63bc3f
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ dependencies {

compileOnly("makamys:neodymium-mc1.7.10:0.4.0-unofficial:dev")

compileOnly("com.github.GTNewHorizons:lwjgl3ify:2.1.5:dev")

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

compileOnly("com.gtnewhorizons.retrofuturabootstrap:RetroFuturaBootstrap:1.0.7")
Expand Down
29 changes: 29 additions & 0 deletions src/main/java/com/falsepattern/falsetweaks/Compat.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class Compat {
private static Boolean OPTIFINE = null;
private static Boolean DYNLIGHTS = null;
private static Boolean SHADERS = null;
private static Boolean LWJGL3IFY = null;

public static boolean neodymiumInstalled() {
if (NEODYMIUM != null) {
Expand Down Expand Up @@ -113,6 +114,19 @@ public static boolean optiFineHasShaders() {
return SHADERS;
}

public static boolean lwjgl3ifyLoaded() {
if (LWJGL3IFY != null) {
return LWJGL3IFY;
}
try {
LWJGL3IFY = Launch.classLoader.getClassBytes("me.eigenraven.lwjgl3ify.core.Lwjgl3ifyCoremod") != null;
} catch (IOException e) {
e.printStackTrace();
LWJGL3IFY = false;
}
return LWJGL3IFY;
}

public static void applyCompatibilityTweaks() {
ThreadingCompat.init();
if (Loader.isModLoaded("apparatus")) {
Expand All @@ -136,6 +150,15 @@ public static boolean isShaders() {
return optiFineHasShaders() && Config.isShaders();
}

public static boolean isSTBIStitcher() {
try {
return lwjgl3ifyLoaded() && LWJGL3IfyCompat.stbiTextureStitching();
} catch (Throwable t) {
t.printStackTrace();
return false;
}
}

public static float getAmbientOcclusionLightValue(Block block, int x, int y, int z, IBlockAccess blockAccess) {
if (ApparatusCompat.isApparatusPresent()) {
return ApparatusCompat.getAmbientOcclusionLightValue(block, x, y, z, blockAccess);
Expand Down Expand Up @@ -175,6 +198,12 @@ public static Tessellator threadTessellator() {
}
}

private static class LWJGL3IfyCompat {
public static boolean stbiTextureStitching() {
return me.eigenraven.lwjgl3ify.core.Config.MIXIN_STBI_TEXTURE_STITCHING;
}
}

private static class NeodymiumCompat {
public static boolean isActive() {
return Neodymium.isActive();
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/falsepattern/falsetweaks/FalseTweaks.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.falsepattern.falsetweaks.config.ModuleConfig;
import com.falsepattern.falsetweaks.proxy.CommonProxy;

import net.minecraft.util.EnumChatFormatting;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
Expand Down Expand Up @@ -79,6 +80,12 @@ public void preInit(FMLPreInitializationEvent e) {
if (Loader.isModLoaded("DynamicLights")) {
createSidedException("Remove the DynamicLights mod and restart the game!\nFalseTweaks has built-in dynamic lights support.");
}
if (ModuleConfig.TEXTURE_OPTIMIZATIONS && Compat.isSTBIStitcher()) {
createSidedException("FalseTweaks " +
EnumChatFormatting.BOLD + "textureOptimizations" + EnumChatFormatting.RESET + " is not compatible with LWJGL3Ify's " +
EnumChatFormatting.BOLD + "stbiTextureStitching" + EnumChatFormatting.RESET +
" option.\nDisable stbiTextureStitching in the lwjgl3ify.cfg\nor disable textureOptimizations in FalseTweaks!");
}
}

@Mod.EventHandler
Expand Down

0 comments on commit e63bc3f

Please sign in to comment.