1515import org .spongepowered .asm .mixin .injection .At ;
1616import org .spongepowered .asm .mixin .injection .Inject ;
1717import org .spongepowered .asm .mixin .injection .Redirect ;
18+ import org .spongepowered .asm .mixin .injection .callback .CallbackInfo ;
1819import org .spongepowered .asm .mixin .injection .callback .CallbackInfoReturnable ;
1920
2021import java .util .ArrayList ;
@@ -28,11 +29,11 @@ public MixinVideoOptionsScreen(Screen parent, GameOptions gameOptions, Text titl
2829 super (parent , gameOptions , title );
2930 }
3031
31- @ Redirect (method = "init" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/gui/widget/ButtonListWidget;addAll([Lnet/minecraft/client/options/Option;)V" ))
32+ @ Redirect (method = "init" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/gui/widget/ButtonListWidget;addAll([Lnet/minecraft/client/options/Option;)V" ))
3233 private void optionsSwap (ButtonListWidget list , Option [] old_options ) {
3334 Option .GAMMA .setMax (this .client .world == null ? 5 : 1 );
3435 ((DoubleOptionAccessor ) Option .GAMMA ).setStep (this .client .world == null ? 0.01f : 0 ); // 0.01f step ensures we get an exact .2f so "Bright" shows up even when slider goes to 500
35- List <Option > options = new ArrayList <>(Arrays .asList (old_options ));
36+ List <Option > options = new ArrayList <>(Arrays .asList (old_options ));
3637 SodiumGameOptions .SpeedrunSettings speedrunSettings = SodiumClientMod .options ().speedrun ;
3738 if (speedrunSettings .showEntityCulling ) {
3839 options .add (VanillaOptions .ENTITY_CULLING );
@@ -43,6 +44,12 @@ private void optionsSwap(ButtonListWidget list, Option[] old_options) {
4344 list .addAll (options .toArray (new Option [0 ]));
4445 }
4546
47+ @ Inject (method = "removed" , at = @ At ("HEAD" ))
48+ private void resetGammaOptionProperties (CallbackInfo ci ) {
49+ Option .GAMMA .setMax (1 );
50+ ((DoubleOptionAccessor ) Option .GAMMA ).setStep (0 );
51+ }
52+
4653 @ Inject (method = "mouseReleased" , at = @ At ("RETURN" ))
4754 public void onRelease (double mouseX , double mouseY , int button , CallbackInfoReturnable <Boolean > cir ) {
4855 VanillaOptions .applySettingsChanges ();
0 commit comments