11package me .jellysquid .mods .sodium .mixin .features .options ;
22
33import me .jellysquid .mods .sodium .client .SodiumClientMod ;
4+ import me .jellysquid .mods .sodium .client .gui .SodiumGameOptions ;
45import me .jellysquid .mods .sodium .client .gui .SodiumOptionsGUI ;
56import me .jellysquid .mods .sodium .client .gui .VanillaOptions ;
67import me .jellysquid .mods .sodium .client .gui .options .OptionFlag ;
2122import org .spongepowered .asm .mixin .injection .Redirect ;
2223import org .spongepowered .asm .mixin .injection .callback .CallbackInfoReturnable ;
2324
24- import java .io .IOException ;
25+ import java .util .ArrayList ;
26+ import java .util .Arrays ;
27+ import java .util .List ;
2528import java .util .Set ;
2629
2730@ Mixin (VideoOptionsScreen .class )
@@ -31,29 +34,17 @@ public MixinVideoOptionsScreen(Screen parent, GameOptions gameOptions, Text titl
3134 super (parent , gameOptions , title );
3235 }
3336
34- private static final Option [] OPTIONS = {
35- Option .GRAPHICS ,
36- Option .RENDER_DISTANCE ,
37- Option .AO ,
38- Option .FRAMERATE_LIMIT ,
39- Option .VSYNC ,
40- Option .VIEW_BOBBING ,
41- Option .GUI_SCALE ,
42- Option .ATTACK_INDICATOR ,
43- Option .GAMMA ,
44- Option .CLOUDS ,
45- Option .FULLSCREEN ,
46- Option .PARTICLES ,
47- Option .MIPMAP_LEVELS ,
48- Option .ENTITY_SHADOWS ,
49- Option .ENTITY_DISTANCE_SCALING ,
50- VanillaOptions .ENTITY_CULLING
51- };
52-
5337 @ Redirect (method = "init" , at =@ At (value = "INVOKE" , target = "Lnet/minecraft/client/gui/widget/ButtonListWidget;addAll([Lnet/minecraft/client/options/Option;)V" ))
54- private void optionsSwap (ButtonListWidget list , Option [] old_options ){
55- list .addAll (OPTIONS );
56- VanillaOptions .clearSettingsChanges ();
38+ private void optionsSwap (ButtonListWidget list , Option [] old_options ) {
39+ List <Option > options = new ArrayList <>(Arrays .asList (old_options ));
40+ SodiumGameOptions .SpeedrunSettings speedrunSettings = SodiumClientMod .options ().speedrun ;
41+ if (speedrunSettings .showEntityCulling ) {
42+ options .add (VanillaOptions .ENTITY_CULLING );
43+ }
44+ if (speedrunSettings .showFogOcclusion ) {
45+ options .add (VanillaOptions .FOG_OCCLUSION );
46+ }
47+ list .addAll (options .toArray (new Option [0 ]));
5748 }
5849
5950 @ Inject (method = "mouseReleased" , at = @ At ("RETURN" ))
0 commit comments