Skip to content

Commit

Permalink
Add FilterPassiveWaterSetting
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Oct 18, 2023
1 parent 8c3384f commit 102885c
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/net/wurstclient/hacks/AimAssistHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public final class AimAssistHack extends Hack
FilterNeutralSetting
.genericCombat(AttackDetectingEntityFilter.Mode.OFF),
FilterPassiveSetting.genericCombat(true),
FilterPassiveWaterSetting.genericCombat(true),
FilterBabiesSetting.genericCombat(true),
FilterBatsSetting.genericCombat(true),
FilterPetsSetting.genericCombat(true),
Expand Down
1 change: 1 addition & 0 deletions src/main/java/net/wurstclient/hacks/KillauraLegitHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public final class KillauraLegitHack extends Hack
FilterNeutralSetting
.genericCombat(AttackDetectingEntityFilter.Mode.OFF),
FilterPassiveSetting.genericCombat(false),
FilterPassiveWaterSetting.genericCombat(false),
FilterBabiesSetting.genericCombat(false),
FilterBatsSetting.genericCombat(false),
FilterPetsSetting.genericCombat(false),
Expand Down
1 change: 1 addition & 0 deletions src/main/java/net/wurstclient/hacks/ProtectHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public final class ProtectHack extends Hack
FilterNeutralSetting
.genericCombat(AttackDetectingEntityFilter.Mode.OFF),
FilterPassiveSetting.genericCombat(false),
FilterPassiveWaterSetting.genericCombat(false),
FilterBabiesSetting.genericCombat(false),
FilterBatsSetting.genericCombat(false),
FilterPetsSetting.genericCombat(false),
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/wurstclient/hacks/RadarHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import net.wurstclient.settings.filters.FilterHostileSetting;
import net.wurstclient.settings.filters.FilterInvisibleSetting;
import net.wurstclient.settings.filters.FilterPassiveSetting;
import net.wurstclient.settings.filters.FilterPassiveWaterSetting;
import net.wurstclient.settings.filters.FilterPlayersSetting;
import net.wurstclient.settings.filters.FilterSleepingSetting;
import net.wurstclient.util.FakePlayerEntity;
Expand All @@ -51,6 +52,7 @@ public final class RadarHack extends Hack implements UpdateListener
FilterSleepingSetting.genericVision(false),
FilterHostileSetting.genericVision(false),
FilterPassiveSetting.genericVision(false),
FilterPassiveWaterSetting.genericVision(false),
FilterBatsSetting.genericVision(true),
FilterInvisibleSetting.genericVision(false));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public static AnchorAuraFilterList create()
+ " squid and dolphins when auto-placing anchors." + damageWarning,
true));

builder.add(new FilterPassiveWaterSetting("Won't target passive water"
+ " mobs like fish, squid, dolphins and axolotls when auto-placing"
+ " anchors." + damageWarning, true));

builder.add(new FilterBatsSetting("Won't target bats and any other"
+ " \"ambient\" mobs when auto-placing anchors." + damageWarning,
true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public static CrystalAuraFilterList create()
+ " squid and dolphins when auto-placing crystals." + damageWarning,
true));

builder.add(new FilterPassiveWaterSetting("Won't target passive water"
+ " mobs like fish, squid, dolphins and axolotls when auto-placing"
+ " crystals." + damageWarning, true));

builder.add(new FilterBatsSetting("Won't target bats and any other"
+ " \"ambient\" mobs when auto-placing crystals." + damageWarning,
true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public static EntityFilterList genericCombat()
FilterNeutralSetting
.genericCombat(AttackDetectingEntityFilter.Mode.OFF),
FilterPassiveSetting.genericCombat(false),
FilterPassiveWaterSetting.genericCombat(false),
FilterBabiesSetting.genericCombat(false),
FilterBatsSetting.genericCombat(false),
FilterPetsSetting.genericCombat(false),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public static FollowFilterList create()
+ " and cows, ambient mobs like bats, and water mobs like"
+ " fish, squid and dolphins.", true));

builder.add(new FilterPassiveWaterSetting("Won't follow passive water"
+ " mobs like fish, squid, dolphins and axolotls.", true));

builder.add(new FilterBabiesSetting(
"Won't follow baby pigs, baby villagers, etc.", true));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public static MobEspFilterList create()
builder.add(FilterNeutralSetting
.genericVision(AttackDetectingEntityFilter.Mode.OFF));
builder.add(FilterPassiveSetting.genericVision(false));
builder.add(FilterPassiveWaterSetting.genericVision(false));
builder.add(FilterBatsSetting.genericVision(false));
builder.add(FilterPetsSetting.genericVision(false));
builder.add(FilterVillagersSetting.genericVision(false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public static RemoteViewFilterList create()
+ " cows, ambient mobs like bats, and water mobs like fish, squid"
+ " and dolphins.", true));

builder.add(new FilterPassiveWaterSetting("Won't view passive water"
+ " mobs like fish, squid, dolphins and axolotls.", true));

builder.add(new FilterBabiesSetting(
"Won't view baby pigs, baby villagers, etc.", true));

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (c) 2014-2023 Wurst-Imperium and contributors.
*
* This source code is subject to the terms of the GNU General Public
* License, version 3. If a copy of the GPL was not distributed with this
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
*/
package net.wurstclient.settings.filters;

import net.minecraft.entity.Entity;
import net.minecraft.entity.mob.WaterCreatureEntity;
import net.minecraft.entity.passive.AxolotlEntity;
import net.minecraft.entity.passive.PufferfishEntity;

public final class FilterPassiveWaterSetting extends EntityFilterCheckbox
{
private static final String EXCEPTIONS_TEXT =
"\n\nThis filter does not affect guardians, drowned, and pufferfish.";

public FilterPassiveWaterSetting(String description, boolean checked)
{
super("Filter passive water mobs", description + EXCEPTIONS_TEXT,
checked);
}

@Override
public boolean test(Entity e)
{
// never filter out pufferfish
if(e instanceof PufferfishEntity)
return true;

return !(e instanceof WaterCreatureEntity
|| e instanceof AxolotlEntity);
}

public static FilterPassiveWaterSetting genericCombat(boolean checked)
{
return new FilterPassiveWaterSetting("Won't attack passive water mobs"
+ " like fish, squid, dolphins and axolotls.", checked);
}

public static FilterPassiveWaterSetting genericVision(boolean checked)
{
return new FilterPassiveWaterSetting("Won't show passive water mobs"
+ " like fish, squid, dolphins and axolotls.", checked);
}
}

0 comments on commit 102885c

Please sign in to comment.