use of net.minecraft.entity.decoration.EndCrystalEntity in project Wurst7 by Wurst-Imperium.
the class TriggerBotHack method isCorrectEntity.
private boolean isCorrectEntity(Entity entity) {
ClientPlayerEntity player = MC.player;
ClientWorld world = MC.world;
double rangeSq = Math.pow(range.getValue(), 2);
Stream<Entity> stream = Stream.of(entity).filter(e -> !e.isRemoved()).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)).filter(e -> !WURST.getFriends().contains(e.getEntityName()));
if (filterPlayers.isChecked())
stream = stream.filter(e -> !(e instanceof PlayerEntity));
if (filterSleeping.isChecked())
stream = stream.filter(e -> !(e instanceof PlayerEntity && ((PlayerEntity) e).isSleeping()));
if (filterFlying.getValue() > 0)
stream = stream.filter(e -> {
if (!(e instanceof PlayerEntity))
return true;
Box box = e.getBoundingBox();
box = box.union(box.offset(0, -filterFlying.getValue(), 0));
return !world.isSpaceEmpty(box);
});
if (filterMonsters.isChecked())
stream = stream.filter(e -> !(e instanceof Monster));
if (filterPigmen.isChecked())
stream = stream.filter(e -> !(e instanceof ZombifiedPiglinEntity));
if (filterEndermen.isChecked())
stream = stream.filter(e -> !(e instanceof EndermanEntity));
if (filterAnimals.isChecked())
stream = stream.filter(e -> !(e instanceof AnimalEntity || e instanceof AmbientEntity || e instanceof WaterCreatureEntity));
if (filterBabies.isChecked())
stream = stream.filter(e -> !(e instanceof PassiveEntity && ((PassiveEntity) e).isBaby()));
if (filterPets.isChecked())
stream = stream.filter(e -> !(e instanceof TameableEntity && ((TameableEntity) e).isTamed())).filter(e -> !(e instanceof HorseBaseEntity && ((HorseBaseEntity) e).isTame()));
if (filterTraders.isChecked())
stream = stream.filter(e -> !(e instanceof MerchantEntity));
if (filterGolems.isChecked())
stream = stream.filter(e -> !(e instanceof GolemEntity));
if (filterInvisible.isChecked())
stream = stream.filter(e -> !e.isInvisible());
if (filterNamed.isChecked())
stream = stream.filter(e -> !e.hasCustomName());
if (filterStands.isChecked())
stream = stream.filter(e -> !(e instanceof ArmorStandEntity));
if (filterCrystals.isChecked())
stream = stream.filter(e -> !(e instanceof EndCrystalEntity));
return stream.findFirst().isPresent();
}
use of net.minecraft.entity.decoration.EndCrystalEntity in project Wurst7 by Wurst-Imperium.
the class ClickAuraHack method attack.
private void attack() {
// set entity
ClientPlayerEntity player = MC.player;
ClientWorld world = MC.world;
if (player.getAttackCooldownProgress(0) < 1)
return;
double rangeSq = Math.pow(range.getValue(), 2);
Stream<Entity> stream = StreamSupport.stream(MC.world.getEntities().spliterator(), true).filter(e -> !e.isRemoved()).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)).filter(e -> !WURST.getFriends().contains(e.getEntityName()));
if (fov.getValue() < 360.0)
stream = stream.filter(e -> RotationUtils.getAngleToLookVec(e.getBoundingBox().getCenter()) <= fov.getValue() / 2.0);
if (filterPlayers.isChecked())
stream = stream.filter(e -> !(e instanceof PlayerEntity));
if (filterSleeping.isChecked())
stream = stream.filter(e -> !(e instanceof PlayerEntity && ((PlayerEntity) e).isSleeping()));
if (filterFlying.getValue() > 0)
stream = stream.filter(e -> {
if (!(e instanceof PlayerEntity))
return true;
Box box = e.getBoundingBox();
box = box.union(box.offset(0, -filterFlying.getValue(), 0));
return !world.isSpaceEmpty(box);
});
if (filterMonsters.isChecked())
stream = stream.filter(e -> !(e instanceof Monster));
if (filterPigmen.isChecked())
stream = stream.filter(e -> !(e instanceof ZombifiedPiglinEntity));
if (filterEndermen.isChecked())
stream = stream.filter(e -> !(e instanceof EndermanEntity));
if (filterAnimals.isChecked())
stream = stream.filter(e -> !(e instanceof AnimalEntity || e instanceof AmbientEntity || e instanceof WaterCreatureEntity));
if (filterBabies.isChecked())
stream = stream.filter(e -> !(e instanceof PassiveEntity && ((PassiveEntity) e).isBaby()));
if (filterPets.isChecked())
stream = stream.filter(e -> !(e instanceof TameableEntity && ((TameableEntity) e).isTamed())).filter(e -> !(e instanceof HorseBaseEntity && ((HorseBaseEntity) e).isTame()));
if (filterTraders.isChecked())
stream = stream.filter(e -> !(e instanceof MerchantEntity));
if (filterGolems.isChecked())
stream = stream.filter(e -> !(e instanceof GolemEntity));
if (filterInvisible.isChecked())
stream = stream.filter(e -> !e.isInvisible());
if (filterNamed.isChecked())
stream = stream.filter(e -> !e.hasCustomName());
if (filterStands.isChecked())
stream = stream.filter(e -> !(e instanceof ArmorStandEntity));
if (filterCrystals.isChecked())
stream = stream.filter(e -> !(e instanceof EndCrystalEntity));
Entity target = stream.min(priority.getSelected().comparator).orElse(null);
if (target == null)
return;
WURST.getHax().autoSwordHack.setSlot();
// face entity
Rotation rotation = RotationUtils.getNeededRotations(target.getBoundingBox().getCenter());
PlayerMoveC2SPacket.LookAndOnGround packet = new PlayerMoveC2SPacket.LookAndOnGround(rotation.getYaw(), rotation.getPitch(), MC.player.isOnGround());
MC.player.networkHandler.sendPacket(packet);
// attack entity
WURST.getHax().criticalsHack.doCritical();
MC.interactionManager.attackEntity(player, target);
player.swingHand(Hand.MAIN_HAND);
}
use of net.minecraft.entity.decoration.EndCrystalEntity in project vector-addon by cally72jhb.
the class AutoCityPlus method getCrystals.
private ArrayList<Entity> getCrystals(BlockPos pos) {
ArrayList<BlockPos> crystals = new ArrayList<>();
ArrayList<Entity> entities = new ArrayList<>();
if (canInteract(pos.down()))
crystals.add(pos.down());
for (int i = 0; i <= 1; i++) {
for (BlockPos position : plus) {
if (canInteract(pos.add(position).down(i)))
crystals.add(pos.add(position).down(i));
}
}
for (Entity entity : mc.world.getEntities()) {
if (entity instanceof EndCrystalEntity && crystals.contains(entity.getBlockPos()))
entities.add(entity);
}
entities.sort(Comparator.comparingDouble(entity -> VectorUtils.distance(mc.player.getPos(), Vec3d.ofCenter(entity.getBlockPos()))));
return entities;
}
use of net.minecraft.entity.decoration.EndCrystalEntity in project orion by AntiCope.
the class SurroundPlus method onTick.
@EventHandler
private void onTick(TickEvent.Pre event) {
int bpt = 0;
if ((disableJump.get() && (mc.options.jumpKey.isPressed() || mc.player.input.jumping)) || (disableYchange.get() && mc.player.prevY < mc.player.getY())) {
toggle();
return;
}
if (groundOnly.get() && !mc.player.isOnGround())
return;
if (sneakOnly.get() && !mc.options.sneakKey.isPressed())
return;
if (BlockHelper.isVecComplete(getSurrDesign())) {
if (disableAfter.get()) {
info("Surround Complete.");
toggle();
}
} else {
BlockPos ppos = mc.player.getBlockPos();
for (Vec3d b : getSurrDesign()) {
if (bpt >= blockPerTick.get())
return;
BlockPos bb = ppos.add(b.x, b.y, b.z);
if (BlockHelper.getBlock(bb) == Blocks.AIR) {
if (placeInside.get()) {
BlockUtils.place(bb, InvUtils.findInHotbar(itemStack -> blocks.get().contains(Block.getBlockFromItem(itemStack.getItem()))), rotation.get(), 100, false);
} else {
BlockUtils.place(bb, InvUtils.findInHotbar(itemStack -> blocks.get().contains(Block.getBlockFromItem(itemStack.getItem()))), rotation.get(), 100, true);
}
bpt++;
}
}
}
if (protect.get()) {
for (Entity entity : mc.world.getEntities()) {
if (entity instanceof EndCrystalEntity) {
BlockPos crystalPos = entity.getBlockPos();
if (isDangerousCrystal(crystalPos)) {
mc.player.networkHandler.sendPacket(PlayerInteractEntityC2SPacket.attack(entity, mc.player.isSneaking()));
mc.getNetworkHandler().sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND));
return;
}
}
}
}
}
use of net.minecraft.entity.decoration.EndCrystalEntity in project BleachHack by BleachDrinker420.
the class CrystalAura method onTick.
@BleachSubscribe
public void onTick(EventTick event) {
breakCooldown = Math.max(0, breakCooldown - 1);
placeCooldown = Math.max(0, placeCooldown - 1);
for (Entry<BlockPos, Integer> e : new HashMap<>(blacklist).entrySet()) {
if (e.getValue() > 0) {
blacklist.replace(e.getKey(), e.getValue() - 1);
} else {
blacklist.remove(e.getKey());
}
}
if (mc.player.isUsingItem() && mc.player.getMainHandStack().isFood()) {
return;
}
List<LivingEntity> targets = Streams.stream(mc.world.getEntities()).filter(e -> EntityUtils.isAttackable(e, true)).filter(e -> (getSetting(0).asToggle().getState() && EntityUtils.isPlayer(e)) || (getSetting(1).asToggle().getState() && EntityUtils.isMob(e)) || (getSetting(2).asToggle().getState() && EntityUtils.isAnimal(e))).map(e -> (LivingEntity) e).toList();
if (targets.isEmpty()) {
return;
}
// Explode
SettingToggle explodeToggle = getSetting(3).asToggle();
List<EndCrystalEntity> nearestCrystals = Streams.stream(mc.world.getEntities()).filter(e -> e instanceof EndCrystalEntity).map(e -> (EndCrystalEntity) e).sorted(Comparator.comparing(mc.player::distanceTo)).toList();
int breaks = 0;
if (explodeToggle.getState() && !nearestCrystals.isEmpty() && breakCooldown <= 0) {
boolean end = false;
for (EndCrystalEntity c : nearestCrystals) {
if (mc.player.distanceTo(c) > getSetting(7).asSlider().getValue() || mc.world.getOtherEntities(null, new Box(c.getPos(), c.getPos()).expand(7), targets::contains).isEmpty())
continue;
float damage = DamageUtils.getExplosionDamage(c.getPos(), 6f, mc.player);
if (DamageUtils.willGoBelowHealth(mc.player, damage, explodeToggle.getChild(4).asSlider().getValueFloat()))
continue;
int oldSlot = mc.player.getInventory().selectedSlot;
if (explodeToggle.getChild(0).asToggle().getState() && mc.player.hasStatusEffect(StatusEffects.WEAKNESS)) {
InventoryUtils.selectSlot(false, true, Comparator.comparing(i -> DamageUtils.getItemAttackDamage(mc.player.getInventory().getStack(i))));
}
if (getSetting(6).asRotate().getState()) {
Vec3d eyeVec = mc.player.getEyePos();
Vec3d v = new Vec3d(c.getX(), c.getY() + 0.5, c.getZ());
for (Direction d : Direction.values()) {
Vec3d vd = WorldUtils.getLegitLookPos(c.getBoundingBox(), d, true, 5, -0.001);
if (vd != null && eyeVec.distanceTo(vd) <= eyeVec.distanceTo(v)) {
v = vd;
}
}
WorldUtils.facePosAuto(v.x, v.y, v.z, getSetting(6).asRotate());
}
mc.interactionManager.attackEntity(mc.player, c);
mc.player.swingHand(Hand.MAIN_HAND);
blacklist.remove(c.getBlockPos().down());
InventoryUtils.selectSlot(oldSlot);
end = true;
breaks++;
if (breaks >= explodeToggle.getChild(2).asSlider().getValue()) {
break;
}
}
breakCooldown = explodeToggle.getChild(3).asSlider().getValueInt() + 1;
if (!getSetting(5).asToggle().getState() && end) {
return;
}
}
// Place
SettingToggle placeToggle = getSetting(4).asToggle();
if (placeToggle.getState() && placeCooldown <= 0) {
int crystalSlot = !placeToggle.getChild(0).asToggle().getState() ? (mc.player.getMainHandStack().getItem() == Items.END_CRYSTAL ? mc.player.getInventory().selectedSlot : mc.player.getOffHandStack().getItem() == Items.END_CRYSTAL ? 40 : -1) : InventoryUtils.getSlot(true, i -> mc.player.getInventory().getStack(i).getItem() == Items.END_CRYSTAL);
if (crystalSlot == -1) {
return;
}
Map<BlockPos, Float> placeBlocks = new LinkedHashMap<>();
for (Vec3d v : getCrystalPoses()) {
float playerDamg = DamageUtils.getExplosionDamage(v, 6f, mc.player);
if (DamageUtils.willKill(mc.player, playerDamg))
continue;
for (LivingEntity e : targets) {
float targetDamg = DamageUtils.getExplosionDamage(v, 6f, e);
if (DamageUtils.willPop(mc.player, playerDamg) && !DamageUtils.willPopOrKill(e, targetDamg)) {
continue;
}
if (targetDamg >= placeToggle.getChild(4).asSlider().getValue()) {
float ratio = playerDamg == 0 ? targetDamg : targetDamg / playerDamg;
if (ratio > placeToggle.getChild(5).asSlider().getValue()) {
placeBlocks.put(new BlockPos(v).down(), ratio);
}
}
}
}
placeBlocks = placeBlocks.entrySet().stream().sorted((b1, b2) -> Float.compare(b2.getValue(), b1.getValue())).collect(Collectors.toMap(Entry::getKey, Entry::getValue, (x, y) -> y, LinkedHashMap::new));
int oldSlot = mc.player.getInventory().selectedSlot;
int places = 0;
for (Entry<BlockPos, Float> e : placeBlocks.entrySet()) {
BlockPos block = e.getKey();
Vec3d eyeVec = mc.player.getEyePos();
Vec3d vec = Vec3d.ofCenter(block, 1);
Direction dir = null;
for (Direction d : Direction.values()) {
Vec3d vd = WorldUtils.getLegitLookPos(block, d, true, 5);
if (vd != null && eyeVec.distanceTo(vd) <= eyeVec.distanceTo(vec)) {
vec = vd;
dir = d;
}
}
if (dir == null) {
if (placeToggle.getChild(3).asToggle().getState())
continue;
dir = Direction.UP;
}
if (placeToggle.getChild(2).asToggle().getState())
blacklist.put(block, 4);
if (getSetting(6).asRotate().getState()) {
WorldUtils.facePosAuto(vec.x, vec.y, vec.z, getSetting(6).asRotate());
}
Hand hand = InventoryUtils.selectSlot(crystalSlot);
render = block;
mc.interactionManager.interactBlock(mc.player, mc.world, hand, new BlockHitResult(vec, dir, block, false));
places++;
if (places >= placeToggle.getChild(6).asSlider().getValueInt()) {
break;
}
}
if (places > 0) {
if (placeToggle.getChild(0).asToggle().getState() && placeToggle.getChild(0).asToggle().getChild(0).asToggle().getState()) {
InventoryUtils.selectSlot(oldSlot);
}
placeCooldown = placeToggle.getChild(7).asSlider().getValueInt() + 1;
}
}
}
Aggregations