-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Force-rebind lightmap texture when Quartz+Lodestone are active
We should not need to do this. Mods should use RenderSystem Works around: * BiggerSeries/Quartz#12 * LodestarMC/Lodestone#9
- Loading branch information
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/main/java/me/jellysquid/mods/sodium/client/quirks/QuirkManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package me.jellysquid.mods.sodium.client.quirks; | ||
|
||
import me.jellysquid.mods.sodium.client.SodiumClientMod; | ||
import net.minecraftforge.fml.ModList; | ||
|
||
import java.lang.reflect.Field; | ||
import java.lang.reflect.Modifier; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.stream.Stream; | ||
|
||
public class QuirkManager { | ||
/** | ||
* Force rebinding of the 2nd texture (lightmap) if Quartz and Lodestone are installed. This fixes | ||
* <a href="https://github.com/LodestarMC/Lodestone/issues/9">LodestarMC/Lodestone#9</a>. | ||
* <p></p> | ||
* Only tested on 18.2. | ||
*/ | ||
public static final boolean REBIND_LIGHTMAP_TEXTURE = Stream.of("quartz", "lodestone").allMatch(QuirkManager::isLoaded); | ||
|
||
static { | ||
try { | ||
List<String> enabledQuirks = new ArrayList<>(); | ||
for(Field f : QuirkManager.class.getDeclaredFields()) { | ||
if(f.getType() == boolean.class && Modifier.isStatic(f.getModifiers())) { | ||
if(f.getBoolean(null)) | ||
enabledQuirks.add(f.getName()); | ||
} | ||
} | ||
SodiumClientMod.logger().warn("Enabled the following quirks in QuirkManager: [{}]", String.join(", ", enabledQuirks)); | ||
} catch(ReflectiveOperationException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
private static boolean isLoaded(String modId) { | ||
return ModList.get().isLoaded(modId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters