0
0
mirror of https://github.com/Wurst-Imperium/Wurst7.git synced 2024-09-20 01:12:13 +02:00

Add end crystal filter to ClickAuraHack

This commit is contained in:
Alexander01998 2020-08-25 17:02:30 +02:00
parent f219ee3e73
commit 7bb1e75138

View File

@ -14,8 +14,10 @@ import java.util.stream.StreamSupport;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.decoration.ArmorStandEntity;
import net.minecraft.entity.decoration.EndCrystalEntity;
import net.minecraft.entity.mob.AmbientEntity;
import net.minecraft.entity.mob.EndermanEntity;
import net.minecraft.entity.mob.Monster;
@ -96,8 +98,11 @@ public final class ClickAuraHack extends Hack
private final CheckboxSetting filterInvisible = new CheckboxSetting(
"Filter invisible", "Won't attack invisible entities.", false);
private final CheckboxSetting filterStands = new CheckboxSetting(
"Filter armor stands", "Won't attack armor stands.", false);
private final CheckboxSetting filterCrystals = new CheckboxSetting(
"Filter end crytsals", "Won't attack end crystals.", false);
public ClickAuraHack()
{
@ -123,6 +128,7 @@ public final class ClickAuraHack extends Hack
addSetting(filterGolems);
addSetting(filterInvisible);
addSetting(filterStands);
addSetting(filterCrystals);
}
@Override
@ -176,10 +182,12 @@ public final class ClickAuraHack extends Hack
return;
double rangeSq = Math.pow(range.getValue(), 2);
Stream<LivingEntity> stream = StreamSupport
.stream(MC.world.getEntities().spliterator(), true)
.filter(e -> e instanceof LivingEntity).map(e -> (LivingEntity)e)
.filter(e -> !e.removed && e.getHealth() > 0)
Stream<Entity> stream =
StreamSupport.stream(MC.world.getEntities().spliterator(), true)
.filter(e -> !e.removed)
.filter(e -> e instanceof LivingEntity
&& ((LivingEntity)e).getHealth() > 0
|| e instanceof EndCrystalEntity)
.filter(e -> player.squaredDistanceTo(e) <= rangeSq)
.filter(e -> e != player)
.filter(e -> !(e instanceof FakePlayerEntity))
@ -240,7 +248,10 @@ public final class ClickAuraHack extends Hack
if(filterStands.isChecked())
stream = stream.filter(e -> !(e instanceof ArmorStandEntity));
LivingEntity target =
if(filterCrystals.isChecked())
stream = stream.filter(e -> !(e instanceof EndCrystalEntity));
Entity target =
stream.min(priority.getSelected().comparator).orElse(null);
if(target == null)
return;
@ -268,13 +279,13 @@ public final class ClickAuraHack extends Hack
e -> RotationUtils
.getAngleToLookVec(e.getBoundingBox().getCenter())),
HEALTH("Health", e -> e.getHealth());
HEALTH("Health", e -> e instanceof LivingEntity
? ((LivingEntity)e).getHealth() : Integer.MAX_VALUE);
private final String name;
private final Comparator<LivingEntity> comparator;
private final Comparator<Entity> comparator;
private Priority(String name,
ToDoubleFunction<LivingEntity> keyExtractor)
private Priority(String name, ToDoubleFunction<Entity> keyExtractor)
{
this.name = name;
comparator = Comparator.comparingDouble(keyExtractor);