From f2c86f842699d9ea3123d3e37952b37df3397366 Mon Sep 17 00:00:00 2001 From: Roman Danilov Date: Wed, 24 Apr 2024 02:30:32 +0500 Subject: [PATCH] Hunt module --- .../nekiplay/meteorplus/MeteorPlusAddon.java | 6 +- .../features/modules/combat/Hunt.java | 82 +++++++++++++++++++ .../meteorclient/modules/CriticalsMixin.java | 6 ++ .../meteorclient/modules/KillAuraMixin.java | 13 ++- 4 files changed, 103 insertions(+), 4 deletions(-) create mode 100644 src/main/java/nekiplay/meteorplus/features/modules/combat/Hunt.java diff --git a/src/main/java/nekiplay/meteorplus/MeteorPlusAddon.java b/src/main/java/nekiplay/meteorplus/MeteorPlusAddon.java index f026f17..cc8dd84 100644 --- a/src/main/java/nekiplay/meteorplus/MeteorPlusAddon.java +++ b/src/main/java/nekiplay/meteorplus/MeteorPlusAddon.java @@ -109,11 +109,13 @@ public void onInitialize() { } if (!isBaritonePresent) { + notFoundBaritoneIntegrations.add("Hunt"); notFoundBaritoneIntegrations.add("Freecam"); notFoundBaritoneIntegrations.add("Waypoints"); notFoundBaritoneIntegrations.add("Goto+"); } else { + enabledIntegrations.add("Hunt"); enabledIntegrations.add("Freecam"); enabledIntegrations.add("Waypoints"); enabledIntegrations.add("Goto+"); @@ -166,7 +168,9 @@ public void onInitialize() { //region Modules LOG.info(METEOR_LOGPREFIX + " Initializing modules..."); Modules modules = Modules.get(); - + if (isBaritonePresent) { + modules.add(new Hunt()); + } modules.add(new Teams()); modules.add(new HologramModule()); modules.add(new SprintPlus()); diff --git a/src/main/java/nekiplay/meteorplus/features/modules/combat/Hunt.java b/src/main/java/nekiplay/meteorplus/features/modules/combat/Hunt.java new file mode 100644 index 0000000..498f00d --- /dev/null +++ b/src/main/java/nekiplay/meteorplus/features/modules/combat/Hunt.java @@ -0,0 +1,82 @@ +package nekiplay.meteorplus.features.modules.combat; + +import meteordevelopment.meteorclient.events.world.TickEvent; +import meteordevelopment.meteorclient.pathing.PathManagers; +import meteordevelopment.meteorclient.settings.EntityTypeListSetting; +import meteordevelopment.meteorclient.settings.Setting; +import meteordevelopment.meteorclient.settings.SettingGroup; +import meteordevelopment.meteorclient.systems.friends.Friends; +import meteordevelopment.meteorclient.systems.modules.Categories; +import meteordevelopment.meteorclient.systems.modules.Module; +import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.utils.entity.SortPriority; +import meteordevelopment.meteorclient.utils.entity.TargetUtils; +import meteordevelopment.orbit.EventHandler; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.Tameable; +import net.minecraft.entity.passive.AnimalEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Items; + +import java.util.ArrayList; +import java.util.Set; + +public class Hunt extends Module { + public Hunt() { + super(Categories.Combat, "Hunt", "Automatic falk to entities"); + } + + private final SettingGroup sgGeneral = settings.getDefaultGroup(); + + private final Setting>> entities = sgGeneral.add(new EntityTypeListSetting.Builder() + .name("entities") + .description("Entities to attack.") + .onlyAttackable() + .build() + ); + + private boolean entityCheck(Entity entity) { + if (entity.equals(mc.player) || entity.equals(mc.cameraEntity)) return false; + if ((entity instanceof LivingEntity && ((LivingEntity) entity).isDead()) || !entity.isAlive()) return false; + if (!entities.get().contains(entity.getType())) return false; + if (entity instanceof Tameable tameable + && tameable.getOwnerUuid() != null + && tameable.getOwnerUuid().equals(mc.player.getUuid())) return false; + if (entity instanceof PlayerEntity player) { + if (player.isCreative()) return false; + if (!Friends.get().shouldAttack(player)) return false; + AntiBotPlus antiBotPlus = Modules.get().get(AntiBotPlus.class); + Teams teams = Modules.get().get(Teams.class); + if (antiBotPlus != null && antiBotPlus.isBot(player)) { + return false; + } + if (teams != null && teams.isInYourTeam(player)) { + return false; + } + } + + return true; + } + private final ArrayList targets = new ArrayList<>(); + + @Override + public void onDeactivate() { + targets.clear(); + PathManagers.get().stop(); + } + + @EventHandler + private void onTickEvent(TickEvent.Pre event) { + if (mc.world != null) { + TargetUtils.getList(targets, this::entityCheck, SortPriority.LowestDistance, 25); + + for (Entity entity : targets) { + + PathManagers.get().moveTo(entity.getBlockPos()); + return; + } + } + } +} diff --git a/src/main/java/nekiplay/meteorplus/mixin/meteorclient/modules/CriticalsMixin.java b/src/main/java/nekiplay/meteorplus/mixin/meteorclient/modules/CriticalsMixin.java index 397b29f..d474d7d 100644 --- a/src/main/java/nekiplay/meteorplus/mixin/meteorclient/modules/CriticalsMixin.java +++ b/src/main/java/nekiplay/meteorplus/mixin/meteorclient/modules/CriticalsMixin.java @@ -7,6 +7,7 @@ import meteordevelopment.meteorclient.systems.modules.combat.Criticals; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; +import net.minecraft.entity.LivingEntity; import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -30,6 +31,11 @@ private void onSendPacket(PacketEvent.Send event, CallbackInfo ci) { if (entity.getType() == EntityType.SHULKER_BULLET || entity.getType() == EntityType.FIREBALL) { ci.cancel(); } + else if (entity instanceof LivingEntity livingEntity) { + if (livingEntity.getHealth() <= 1) { + ci.cancel(); + } + } } } } diff --git a/src/main/java/nekiplay/meteorplus/mixin/meteorclient/modules/KillAuraMixin.java b/src/main/java/nekiplay/meteorplus/mixin/meteorclient/modules/KillAuraMixin.java index 5a4bd47..d093a6c 100644 --- a/src/main/java/nekiplay/meteorplus/mixin/meteorclient/modules/KillAuraMixin.java +++ b/src/main/java/nekiplay/meteorplus/mixin/meteorclient/modules/KillAuraMixin.java @@ -13,6 +13,7 @@ import nekiplay.meteorplus.features.modules.combat.criticals.CriticalsPlus; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; +import net.minecraft.entity.LivingEntity; import net.minecraft.entity.effect.StatusEffects; import net.minecraft.entity.player.PlayerEntity; import nekiplay.meteorplus.features.modules.combat.AntiBotPlus; @@ -66,6 +67,7 @@ public Entity getTarget() { private final Setting ignoreOnlyCritsOnLevitation = sgTiming.add(new BoolSetting.Builder() .name("ignore-only-crits-on-levetation") .defaultValue(true) + .visible(() -> onlyCrits.get()) .build() ); @@ -80,7 +82,7 @@ public Entity getTarget() { @Unique private final Setting ignoreOnlyCritsForOneHitEntity = sgTiming.add(new BoolSetting.Builder() - .name("ignore-only-crits-for-one-hit-entityies") + .name("ignore-only-crits-for-one-hit-entities") .description("Ignore only crits delay for shulker bullet and fireball.") .defaultValue(true) .visible(() -> ignoreSmartDelayForShulkerBulletAndGhastCharge.get() && onlyCrits.get()) @@ -151,8 +153,13 @@ else if (!ignoreOnlyCritsOnLevitation.get()) { @Unique private boolean oneHitEntity() { - if (ignoreSmartDelayForShulkerBulletAndGhastCharge.get() && getTarget() != null && (getTarget().getType() == EntityType.FIREBALL || getTarget().getType() == EntityType.SHULKER_BULLET)) { - return true; + if (getTarget() != null) { + if (ignoreSmartDelayForShulkerBulletAndGhastCharge.get() && (getTarget().getType() == EntityType.FIREBALL || getTarget().getType() == EntityType.SHULKER_BULLET)) { + return true; + } + else if (getTarget() instanceof LivingEntity livingEntity) { + return livingEntity.getHealth() <= 1; + } } return false; }