@@ -360,10 +360,12 @@ private static boolean affectedByRenderDistanceIssue() {
360360 return info .isAdreno () && info .glesMajorVersion >= 3 ;
361361 }
362362
363+ private static String [] sodiumMods = {"sodium" , "embeddium" , "rubidium" , "xenon" };
364+
363365 private static boolean affectedByLTWRenderDistanceIssue () {
364366 if (!"opengles3_ltw" .equals (Tools .LOCAL_RENDERER )) return false ;
365367 if (!affectedByRenderDistanceIssue ()) return false ;
366- if (hasMods ("sodium" , "embeddium" , "rubidium" )) return false ;
368+ if (hasMods (sodiumMods )) return false ;
367369
368370 int renderDistance ;
369371 try {
@@ -472,7 +474,37 @@ public static void launchMinecraft(final AppCompatActivity activity, MinecraftAc
472474 javaArgList .add ("-Dimgui.library.name=imgui-java" );
473475 // We use an abomination to support all DH versions with a single library.
474476 javaArgList .add ("-DZstdNativePath=" +Tools .NATIVE_LIB_DIR +"/libzstd-jni-1.5.7-6-dhcompat.so" );
477+ // We only ever reach this point when user has already used the force run switch
478+ boolean hasSodiumMod = false ;
479+ for (String modName : sodiumMods ) {
480+ if (hasMods (sodiumMods )) {
481+ hasSodiumMod = true ;
482+ File mixinPropertiesConfigFile = new File (getGameDir (), "config/" + modName + "-mixins.properties" );
483+ // Write mixin configs to somewhat help stability. We don't want more people complaining.
484+ String [] propertiesToAdd = {
485+ "mixin.features.buffer_builder.intrinsics=false" ,
486+ "mixin.features.chunk_rendering=false"
487+ };
488+ List <String > mixinPropertiesConfigStrings = null ;
489+ try {
490+ mixinPropertiesConfigStrings = org .apache .commons .io .FileUtils .readLines (mixinPropertiesConfigFile , "UTF-8" );
491+ } catch (IOException ignored ) {}
492+ if (mixinPropertiesConfigStrings == null ) {
493+ mixinPropertiesConfigStrings = new ArrayList <>();
494+ }
495+ for (String newLine : propertiesToAdd ) {
496+ if (!mixinPropertiesConfigStrings .contains (newLine )) {
497+ mixinPropertiesConfigStrings .add (newLine );
498+ }
499+ }
500+ try {
501+ org .apache .commons .io .FileUtils .writeLines (mixinPropertiesConfigFile , mixinPropertiesConfigStrings );
502+ } catch (IOException ignored ) {} // If we can't write it, we tried our best.
475503
504+ }
505+ }
506+ // We use a janky lwjgl setup. We don't want more people complaining it crashes.
507+ if (hasSodiumMod ) javaArgList .add ("-Dsodium.checks.issue2561=false" );
476508 javaArgList .add (versionInfo .mainClass );
477509 javaArgList .addAll (Arrays .asList (launchArgs ));
478510 // ctx.appendlnToLog("full args: "+javaArgList.toString());
0 commit comments