diff options
author | alemi <me@alemi.dev> | 2023-03-02 01:08:14 +0100 |
---|---|---|
committer | alemi <me@alemi.dev> | 2023-03-02 01:08:14 +0100 |
commit | 3272be2fae5a2b57f4a8c48aef7da880828b78dd (patch) | |
tree | fb78b6c0808b96259cb87d8b1998380db45145db | |
parent | b480fd3a796be8096a72473bb0164ae90677787a (diff) |
feat: filter neutral entities and friend players
-rw-r--r-- | src/main/java/ftbsc/bscv/modules/defense/Aura.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/main/java/ftbsc/bscv/modules/defense/Aura.java b/src/main/java/ftbsc/bscv/modules/defense/Aura.java index 36ff8cd..0ffe45c 100644 --- a/src/main/java/ftbsc/bscv/modules/defense/Aura.java +++ b/src/main/java/ftbsc/bscv/modules/defense/Aura.java @@ -1,12 +1,15 @@ package ftbsc.bscv.modules.defense; import com.google.auto.service.AutoService; + +import ftbsc.bscv.Boscovicino; import ftbsc.bscv.ICommons; import ftbsc.bscv.api.ILoadable; import ftbsc.bscv.modules.QuickModule; import ftbsc.bscv.tools.Setting; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.event.TickEvent; import net.minecraftforge.event.TickEvent.Phase; @@ -22,6 +25,8 @@ public class Aura extends QuickModule implements ICommons { public final ForgeConfigSpec.ConfigValue<Double> reach; public final ForgeConfigSpec.ConfigValue<Double> strenght; + public final ForgeConfigSpec.ConfigValue<Boolean> neutral; + public final ForgeConfigSpec.ConfigValue<Boolean> friends; public Aura() { super(); @@ -40,6 +45,18 @@ public class Aura extends QuickModule implements ICommons { .comment("minimum strenght required for attack") .fallback(1.) .build(this); + + this.neutral = Setting.Bool.builder() + .fallback(false) + .name("neutral") + .comment("attack neutral mobs") + .build(this); + + this.friends = Setting.Bool.builder() + .fallback(false) + .name("friends") + .comment("attack players tagged as friends") + .build(this); } @SubscribeEvent @@ -55,6 +72,14 @@ public class Aura extends QuickModule implements ICommons { if (!(e instanceof LivingEntity)) continue; if (!e.isAlive()) continue; if (e.distanceTo(MC.player) > this.reach.get()) continue; + if (!this.neutral.get() && e.getClassification(false).isFriendly()) continue; + if (e instanceof PlayerEntity) { + PlayerEntity player = (PlayerEntity) e; + if (Boscovicino.friends().isFriend(player.getGameProfile().getId())) { + continue; + } + } + if (!this.friends.get() && Boscovicino.friends().isFriend(e.getDisplayName().getString())) continue; MC.gameMode.attack(MC.player, e); break; } |