diff --git a/src/main/java/net/wurstclient/hacks/AimAssistHack.java b/src/main/java/net/wurstclient/hacks/AimAssistHack.java index 3a60c7b17f..9c76065abe 100644 --- a/src/main/java/net/wurstclient/hacks/AimAssistHack.java +++ b/src/main/java/net/wurstclient/hacks/AimAssistHack.java @@ -13,12 +13,16 @@ import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; +import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.Box; import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.RaycastContext; import net.wurstclient.Category; import net.wurstclient.events.RenderListener; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; +import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; import net.wurstclient.settings.filterlists.EntityFilterList; @@ -42,6 +46,9 @@ public final class AimAssistHack extends Hack + "360\u00b0 = aims at entities all around you.", 120, 30, 360, 10, ValueDisplay.DEGREES); + private final CheckboxSetting checkLOS = new CheckboxSetting( + "Check line of sight", "Won't aim at entities behind blocks.", true); + private final EntityFilterList entityFilters = new EntityFilterList(FilterPlayersSetting.genericCombat(false), FilterSleepingSetting.genericCombat(false), @@ -72,6 +79,7 @@ public AimAssistHack() addSetting(range); addSetting(rotationSpeed); addSetting(fov); + addSetting(checkLOS); entityFilters.forEach(this::addSetting); } @@ -126,6 +134,17 @@ public void onUpdate() if(target == null) return; + Vec3d eyesPos = RotationUtils.getEyesPos(); + Vec3d hitVec = target.getBoundingBox().getCenter(); + if(checkLOS.isChecked() && MC.world + .raycast(new RaycastContext(eyesPos, hitVec, + RaycastContext.ShapeType.COLLIDER, + RaycastContext.FluidHandling.NONE, MC.player)) + .getType() != HitResult.Type.MISS) + { + target = null; + return; + } WURST.getHax().autoSwordHack.setSlot(); faceEntityClient(target); }