Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Commit

Permalink
Hunt module
Browse files Browse the repository at this point in the history
  • Loading branch information
Nekiplay committed Apr 23, 2024
1 parent 034e753 commit f2c86f8
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/main/java/nekiplay/meteorplus/MeteorPlusAddon.java
Original file line number Diff line number Diff line change
Expand Up @@ -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+");
Expand Down Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Set<EntityType<?>>> 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<Entity> 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;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -66,6 +67,7 @@ public Entity getTarget() {
private final Setting<Boolean> ignoreOnlyCritsOnLevitation = sgTiming.add(new BoolSetting.Builder()
.name("ignore-only-crits-on-levetation")
.defaultValue(true)
.visible(() -> onlyCrits.get())
.build()
);

Expand All @@ -80,7 +82,7 @@ public Entity getTarget() {

@Unique
private final Setting<Boolean> 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())
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit f2c86f8

Please sign in to comment.