|
7 | 7 | */ |
8 | 8 | package net.wurstclient.hacks; |
9 | 9 |
|
| 10 | +import java.awt.Color; |
10 | 11 | import java.util.ArrayList; |
11 | 12 | import java.util.HashMap; |
12 | 13 | import java.util.Map; |
|
19 | 20 |
|
20 | 21 | import net.minecraft.client.network.AbstractClientPlayerEntity; |
21 | 22 | import net.minecraft.client.util.math.MatrixStack; |
| 23 | +import net.minecraft.entity.LivingEntity; |
22 | 24 | import net.minecraft.entity.player.PlayerEntity; |
23 | 25 | import net.minecraft.util.math.Box; |
24 | 26 | import net.minecraft.util.math.MathHelper; |
|
29 | 31 | import net.minecraft.text.MutableText; |
30 | 32 | import net.minecraft.text.TextColor; |
31 | 33 | import net.minecraft.util.Formatting; |
| 34 | +import net.minecraft.world.RaycastContext; |
32 | 35 | import net.wurstclient.Category; |
33 | 36 | import net.wurstclient.SearchTags; |
34 | 37 | import net.wurstclient.events.CameraTransformViewBobbingListener; |
35 | 38 | import net.wurstclient.events.RenderListener; |
36 | 39 | import net.wurstclient.events.UpdateListener; |
37 | 40 | import net.wurstclient.hack.Hack; |
| 41 | +import net.wurstclient.settings.ColorSetting; |
| 42 | +import net.wurstclient.settings.CheckboxSetting; |
| 43 | +import net.wurstclient.settings.EnumSetting; |
38 | 44 | import net.wurstclient.settings.EspBoxSizeSetting; |
39 | | -import net.wurstclient.settings.EspStyleSetting; |
40 | | -import net.wurstclient.settings.EspStyleSetting.EspStyle; |
| 45 | +import net.wurstclient.settings.SliderSetting; |
41 | 46 | import net.wurstclient.settings.filterlists.EntityFilterList; |
42 | 47 | import net.wurstclient.settings.filters.FilterInvisibleSetting; |
43 | 48 | import net.wurstclient.settings.filters.FilterSleepingSetting; |
44 | | -import net.wurstclient.settings.ColorSetting; |
45 | | -import java.awt.Color; |
46 | | -import net.wurstclient.settings.CheckboxSetting; |
47 | | -import net.wurstclient.settings.SliderSetting; |
| 49 | +import net.wurstclient.util.ChatUtils; |
48 | 50 | import net.wurstclient.util.EntityUtils; |
49 | 51 | import net.wurstclient.util.FakePlayerEntity; |
50 | 52 | import net.wurstclient.util.RenderUtils; |
51 | | -import net.wurstclient.util.ChatUtils; |
52 | 53 | import net.wurstclient.util.RenderUtils.ColoredBox; |
53 | 54 | import net.wurstclient.util.RenderUtils.ColoredPoint; |
54 | | -import net.minecraft.world.RaycastContext; |
55 | 55 |
|
56 | 56 | @SearchTags({"player esp", "PlayerTracers", "player tracers"}) |
57 | 57 | public final class PlayerEspHack extends Hack implements UpdateListener, |
58 | 58 | CameraTransformViewBobbingListener, RenderListener |
59 | 59 | { |
60 | | - private final EspStyleSetting style = |
61 | | - new EspStyleSetting(EspStyle.LINES_AND_BOXES); |
| 60 | + private final PlayerEspStyleSetting style = |
| 61 | + new PlayerEspStyleSetting(PlayerEspStyleSetting.Style.LINES_AND_GLOW); |
62 | 62 |
|
63 | 63 | private final EspBoxSizeSetting boxSize = new EspBoxSizeSetting( |
64 | 64 | "\u00a7lAccurate\u00a7r mode shows the exact hitbox of each player.\n" |
@@ -429,6 +429,20 @@ public void onRender(MatrixStack matrixStack, float partialTicks) |
429 | 429 | } |
430 | 430 | } |
431 | 431 |
|
| 432 | + public Integer getGlowColor(LivingEntity entity) |
| 433 | + { |
| 434 | + if(!isEnabled()) |
| 435 | + return null; |
| 436 | + if(!style.hasGlow()) |
| 437 | + return null; |
| 438 | + if(!(entity instanceof PlayerEntity player)) |
| 439 | + return null; |
| 440 | + if(!players.contains(player)) |
| 441 | + return null; |
| 442 | + |
| 443 | + return makeOpaque(getBaseColor(player)); |
| 444 | + } |
| 445 | + |
432 | 446 | private int getBaseColor(PlayerEntity e) |
433 | 447 | { |
434 | 448 | if(WURST.getFriends().contains(e.getName().getString())) |
@@ -727,4 +741,57 @@ private void setLos(boolean value, long now) |
727 | 741 | } |
728 | 742 | } |
729 | 743 | } |
| 744 | + |
| 745 | + private static final class PlayerEspStyleSetting |
| 746 | + extends EnumSetting<PlayerEspStyleSetting.Style> |
| 747 | + { |
| 748 | + private PlayerEspStyleSetting(Style defaultStyle) |
| 749 | + { |
| 750 | + super("Style", Style.values(), defaultStyle); |
| 751 | + } |
| 752 | + |
| 753 | + public boolean hasBoxes() |
| 754 | + { |
| 755 | + return getSelected().boxes; |
| 756 | + } |
| 757 | + |
| 758 | + public boolean hasLines() |
| 759 | + { |
| 760 | + return getSelected().lines; |
| 761 | + } |
| 762 | + |
| 763 | + public boolean hasGlow() |
| 764 | + { |
| 765 | + return getSelected().glow; |
| 766 | + } |
| 767 | + |
| 768 | + private enum Style |
| 769 | + { |
| 770 | + BOXES("Boxes only", true, false, false), |
| 771 | + LINES("Lines only", false, true, false), |
| 772 | + LINES_AND_BOXES("Lines and boxes", true, true, false), |
| 773 | + GLOW("Glow only", false, false, true), |
| 774 | + LINES_AND_GLOW("Lines and glow", false, true, true); |
| 775 | + |
| 776 | + private final String name; |
| 777 | + private final boolean boxes; |
| 778 | + private final boolean lines; |
| 779 | + private final boolean glow; |
| 780 | + |
| 781 | + private Style(String name, boolean boxes, boolean lines, |
| 782 | + boolean glow) |
| 783 | + { |
| 784 | + this.name = name; |
| 785 | + this.boxes = boxes; |
| 786 | + this.lines = lines; |
| 787 | + this.glow = glow; |
| 788 | + } |
| 789 | + |
| 790 | + @Override |
| 791 | + public String toString() |
| 792 | + { |
| 793 | + return name; |
| 794 | + } |
| 795 | + } |
| 796 | + } |
730 | 797 | } |
0 commit comments