From e63806811dd6fb8606ad2e49027bfa514081f0e6 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 11 Oct 2023 17:22:22 +0200 Subject: [PATCH] Improve baby filter --- .../settings/filters/FilterBabiesSetting.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/wurstclient/settings/filters/FilterBabiesSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterBabiesSetting.java index b37ef49117..98d2bfe192 100644 --- a/src/main/java/net/wurstclient/settings/filters/FilterBabiesSetting.java +++ b/src/main/java/net/wurstclient/settings/filters/FilterBabiesSetting.java @@ -9,18 +9,30 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.passive.PassiveEntity; +import net.minecraft.entity.passive.TadpoleEntity; public final class FilterBabiesSetting extends EntityFilterCheckbox { + private static final String EXCEPTIONS_TEXT = "\n\nThis filter does not" + + " affect baby zombies and other hostile baby mobs."; + public FilterBabiesSetting(String description, boolean checked) { - super("Filter babies", description, checked); + super("Filter babies", description + EXCEPTIONS_TEXT, checked); } @Override public boolean test(Entity e) { - return !(e instanceof PassiveEntity && ((PassiveEntity)e).isBaby()); + // filter out passive entity babies + if(e instanceof PassiveEntity pe && pe.isBaby()) + return false; + + // filter out tadpoles + if(e instanceof TadpoleEntity) + return false; + + return true; } public static FilterBabiesSetting genericCombat(boolean checked)