From 102885c68c0b87615b1cda53facf87e8e6d6df3f Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 18 Oct 2023 17:22:43 +0200 Subject: [PATCH] Add FilterPassiveWaterSetting --- .../net/wurstclient/hacks/AimAssistHack.java | 1 + .../wurstclient/hacks/KillauraLegitHack.java | 1 + .../net/wurstclient/hacks/ProtectHack.java | 1 + .../java/net/wurstclient/hacks/RadarHack.java | 2 + .../filterlists/AnchorAuraFilterList.java | 4 ++ .../filterlists/CrystalAuraFilterList.java | 4 ++ .../filterlists/EntityFilterList.java | 1 + .../filterlists/FollowFilterList.java | 3 ++ .../filterlists/MobEspFilterList.java | 1 + .../filterlists/RemoteViewFilterList.java | 3 ++ .../filters/FilterPassiveWaterSetting.java | 48 +++++++++++++++++++ 11 files changed, 69 insertions(+) create mode 100644 src/main/java/net/wurstclient/settings/filters/FilterPassiveWaterSetting.java diff --git a/src/main/java/net/wurstclient/hacks/AimAssistHack.java b/src/main/java/net/wurstclient/hacks/AimAssistHack.java index 24b49fb630..3f4ba60448 100644 --- a/src/main/java/net/wurstclient/hacks/AimAssistHack.java +++ b/src/main/java/net/wurstclient/hacks/AimAssistHack.java @@ -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), diff --git a/src/main/java/net/wurstclient/hacks/KillauraLegitHack.java b/src/main/java/net/wurstclient/hacks/KillauraLegitHack.java index 5159174d76..f720ca85af 100644 --- a/src/main/java/net/wurstclient/hacks/KillauraLegitHack.java +++ b/src/main/java/net/wurstclient/hacks/KillauraLegitHack.java @@ -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), diff --git a/src/main/java/net/wurstclient/hacks/ProtectHack.java b/src/main/java/net/wurstclient/hacks/ProtectHack.java index 66f27ea946..7055a3a9b2 100644 --- a/src/main/java/net/wurstclient/hacks/ProtectHack.java +++ b/src/main/java/net/wurstclient/hacks/ProtectHack.java @@ -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), diff --git a/src/main/java/net/wurstclient/hacks/RadarHack.java b/src/main/java/net/wurstclient/hacks/RadarHack.java index 85683869fb..16e98010e7 100644 --- a/src/main/java/net/wurstclient/hacks/RadarHack.java +++ b/src/main/java/net/wurstclient/hacks/RadarHack.java @@ -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; @@ -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)); diff --git a/src/main/java/net/wurstclient/settings/filterlists/AnchorAuraFilterList.java b/src/main/java/net/wurstclient/settings/filterlists/AnchorAuraFilterList.java index 27ab5d68cd..c639816c9c 100644 --- a/src/main/java/net/wurstclient/settings/filterlists/AnchorAuraFilterList.java +++ b/src/main/java/net/wurstclient/settings/filterlists/AnchorAuraFilterList.java @@ -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)); diff --git a/src/main/java/net/wurstclient/settings/filterlists/CrystalAuraFilterList.java b/src/main/java/net/wurstclient/settings/filterlists/CrystalAuraFilterList.java index b64279c33e..776b7ec920 100644 --- a/src/main/java/net/wurstclient/settings/filterlists/CrystalAuraFilterList.java +++ b/src/main/java/net/wurstclient/settings/filterlists/CrystalAuraFilterList.java @@ -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)); diff --git a/src/main/java/net/wurstclient/settings/filterlists/EntityFilterList.java b/src/main/java/net/wurstclient/settings/filterlists/EntityFilterList.java index 223a58de5e..6de9163806 100644 --- a/src/main/java/net/wurstclient/settings/filterlists/EntityFilterList.java +++ b/src/main/java/net/wurstclient/settings/filterlists/EntityFilterList.java @@ -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), diff --git a/src/main/java/net/wurstclient/settings/filterlists/FollowFilterList.java b/src/main/java/net/wurstclient/settings/filterlists/FollowFilterList.java index c0bcfca566..7d0a33368e 100644 --- a/src/main/java/net/wurstclient/settings/filterlists/FollowFilterList.java +++ b/src/main/java/net/wurstclient/settings/filterlists/FollowFilterList.java @@ -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)); diff --git a/src/main/java/net/wurstclient/settings/filterlists/MobEspFilterList.java b/src/main/java/net/wurstclient/settings/filterlists/MobEspFilterList.java index c96d360939..ae17f6de89 100644 --- a/src/main/java/net/wurstclient/settings/filterlists/MobEspFilterList.java +++ b/src/main/java/net/wurstclient/settings/filterlists/MobEspFilterList.java @@ -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)); diff --git a/src/main/java/net/wurstclient/settings/filterlists/RemoteViewFilterList.java b/src/main/java/net/wurstclient/settings/filterlists/RemoteViewFilterList.java index 7d940f9738..fbc731c52f 100644 --- a/src/main/java/net/wurstclient/settings/filterlists/RemoteViewFilterList.java +++ b/src/main/java/net/wurstclient/settings/filterlists/RemoteViewFilterList.java @@ -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)); diff --git a/src/main/java/net/wurstclient/settings/filters/FilterPassiveWaterSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterPassiveWaterSetting.java new file mode 100644 index 0000000000..86664dc322 --- /dev/null +++ b/src/main/java/net/wurstclient/settings/filters/FilterPassiveWaterSetting.java @@ -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); + } +}