Skip to content

Commit

Permalink
Add FilterTeammatesSetting
Browse files Browse the repository at this point in the history
  • Loading branch information
LilyKensa committed Aug 10, 2024
1 parent 21ce72b commit e27ce53
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/net/wurstclient/hacks/AimAssistHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}

0 comments on commit e27ce53

Please sign in to comment.