Skip to content

Commit

Permalink
Distance check for totem pops
Browse files Browse the repository at this point in the history
  • Loading branch information
RedCarlos26 committed Aug 9, 2024
1 parent c094f46 commit 7fdf806
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.utils.entity.fakeplayer.FakePlayerEntity;
import meteordevelopment.meteorclient.utils.player.ChatUtils;
import meteordevelopment.meteorclient.utils.player.PlayerUtils;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
Expand Down Expand Up @@ -49,6 +50,24 @@ public class Notifier extends Module {
.build()
);

private final Setting<Boolean> totemsDistanceCheck = sgTotemPops.add(new BoolSetting.Builder()
.name("distance-check")
.description("Limits the distance in which the pops are recognized.")
.defaultValue(false)
.visible(totemPops::get)
.build()
);

private final Setting<Integer> totemsDistance = sgTotemPops.add(new IntSetting.Builder()
.name("player-radius")
.description("The radius in which to log totem pops.")
.defaultValue(30)
.sliderRange(1, 50)
.range(1, 100)
.visible(() -> totemPops.get() && totemsDistanceCheck.get())
.build()
);

private final Setting<Boolean> totemsIgnoreOwn = sgTotemPops.add(new BoolSetting.Builder()
.name("ignore-own")
.description("Ignores your own totem pops.")
Expand Down Expand Up @@ -246,6 +265,9 @@ private void onReceivePacket(PacketEvent.Receive event) {
int pops = totemPopMap.getOrDefault(entity.getUuid(), 0);
totemPopMap.put(entity.getUuid(), ++pops);

double distance = PlayerUtils.distanceTo(entity);
if (totemsDistanceCheck.get() && distance > totemsDistance.get()) return;

ChatUtils.sendMsg(getChatId(entity), Formatting.GRAY, "(highlight)%s (default)popped (highlight)%d (default)%s.", entity.getName().getString(), pops, pops == 1 ? "totem" : "totems");
}
}
Expand Down

0 comments on commit 7fdf806

Please sign in to comment.