From 83d4e45791c94a47da6b60ef7bc4ea525fe3b450 Mon Sep 17 00:00:00 2001 From: TejasLamba2006 Date: Wed, 10 Jul 2024 00:59:53 +0530 Subject: [PATCH] feat(antibot): Add entity whitelisting Introduces an entity whitelisting mechanism to the AntiBot module. This allows specific entity types, such as Iron Golems, Silverfish, or Chickens, to be excluded from AntiBot checks. This enhancement provides finer control over AntiBot behavior, preventing accidental flagging of desired entities as bots. --- .../module/impl/world/AntiBot.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/keystrokesmod/module/impl/world/AntiBot.java b/src/main/java/keystrokesmod/module/impl/world/AntiBot.java index 4e0f2890..22c4843a 100644 --- a/src/main/java/keystrokesmod/module/impl/world/AntiBot.java +++ b/src/main/java/keystrokesmod/module/impl/world/AntiBot.java @@ -12,6 +12,9 @@ import keystrokesmod.utility.Utils; import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.entity.Entity; +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.entity.monster.EntitySilverfish; +import net.minecraft.entity.passive.EntityChicken; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.network.play.client.C02PacketUseEntity; import net.minecraftforge.event.entity.EntityJoinWorldEvent; @@ -31,6 +34,9 @@ public class AntiBot extends Module { private static ButtonSetting matrix; private static ButtonSetting cancelBotHit; private static ButtonSetting debug; + private static ButtonSetting whitelistGolem; + private static ButtonSetting whitelistSilverfish; + private static ButtonSetting whitelistChicken; public AntiBot() { super("AntiBot", Module.category.world, 0); @@ -41,6 +47,9 @@ public AntiBot() { this.registerSetting(debug = new ButtonSetting("Debug", false, matrix::isToggled)); this.registerSetting(pitSpawn = new ButtonSetting("Pit spawn", false)); this.registerSetting(cancelBotHit = new ButtonSetting("Cancel bot hit", false)); + this.registerSetting(whitelistGolem = new ButtonSetting("Whitelist golems", false)); + this.registerSetting(whitelistSilverfish = new ButtonSetting("Whitelist silverfishes", false)); + this.registerSetting(whitelistChicken = new ButtonSetting("Whitelist chickens", false)); } @SubscribeEvent @@ -103,6 +112,15 @@ public static boolean isBot(Entity entity) { if (Freecam.freeEntity != null && Freecam.freeEntity == entity) { return true; } + if (whitelistGolem.isToggled() && entity instanceof EntityIronGolem) { + return false; + } + if (whitelistSilverfish.isToggled() && entity instanceof EntitySilverfish) { + return false; + } + if (whitelistChicken.isToggled() && entity instanceof EntityChicken) { + return false; + } if (!(entity instanceof EntityPlayer)) { return true; }