diff --git a/src/main/java/net/wurstclient/hacks/AimAssistHack.java b/src/main/java/net/wurstclient/hacks/AimAssistHack.java index 35b21e01a1..a122046479 100644 --- a/src/main/java/net/wurstclient/hacks/AimAssistHack.java +++ b/src/main/java/net/wurstclient/hacks/AimAssistHack.java @@ -60,6 +60,8 @@ public final class AimAssistHack extends Hack private final EntityFilterList entityFilters = new EntityFilterList(FilterPlayersSetting.genericCombat(false), + FilterTeammatesSetting.genericCombat(false), + FilterNpcLikeSetting.genericCombat(false), FilterSleepingSetting.genericCombat(false), FilterFlyingSetting.genericCombat(0), FilterHostileSetting.genericCombat(false), diff --git a/src/main/java/net/wurstclient/settings/filterlists/EntityFilterList.java b/src/main/java/net/wurstclient/settings/filterlists/EntityFilterList.java index 5de72c364f..51db92511f 100644 --- a/src/main/java/net/wurstclient/settings/filterlists/EntityFilterList.java +++ b/src/main/java/net/wurstclient/settings/filterlists/EntityFilterList.java @@ -62,6 +62,7 @@ public final boolean testOne(Entity entity) public static EntityFilterList genericCombat() { return new EntityFilterList(FilterPlayersSetting.genericCombat(false), + FilterTeammatesSetting.genericCombat(false), FilterNpcLikeSetting.genericCombat(false), FilterSleepingSetting.genericCombat(false), FilterFlyingSetting.genericCombat(0), diff --git a/src/main/java/net/wurstclient/settings/filters/FilterTeammatesSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterTeammatesSetting.java new file mode 100644 index 0000000000..a90ff5dc5d --- /dev/null +++ b/src/main/java/net/wurstclient/settings/filters/FilterTeammatesSetting.java @@ -0,0 +1,47 @@ +package net.wurstclient.settings.filters; + +import net.minecraft.entity.Entity; +import net.minecraft.text.Text; +import net.minecraft.text.TextColor; +import net.wurstclient.WurstClient; + +public final class FilterTeammatesSetting extends EntityFilterCheckbox +{ + public FilterTeammatesSetting(String description, boolean checked) + { + super("Filter teammates", description, checked); + } + + @Override + public boolean test(Entity e) + { + Text theirName = e.getDisplayName(); + if(theirName == null) + return false; + TextColor theirColor = theirName.getStyle().getColor(); + if(theirColor == null) + return false; + + assert WurstClient.MC.player != null; + Text myName = WurstClient.MC.player.getDisplayName(); + if(myName == null) + return false; + TextColor myColor = myName.getStyle().getColor(); + if(myColor == null) + return false; + + return !theirColor.equals(myColor); + } + + public static FilterTeammatesSetting genericCombat(boolean checked) + { + return new FilterTeammatesSetting( + "Won't attack players with the same name tag color.", checked); + } + + public static FilterTeammatesSetting genericVision(boolean checked) + { + return new FilterTeammatesSetting( + "Won't show players with the same name tag color.", checked); + } +}