Skip to content

Commit

Permalink
Added Hidden Effects
Browse files Browse the repository at this point in the history
Added Show Ambient
  • Loading branch information
thebest9178 authored and Wide-Cat committed Aug 11, 2023
1 parent 953c071 commit 7191d38
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
import meteordevelopment.meteorclient.utils.misc.Names;
import meteordevelopment.meteorclient.utils.render.color.Color;
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffectUtil;

import java.util.List;

import static meteordevelopment.meteorclient.MeteorClient.mc;

public class PotionTimersHud extends HudElement {
Expand All @@ -24,6 +27,19 @@ public class PotionTimersHud extends HudElement {

// General

private final Setting<List<StatusEffect>> hiddenEffects = sgGeneral.add(new StatusEffectListSetting.Builder()
.name("hidden-effects")
.description("Which effects not to show in the list.")
.build()
);

private final Setting<Boolean> showAmbient = sgGeneral.add(new BoolSetting.Builder()
.name("show-ambient")
.description("Whether to show ambient effects like from beacons and conduits.")
.defaultValue(true)
.build()
);

private final Setting<ColorMode> colorMode = sgGeneral.add(new EnumSetting.Builder<ColorMode>()
.name("color-mode")
.description("What color to use for effects.")
Expand Down Expand Up @@ -165,6 +181,8 @@ public void tick(HudRenderer renderer) {
double height = 0;

for (StatusEffectInstance statusEffectInstance : mc.player.getStatusEffects()) {
if (hiddenEffects.get().contains(statusEffectInstance.getEffectType())) continue;
if (!showAmbient.get() && statusEffectInstance.isAmbient()) continue;
width = Math.max(width, renderer.textWidth(getString(statusEffectInstance), shadow.get(), getScale()));
height += renderer.textHeight(shadow.get(), getScale());
}
Expand Down Expand Up @@ -193,6 +211,8 @@ public void render(HudRenderer renderer) {
rainbowHue2 = rainbowHue1;

for (StatusEffectInstance statusEffectInstance : mc.player.getStatusEffects()) {
if (hiddenEffects.get().contains(statusEffectInstance.getEffectType())) continue;
if (!showAmbient.get() && statusEffectInstance.isAmbient()) continue;
Color color = new Color(255, 255, 255);

switch (colorMode.get()) {
Expand Down

0 comments on commit 7191d38

Please sign in to comment.