diff options
Diffstat (limited to 'src/main/java/net/justlearning/arslaan3102/arslaansmagichax/modules/impl/Fullbright.java')
| -rw-r--r-- | src/main/java/net/justlearning/arslaan3102/arslaansmagichax/modules/impl/Fullbright.java | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/modules/impl/Fullbright.java b/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/modules/impl/Fullbright.java index 3085f02..bf72c6a 100644 --- a/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/modules/impl/Fullbright.java +++ b/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/modules/impl/Fullbright.java @@ -11,10 +11,10 @@ import net.minecraft.registry.Registries; import java.util.Objects; public class Fullbright extends Module { - private ModeSetting mode = new ModeSetting("Mode", "Gamma", "Effect", "Gamma"); + private ModeSetting mode = new ModeSetting("Mode", "Gamma", "Effect", "Gamma", "Effect + Gamma"); private SimpleOption<Double> option; private double previousGamma = 1.0; - private boolean didSetGamma = false; // in case the mod was initialized on client load/saved state + private boolean setPreviousGamma = false; public Fullbright() { super("Fullbright", "Brightens up your world!", -1, Category.RENDER); @@ -25,10 +25,10 @@ public class Fullbright extends Module { protected void onEnable() { if (mc.options == null) return; if (Objects.equals(mode.getMode(), "Gamma")) { - previousGamma = mc.options.getGamma().getValue(); + if (!setPreviousGamma) previousGamma = mc.options.getGamma().getValue(); + setPreviousGamma = true; mc.options.getGamma().setValue(1000.0); } - didSetGamma = true; } @Override @@ -36,19 +36,20 @@ public class Fullbright extends Module { if (!this.isEnabled() || mc.player == null) return; if (Objects.equals(mode.getMode(), "Effect")) { - if (didSetGamma) { - // undo gamma if switching mode - mc.options.getGamma().setValue(previousGamma); - didSetGamma = false; - } - mc.player.addStatusEffect(new StatusEffectInstance(Registries.STATUS_EFFECT.getEntry(StatusEffects.NIGHT_VISION.value()), 1, 0)); + mc.options.getGamma().setValue(previousGamma); + setPreviousGamma = false; + mc.player.addStatusEffect(new StatusEffectInstance(Registries.STATUS_EFFECT.getEntry(StatusEffects.NIGHT_VISION.value()), 1, 255)); } if (Objects.equals(mode.getMode(), "Gamma")) { - if (!didSetGamma) { - previousGamma = mc.options.getGamma().getValue(); - mc.options.getGamma().setValue(1000.0); - didSetGamma = true; - } + if (!setPreviousGamma) previousGamma = mc.options.getGamma().getValue(); + setPreviousGamma = true; + mc.options.getGamma().setValue(1000.0); + } + if (Objects.equals(mode.getMode(), "Effect + Gamma")) { + if (!setPreviousGamma) previousGamma = mc.options.getGamma().getValue(); + setPreviousGamma = true; + mc.options.getGamma().setValue(1000.0); + mc.player.addStatusEffect(new StatusEffectInstance(Registries.STATUS_EFFECT.getEntry(StatusEffects.NIGHT_VISION.value()), 1, 255)); } } |
