Skip to content

Commit

Permalink
feat(antibot): Add entity whitelisting
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
TejasLamba2006 committed Jul 9, 2024
1 parent 39cc36c commit 83d4e45
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/main/java/keystrokesmod/module/impl/world/AntiBot.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 83d4e45

Please sign in to comment.