Skip to content

Commit

Permalink
Add potion mode to Fullbright
Browse files Browse the repository at this point in the history
  • Loading branch information
0xTas committed Oct 26, 2024
1 parent 6827ce3 commit 3eb7d98
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@

package meteordevelopment.meteorclient.systems.modules.render;

import meteordevelopment.meteorclient.events.world.TickEvent;
import meteordevelopment.meteorclient.mixin.StatusEffectInstanceAccessor;
import meteordevelopment.meteorclient.settings.EnumSetting;
import meteordevelopment.meteorclient.settings.IntSetting;
import meteordevelopment.meteorclient.settings.Setting;
import meteordevelopment.meteorclient.settings.SettingGroup;
import meteordevelopment.meteorclient.systems.modules.Categories;
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.registry.Registries;
import net.minecraft.world.LightType;

public class Fullbright extends Module {
Expand Down Expand Up @@ -62,6 +68,9 @@ public void onActivate() {
@Override
public void onDeactivate() {
if (mode.get() == Mode.Luminance) mc.worldRenderer.reload();
else if (mode.get() == Mode.Potion && mc.player.hasStatusEffect(Registries.STATUS_EFFECT.getEntry(StatusEffects.NIGHT_VISION.value()))) {
mc.player.removeStatusEffect(Registries.STATUS_EFFECT.getEntry(StatusEffects.NIGHT_VISION.value()));
}
}

public int getLuminance(LightType type) {
Expand All @@ -73,8 +82,20 @@ public boolean getGamma() {
return isActive() && mode.get() == Mode.Gamma;
}

@EventHandler
private void onTick(TickEvent.Post event) {
if (mc.player == null) return;
if (mc.player.hasStatusEffect(Registries.STATUS_EFFECT.getEntry(StatusEffects.NIGHT_VISION.value()))) {
StatusEffectInstance instance = mc.player.getStatusEffect(Registries.STATUS_EFFECT.getEntry(StatusEffects.NIGHT_VISION.value()));
if (instance != null && instance.getDuration() < 1000) ((StatusEffectInstanceAccessor) instance).setDuration(1000);
} else {
mc.player.addStatusEffect(new StatusEffectInstance(Registries.STATUS_EFFECT.getEntry(StatusEffects.NIGHT_VISION.value()), 1000, 0));
}
}

public enum Mode {
Gamma,
Potion,
Luminance
}
}

0 comments on commit 3eb7d98

Please sign in to comment.