fullbright
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
package cc.fros.features.modules.render;
|
||||
|
||||
import cc.fros.features.modules.Module;
|
||||
import cc.fros.features.settings.Setting;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
|
||||
public class FullbrightModule extends Module {
|
||||
private static final int POTION_DURATION = 400;
|
||||
|
||||
public final Setting<Mode> mode = mode("Mode", Mode.GAMMA);
|
||||
public final Setting<Double> gamma = num("Gamma", 5.0, 0.1, 100.0);
|
||||
public final Setting<Boolean> particles = bool("Particles", false);
|
||||
|
||||
private Mode activeMode = Mode.GAMMA;
|
||||
private double previousGamma;
|
||||
private boolean hadNightVision;
|
||||
|
||||
public FullbrightModule() {
|
||||
super("Fullbright", "Makes everything bright", Category.RENDER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
activeMode = mode.getValue();
|
||||
prepare(activeMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick() {
|
||||
if (mode.getValue() != activeMode) {
|
||||
restore(activeMode);
|
||||
activeMode = mode.getValue();
|
||||
prepare(activeMode);
|
||||
}
|
||||
|
||||
if (activeMode == Mode.GAMMA) {
|
||||
applyGamma();
|
||||
return;
|
||||
}
|
||||
|
||||
if (nullCheck()) return;
|
||||
// reapply every tick so it never expires
|
||||
mc.player.addEffect(new MobEffectInstance(MobEffects.NIGHT_VISION,
|
||||
POTION_DURATION, 0, true, particles.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
restore(activeMode);
|
||||
}
|
||||
|
||||
private void prepare(Mode newMode) {
|
||||
if (newMode == Mode.GAMMA) {
|
||||
previousGamma = mc.options.gamma().get();
|
||||
return;
|
||||
}
|
||||
hadNightVision = !nullCheck() && mc.player.hasEffect(MobEffects.NIGHT_VISION);
|
||||
}
|
||||
|
||||
private void restore(Mode oldMode) {
|
||||
if (oldMode == Mode.GAMMA) {
|
||||
// bypass OptionInstance#set, which rejects values outside [0.0, 1.0]
|
||||
mc.options.gamma().value = previousGamma;
|
||||
return;
|
||||
}
|
||||
if (!nullCheck() && !hadNightVision) {
|
||||
mc.player.removeEffect(MobEffects.NIGHT_VISION);
|
||||
}
|
||||
}
|
||||
|
||||
private void applyGamma() {
|
||||
mc.options.gamma().value = gamma.getValue();
|
||||
}
|
||||
|
||||
public enum Mode {
|
||||
GAMMA,
|
||||
POTION
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import cc.fros.features.modules.player.FastPlaceModule;
|
||||
import cc.fros.features.modules.player.NoFallModule;
|
||||
import cc.fros.features.modules.player.VelocityModule;
|
||||
import cc.fros.features.modules.render.BlockHighlightModule;
|
||||
import cc.fros.features.modules.render.FullbrightModule;
|
||||
import cc.fros.util.traits.Jsonable;
|
||||
import cc.fros.util.traits.Util;
|
||||
import org.slf4j.Logger;
|
||||
@@ -62,6 +63,7 @@ public class ModuleManager implements Jsonable, Util {
|
||||
register(new FastPlaceModule());
|
||||
register(new VelocityModule());
|
||||
register(new BlockHighlightModule());
|
||||
register(new FullbrightModule());
|
||||
register(new NoFallModule());
|
||||
register(new KeyPearlModule());
|
||||
register(new KillAuraModule());
|
||||
|
||||
@@ -10,4 +10,5 @@ accessible field com/mojang/blaze3d/platform/InputConstants$Type map Lit/unimi/d
|
||||
|
||||
accessible field net/minecraft/client/player/LocalPlayer positionReminder I
|
||||
accessible field net/minecraft/client/player/LocalPlayer yRotLast F
|
||||
accessible field net/minecraft/client/player/LocalPlayer xRotLast F
|
||||
accessible field net/minecraft/client/player/LocalPlayer xRotLast F
|
||||
accessible field net/minecraft/client/OptionInstance value Ljava/lang/Object;
|
||||
Reference in New Issue
Block a user