Skip to content

Commit

Permalink
Make FilterEndermenSetting attack detecting
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Oct 11, 2023
1 parent dda3231 commit 4e292b4
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 19 deletions.
5 changes: 3 additions & 2 deletions src/main/java/net/wurstclient/hacks/AimAssistHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ public final class AimAssistHack extends Hack
FilterFlyingSetting.genericCombat(0),
FilterMonstersSetting.genericCombat(false),
FilterZombiePiglinsSetting
.genericCombat(FilterZombiePiglinsSetting.Mode.OFF),
FilterEndermenSetting.genericCombat(false),
.genericCombat(AttackDetectingEntityFilter.Mode.OFF),
FilterEndermenSetting
.genericCombat(AttackDetectingEntityFilter.Mode.OFF),
FilterPassiveSetting.genericCombat(true),
FilterBabiesSetting.genericCombat(true),
FilterBatsSetting.genericCombat(true),
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/net/wurstclient/hacks/KillauraLegitHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ public final class KillauraLegitHack extends Hack
FilterFlyingSetting.genericCombat(0.5),
FilterMonstersSetting.genericCombat(false),
FilterZombiePiglinsSetting
.genericCombat(FilterZombiePiglinsSetting.Mode.OFF),
FilterEndermenSetting.genericCombat(false),
.genericCombat(AttackDetectingEntityFilter.Mode.OFF),
FilterEndermenSetting
.genericCombat(AttackDetectingEntityFilter.Mode.OFF),
FilterPassiveSetting.genericCombat(false),
FilterBabiesSetting.genericCombat(false),
FilterBatsSetting.genericCombat(false),
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/net/wurstclient/hacks/ProtectHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public final class ProtectHack extends Hack
FilterMonstersSetting.genericCombat(false),
FilterZombiePiglinsSetting
.genericCombat(FilterZombiePiglinsSetting.Mode.OFF),
FilterEndermenSetting.genericCombat(false),
FilterEndermenSetting
.genericCombat(AttackDetectingEntityFilter.Mode.OFF),
FilterPassiveSetting.genericCombat(false),
FilterBabiesSetting.genericCombat(false),
FilterBatsSetting.genericCombat(false),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ public static EntityFilterList genericCombat()
FilterFlyingSetting.genericCombat(0),
FilterMonstersSetting.genericCombat(false),
FilterZombiePiglinsSetting
.genericCombat(FilterZombiePiglinsSetting.Mode.OFF),
FilterEndermenSetting.genericCombat(false),
.genericCombat(AttackDetectingEntityFilter.Mode.OFF),
FilterEndermenSetting
.genericCombat(AttackDetectingEntityFilter.Mode.OFF),
FilterPassiveSetting.genericCombat(false),
FilterBabiesSetting.genericCombat(false),
FilterBatsSetting.genericCombat(false),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public static FollowFilterList create()
builder.add(FilterZombiePiglinsSetting
.onOffOnly("Won't follow zombified piglins.", true));

builder.add(new FilterEndermenSetting("Won't follow endermen.", true));
builder.add(
FilterEndermenSetting.onOffOnly("Won't follow endermen.", true));

builder.add(new FilterPassiveSetting("Won't follow animals like pigs"
+ " and cows, ambient mobs like bats, and water mobs like"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ public static MobEspFilterList create()
ArrayList<EntityFilter> builder = new ArrayList<>();
builder.add(FilterMonstersSetting.genericVision(false));
builder.add(FilterZombiePiglinsSetting
.genericVision(FilterZombiePiglinsSetting.Mode.OFF));
builder.add(FilterEndermenSetting.genericVision(false));
.genericVision(AttackDetectingEntityFilter.Mode.OFF));
builder.add(FilterEndermenSetting
.genericVision(AttackDetectingEntityFilter.Mode.OFF));
builder.add(FilterPassiveSetting.genericVision(false));
builder.add(FilterBatsSetting.genericVision(false));
builder.add(FilterPetsSetting.genericVision(false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public static RemoteViewFilterList create()
builder.add(FilterZombiePiglinsSetting
.onOffOnly("Won't view zombified piglins.", true));

builder.add(new FilterEndermenSetting("Won't view endermen.", true));
builder
.add(FilterEndermenSetting.onOffOnly("Won't view endermen.", true));

builder.add(new FilterPassiveSetting("Won't view animals like pigs and"
+ " cows, ambient mobs like bats, and water mobs like fish, squid"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,55 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.mob.EndermanEntity;

public final class FilterEndermenSetting extends EntityFilterCheckbox
public final class FilterEndermenSetting extends AttackDetectingEntityFilter
{
public FilterEndermenSetting(String description, boolean checked)
private FilterEndermenSetting(String description, Mode selected,
boolean checked)
{
super("Filter endermen", description, checked);
super("Filter endermen", description, selected, checked);
}

public FilterEndermenSetting(String description, Mode selected)
{
this(description, selected, false);
}

@Override
public boolean test(Entity e)
public boolean onTest(Entity e)
{
return !(e instanceof EndermanEntity);
}

public static FilterEndermenSetting genericCombat(boolean checked)
@Override
public boolean ifCalmTest(Entity e)
{
return !(e instanceof EndermanEntity ee) || ee.isAttacking();
}

public static FilterEndermenSetting genericCombat(Mode selected)
{
return new FilterEndermenSetting("When set to \u00a7lOn\u00a7r,"
+ " endermen won't be attacked at all.\n\n"
+ "When set to \u00a7lIf calm\u00a7r, endermen won't be attacked"
+ " until they attack first. Be warned that this filter cannot"
+ " detect if the endermen are attacking you or someone else.\n\n"
+ "When set to \u00a7lOff\u00a7r, this filter does nothing and"
+ " endermen can be attacked.", selected);
}

public static FilterEndermenSetting genericVision(Mode selected)
{
return new FilterEndermenSetting("Won't attack endermen.", checked);
return new FilterEndermenSetting("When set to \u00a7lOn\u00a7r,"
+ " endermen won't be shown at all.\n\n"
+ "When set to \u00a7lIf calm\u00a7r, endermen won't be shown"
+ " until they attack something.\n\n"
+ "When set to \u00a7lOff\u00a7r, this filter does nothing and"
+ " endermen can be shown.", selected);
}

public static FilterEndermenSetting genericVision(boolean checked)
public static FilterEndermenSetting onOffOnly(String description,
boolean onByDefault)
{
return new FilterEndermenSetting("Won't show endermen.", checked);
return new FilterEndermenSetting(description, null, onByDefault);
}
}

0 comments on commit 4e292b4

Please sign in to comment.