33import org .objectweb .asm .tree .ClassNode ;
44import org .spongepowered .asm .mixin .extensibility .IMixinConfigPlugin ;
55import org .spongepowered .asm .mixin .extensibility .IMixinInfo ;
6- import org . spongepowered . asm . service . MixinService ;
6+ import whocraft . tardis_refined . common . util . Platform ;
77
8- import java .io .IOException ;
98import java .util .List ;
109import java .util .Set ;
1110
1211public class TRMixinPlugin implements IMixinConfigPlugin {
1312
14- public static final boolean HAS_SODIUM ;
15-
16- static {
17- HAS_SODIUM = hasClass ("net.caffeinemc.mods.sodium.client.render.immediate.model.EntityRenderer" )
18- || hasClass ("me.jellysquid.mods.sodium.client.render.immediate.model.EntityRenderer" );
19- }
20-
21- private static boolean hasClass (String name ) {
22- try {
23- // This does *not* load the class!
24- MixinService .getService ().getBytecodeProvider ().getClassNode (name );
25- return true ;
26- } catch (ClassNotFoundException | IOException e ) {
27- return false ;
28- }
29- }
30-
3113 @ Override
3214 public void onLoad (String mixinPackage ) {
3315
@@ -42,13 +24,14 @@ public String getRefMapperConfig() {
4224 public boolean shouldApplyMixin (String targetClassName , String mixinClassName ) {
4325
4426 if (mixinClassName .contains ("whocraft.tardis_refined.mixin.render.SodiumFixMixin" )) {
45- TardisRefined .LOGGER .info ("Checking for Sodium, found: {}" , HAS_SODIUM );
27+ boolean isSodiumInstalled = Platform .isModLoaded ("sodium" );
28+ TardisRefined .LOGGER .info ("Checking for Sodium, found: {}" , isSodiumInstalled );
4629
47- if (HAS_SODIUM ){
30+ if (isSodiumInstalled ){
4831 TardisRefined .LOGGER .info ("Sodium Detected, enabling {}" , mixinClassName );
4932 }
5033
51- return HAS_SODIUM ;
34+ return isSodiumInstalled ;
5235 }
5336
5437 return true ;
0 commit comments