Search in sources :

Example 21 with ArmorStandEntity

use of net.minecraft.entity.decoration.ArmorStandEntity in project More-Weaponry by DakotaPride.

the class BardArmorItem method predicate.

// Predicate runs every frame
private <P extends IAnimatable> PlayState predicate(AnimationEvent<P> event) {
    // This is all the extradata this event carries. The livingentity is the entity
    // that's wearing the armor. The itemstack and equipmentslottype are self
    // explanatory.
    LivingEntity livingEntity = event.getExtraDataOfType(LivingEntity.class).get(0);
    // Always loop the animation but later on in this method we'll decide whether or
    // not to actually play it
    event.getController().setAnimation(new AnimationBuilder().addAnimation("idle", true));
    // If the living entity is an armorstand just play the animation nonstop
    if (livingEntity instanceof ArmorStandEntity) {
        return PlayState.CONTINUE;
    } else // full set of armor
    if (livingEntity instanceof PlayerEntity) {
        PlayerEntity player = (PlayerEntity) livingEntity;
        // Get all the equipment, aka the armor, currently held item, and offhand item
        List<Item> equipmentList = new ArrayList<>();
        player.getItemsEquipped().forEach((x) -> equipmentList.add(x.getItem()));
        // elements 2 to 6 are the armor so we take the sublist. Armorlist now only
        // contains the 4 armor slots
        List<Item> armorList = equipmentList.subList(2, 6);
        // Make sure the player is wearing all the armor. If they are, continue playing
        // the animation, otherwise stop
        boolean isWearingAll = armorList.containsAll(Arrays.asList(MoreWeaponryItems.BARD_HELMET, MoreWeaponryItems.BARD_CHESTPLATE));
        return isWearingAll ? PlayState.CONTINUE : PlayState.STOP;
    }
    return PlayState.STOP;
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) ArmorMaterial(net.minecraft.item.ArmorMaterial) AnimationBuilder(software.bernie.geckolib3.core.builder.AnimationBuilder) Arrays(java.util.Arrays) PlayerEntity(net.minecraft.entity.player.PlayerEntity) IAnimatable(software.bernie.geckolib3.core.IAnimatable) AnimationController(software.bernie.geckolib3.core.controller.AnimationController) LivingEntity(net.minecraft.entity.LivingEntity) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity) Item(net.minecraft.item.Item) MoreWeaponryItems(net.DakotaPride.moreweaponry.item.MoreWeaponryItems) AnimationFactory(software.bernie.geckolib3.core.manager.AnimationFactory) ArrayList(java.util.ArrayList) List(java.util.List) AnimationData(software.bernie.geckolib3.core.manager.AnimationData) EquipmentSlot(net.minecraft.entity.EquipmentSlot) AnimationEvent(software.bernie.geckolib3.core.event.predicate.AnimationEvent) ArmorItem(net.minecraft.item.ArmorItem) PlayState(software.bernie.geckolib3.core.PlayState) ArrayList(java.util.ArrayList) List(java.util.List) AnimationBuilder(software.bernie.geckolib3.core.builder.AnimationBuilder) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Example 22 with ArmorStandEntity

use of net.minecraft.entity.decoration.ArmorStandEntity in project Wurst7 by Wurst-Imperium.

the class TpAuraHack method onUpdate.

@Override
public void onUpdate() {
    ClientPlayerEntity player = MC.player;
    // set entity
    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 (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 !MC.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 entity = stream.min(priority.getSelected().comparator).orElse(null);
    if (entity == null)
        return;
    WURST.getHax().autoSwordHack.setSlot();
    // teleport
    player.setPosition(entity.getX() + random.nextInt(3) * 2 - 2, entity.getY(), entity.getZ() + random.nextInt(3) * 2 - 2);
    // check cooldown
    if (player.getAttackCooldownProgress(0) < 1)
        return;
    // attack entity
    RotationUtils.Rotation rotations = RotationUtils.getNeededRotations(entity.getBoundingBox().getCenter());
    WurstClient.MC.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookAndOnGround(rotations.getYaw(), rotations.getPitch(), MC.player.isOnGround()));
    WURST.getHax().criticalsHack.doCritical();
    MC.interactionManager.attackEntity(player, entity);
    player.swingHand(Hand.MAIN_HAND);
}
Also used : Category(net.wurstclient.Category) GolemEntity(net.minecraft.entity.passive.GolemEntity) AmbientEntity(net.minecraft.entity.mob.AmbientEntity) Random(java.util.Random) MerchantEntity(net.minecraft.entity.passive.MerchantEntity) SearchTags(net.wurstclient.SearchTags) ValueDisplay(net.wurstclient.settings.SliderSetting.ValueDisplay) RotationUtils(net.wurstclient.util.RotationUtils) EnumSetting(net.wurstclient.settings.EnumSetting) StreamSupport(java.util.stream.StreamSupport) Hand(net.minecraft.util.Hand) AnimalEntity(net.minecraft.entity.passive.AnimalEntity) Entity(net.minecraft.entity.Entity) EndCrystalEntity(net.minecraft.entity.decoration.EndCrystalEntity) PassiveEntity(net.minecraft.entity.passive.PassiveEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) LivingEntity(net.minecraft.entity.LivingEntity) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity) Box(net.minecraft.util.math.Box) Hack(net.wurstclient.hack.Hack) FakePlayerEntity(net.wurstclient.util.FakePlayerEntity) SliderSetting(net.wurstclient.settings.SliderSetting) WaterCreatureEntity(net.minecraft.entity.mob.WaterCreatureEntity) Stream(java.util.stream.Stream) CheckboxSetting(net.wurstclient.settings.CheckboxSetting) Monster(net.minecraft.entity.mob.Monster) WurstClient(net.wurstclient.WurstClient) ToDoubleFunction(java.util.function.ToDoubleFunction) UpdateListener(net.wurstclient.events.UpdateListener) EndermanEntity(net.minecraft.entity.mob.EndermanEntity) PlayerMoveC2SPacket(net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket) ClientPlayerEntity(net.minecraft.client.network.ClientPlayerEntity) Comparator(java.util.Comparator) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity) ZombifiedPiglinEntity(net.minecraft.entity.mob.ZombifiedPiglinEntity) TameableEntity(net.minecraft.entity.passive.TameableEntity) GolemEntity(net.minecraft.entity.passive.GolemEntity) AmbientEntity(net.minecraft.entity.mob.AmbientEntity) MerchantEntity(net.minecraft.entity.passive.MerchantEntity) AnimalEntity(net.minecraft.entity.passive.AnimalEntity) Entity(net.minecraft.entity.Entity) EndCrystalEntity(net.minecraft.entity.decoration.EndCrystalEntity) PassiveEntity(net.minecraft.entity.passive.PassiveEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) LivingEntity(net.minecraft.entity.LivingEntity) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity) FakePlayerEntity(net.wurstclient.util.FakePlayerEntity) WaterCreatureEntity(net.minecraft.entity.mob.WaterCreatureEntity) EndermanEntity(net.minecraft.entity.mob.EndermanEntity) ClientPlayerEntity(net.minecraft.client.network.ClientPlayerEntity) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity) ZombifiedPiglinEntity(net.minecraft.entity.mob.ZombifiedPiglinEntity) TameableEntity(net.minecraft.entity.passive.TameableEntity) AnimalEntity(net.minecraft.entity.passive.AnimalEntity) PlayerMoveC2SPacket(net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket) GolemEntity(net.minecraft.entity.passive.GolemEntity) RotationUtils(net.wurstclient.util.RotationUtils) FakePlayerEntity(net.wurstclient.util.FakePlayerEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) FakePlayerEntity(net.wurstclient.util.FakePlayerEntity) ClientPlayerEntity(net.minecraft.client.network.ClientPlayerEntity) LivingEntity(net.minecraft.entity.LivingEntity) EndCrystalEntity(net.minecraft.entity.decoration.EndCrystalEntity) ZombifiedPiglinEntity(net.minecraft.entity.mob.ZombifiedPiglinEntity) AmbientEntity(net.minecraft.entity.mob.AmbientEntity) Monster(net.minecraft.entity.mob.Monster) ClientPlayerEntity(net.minecraft.client.network.ClientPlayerEntity) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity) TameableEntity(net.minecraft.entity.passive.TameableEntity) MerchantEntity(net.minecraft.entity.passive.MerchantEntity) Box(net.minecraft.util.math.Box) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity) WaterCreatureEntity(net.minecraft.entity.mob.WaterCreatureEntity) EndermanEntity(net.minecraft.entity.mob.EndermanEntity) PassiveEntity(net.minecraft.entity.passive.PassiveEntity)

Example 23 with ArmorStandEntity

use of net.minecraft.entity.decoration.ArmorStandEntity in project Wurst7 by Wurst-Imperium.

the class FightBotHack method onUpdate.

@Override
public void onUpdate() {
    // set entity
    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 -> e != MC.player).filter(e -> !(e instanceof FakePlayerEntity));
    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 !MC.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 entity = stream.min(Comparator.comparingDouble(e -> MC.player.squaredDistanceTo(e))).orElse(null);
    if (entity == null)
        return;
    WURST.getHax().autoSwordHack.setSlot();
    if (useAi.isChecked()) {
        // reset pathfinder
        if ((processor == null || processor.isDone() || ticksProcessing >= 10 || !pathFinder.isPathStillValid(processor.getIndex())) && (pathFinder.isDone() || pathFinder.isFailed())) {
            pathFinder = new EntityPathFinder(entity);
            processor = null;
            ticksProcessing = 0;
        }
        // find path
        if (!pathFinder.isDone() && !pathFinder.isFailed()) {
            PathProcessor.lockControls();
            WURST.getRotationFaker().faceVectorClient(entity.getBoundingBox().getCenter());
            pathFinder.think();
            pathFinder.formatPath();
            processor = pathFinder.getProcessor();
        }
        // process path
        if (!processor.isDone()) {
            processor.process();
            ticksProcessing++;
        }
    } else {
        // jump if necessary
        if (MC.player.horizontalCollision && MC.player.isOnGround())
            MC.player.jump();
        // swim up if necessary
        if (MC.player.isTouchingWater() && MC.player.getY() < entity.getY())
            MC.player.addVelocity(0, 0.04, 0);
        // control height if flying
        if (!MC.player.isOnGround() && (MC.player.getAbilities().flying || WURST.getHax().flightHack.isEnabled()) && MC.player.squaredDistanceTo(entity.getX(), MC.player.getY(), entity.getZ()) <= MC.player.squaredDistanceTo(MC.player.getX(), entity.getY(), MC.player.getZ())) {
            if (MC.player.getY() > entity.getY() + 1D)
                MC.options.sneakKey.setPressed(true);
            else if (MC.player.getY() < entity.getY() - 1D)
                MC.options.jumpKey.setPressed(true);
        } else {
            MC.options.sneakKey.setPressed(false);
            MC.options.jumpKey.setPressed(false);
        }
        // follow entity
        MC.options.forwardKey.setPressed(MC.player.distanceTo(entity) > distance.getValueF());
        WURST.getRotationFaker().faceVectorClient(entity.getBoundingBox().getCenter());
    }
    // check cooldown
    if (MC.player.getAttackCooldownProgress(0) < 1)
        return;
    // check range
    if (MC.player.squaredDistanceTo(entity) > Math.pow(range.getValue(), 2))
        return;
    // attack entity
    WURST.getHax().criticalsHack.doCritical();
    MC.interactionManager.attackEntity(MC.player, entity);
    MC.player.swingHand(Hand.MAIN_HAND);
}
Also used : Category(net.wurstclient.Category) GolemEntity(net.minecraft.entity.passive.GolemEntity) AmbientEntity(net.minecraft.entity.mob.AmbientEntity) MerchantEntity(net.minecraft.entity.passive.MerchantEntity) SearchTags(net.wurstclient.SearchTags) ArrayList(java.util.ArrayList) ValueDisplay(net.wurstclient.settings.SliderSetting.ValueDisplay) Vec3d(net.minecraft.util.math.Vec3d) StreamSupport(java.util.stream.StreamSupport) Hand(net.minecraft.util.Hand) RenderListener(net.wurstclient.events.RenderListener) AnimalEntity(net.minecraft.entity.passive.AnimalEntity) Entity(net.minecraft.entity.Entity) EndCrystalEntity(net.minecraft.entity.decoration.EndCrystalEntity) PassiveEntity(net.minecraft.entity.passive.PassiveEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) PathFinder(net.wurstclient.ai.PathFinder) LivingEntity(net.minecraft.entity.LivingEntity) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity) Box(net.minecraft.util.math.Box) GameRenderer(net.minecraft.client.render.GameRenderer) MatrixStack(net.minecraft.client.util.math.MatrixStack) BlockPos(net.minecraft.util.math.BlockPos) Hack(net.wurstclient.hack.Hack) FakePlayerEntity(net.wurstclient.util.FakePlayerEntity) PathCmd(net.wurstclient.commands.PathCmd) SliderSetting(net.wurstclient.settings.SliderSetting) WaterCreatureEntity(net.minecraft.entity.mob.WaterCreatureEntity) PathPos(net.wurstclient.ai.PathPos) Stream(java.util.stream.Stream) CheckboxSetting(net.wurstclient.settings.CheckboxSetting) Monster(net.minecraft.entity.mob.Monster) RenderSystem(com.mojang.blaze3d.systems.RenderSystem) PathProcessor(net.wurstclient.ai.PathProcessor) UpdateListener(net.wurstclient.events.UpdateListener) EndermanEntity(net.minecraft.entity.mob.EndermanEntity) DontSaveState(net.wurstclient.hack.DontSaveState) Comparator(java.util.Comparator) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity) ZombifiedPiglinEntity(net.minecraft.entity.mob.ZombifiedPiglinEntity) TameableEntity(net.minecraft.entity.passive.TameableEntity) GolemEntity(net.minecraft.entity.passive.GolemEntity) AmbientEntity(net.minecraft.entity.mob.AmbientEntity) MerchantEntity(net.minecraft.entity.passive.MerchantEntity) AnimalEntity(net.minecraft.entity.passive.AnimalEntity) Entity(net.minecraft.entity.Entity) EndCrystalEntity(net.minecraft.entity.decoration.EndCrystalEntity) PassiveEntity(net.minecraft.entity.passive.PassiveEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) LivingEntity(net.minecraft.entity.LivingEntity) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity) FakePlayerEntity(net.wurstclient.util.FakePlayerEntity) WaterCreatureEntity(net.minecraft.entity.mob.WaterCreatureEntity) EndermanEntity(net.minecraft.entity.mob.EndermanEntity) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity) ZombifiedPiglinEntity(net.minecraft.entity.mob.ZombifiedPiglinEntity) TameableEntity(net.minecraft.entity.passive.TameableEntity) TameableEntity(net.minecraft.entity.passive.TameableEntity) MerchantEntity(net.minecraft.entity.passive.MerchantEntity) AnimalEntity(net.minecraft.entity.passive.AnimalEntity) Box(net.minecraft.util.math.Box) GolemEntity(net.minecraft.entity.passive.GolemEntity) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity) WaterCreatureEntity(net.minecraft.entity.mob.WaterCreatureEntity) FakePlayerEntity(net.wurstclient.util.FakePlayerEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) FakePlayerEntity(net.wurstclient.util.FakePlayerEntity) LivingEntity(net.minecraft.entity.LivingEntity) EndCrystalEntity(net.minecraft.entity.decoration.EndCrystalEntity) ZombifiedPiglinEntity(net.minecraft.entity.mob.ZombifiedPiglinEntity) AmbientEntity(net.minecraft.entity.mob.AmbientEntity) Monster(net.minecraft.entity.mob.Monster) EndermanEntity(net.minecraft.entity.mob.EndermanEntity) PassiveEntity(net.minecraft.entity.passive.PassiveEntity) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity)

Example 24 with ArmorStandEntity

use of net.minecraft.entity.decoration.ArmorStandEntity in project Wurst7 by Wurst-Imperium.

the class ProtectHack method onUpdate.

@Override
public void onUpdate() {
    // check if player died, friend died or disappeared
    if (friend == null || friend.isRemoved() || !(friend instanceof LivingEntity) || ((LivingEntity) friend).getHealth() <= 0 || MC.player.getHealth() <= 0) {
        friend = null;
        enemy = null;
        setEnabled(false);
        return;
    }
    // set enemy
    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 -> e != MC.player).filter(e -> e != friend).filter(e -> MC.player.distanceTo(e) <= 6).filter(e -> !(e instanceof FakePlayerEntity));
    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 !MC.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));
    enemy = stream.min(Comparator.comparingDouble(e -> MC.player.squaredDistanceTo(e))).orElse(null);
    Entity target = enemy == null || MC.player.squaredDistanceTo(friend) >= 24 * 24 ? friend : enemy;
    double distance = target == enemy ? distanceE : distanceF;
    if (useAi.isChecked()) {
        // reset pathfinder
        if ((processor == null || processor.isDone() || ticksProcessing >= 10 || !pathFinder.isPathStillValid(processor.getIndex())) && (pathFinder.isDone() || pathFinder.isFailed())) {
            pathFinder = new EntityPathFinder(target, distance);
            processor = null;
            ticksProcessing = 0;
        }
        // find path
        if (!pathFinder.isDone() && !pathFinder.isFailed()) {
            PathProcessor.lockControls();
            WURST.getRotationFaker().faceVectorClient(target.getBoundingBox().getCenter());
            pathFinder.think();
            pathFinder.formatPath();
            processor = pathFinder.getProcessor();
        }
        // process path
        if (!processor.isDone()) {
            processor.process();
            ticksProcessing++;
        }
    } else {
        // jump if necessary
        if (MC.player.horizontalCollision && MC.player.isOnGround())
            MC.player.jump();
        // swim up if necessary
        if (MC.player.isTouchingWater() && MC.player.getY() < target.getY())
            MC.player.addVelocity(0, 0.04, 0);
        // control height if flying
        if (!MC.player.isOnGround() && (MC.player.getAbilities().flying || WURST.getHax().flightHack.isEnabled()) && MC.player.squaredDistanceTo(target.getX(), MC.player.getY(), target.getZ()) <= MC.player.squaredDistanceTo(MC.player.getX(), target.getY(), MC.player.getZ())) {
            if (MC.player.getY() > target.getY() + 1D)
                MC.options.sneakKey.setPressed(true);
            else if (MC.player.getY() < target.getY() - 1D)
                MC.options.jumpKey.setPressed(true);
        } else {
            MC.options.sneakKey.setPressed(false);
            MC.options.jumpKey.setPressed(false);
        }
        // follow target
        WURST.getRotationFaker().faceVectorClient(target.getBoundingBox().getCenter());
        MC.options.forwardKey.setPressed(MC.player.distanceTo(target) > (target == friend ? distanceF : distanceE));
    }
    if (target == enemy) {
        WURST.getHax().autoSwordHack.setSlot();
        // check cooldown
        if (MC.player.getAttackCooldownProgress(0) < 1)
            return;
        // attack enemy
        WURST.getHax().criticalsHack.doCritical();
        MC.interactionManager.attackEntity(MC.player, enemy);
        MC.player.swingHand(Hand.MAIN_HAND);
    }
}
Also used : Category(net.wurstclient.Category) GolemEntity(net.minecraft.entity.passive.GolemEntity) AmbientEntity(net.minecraft.entity.mob.AmbientEntity) MerchantEntity(net.minecraft.entity.passive.MerchantEntity) ArrayList(java.util.ArrayList) ValueDisplay(net.wurstclient.settings.SliderSetting.ValueDisplay) Vec3d(net.minecraft.util.math.Vec3d) StreamSupport(java.util.stream.StreamSupport) Hand(net.minecraft.util.Hand) RenderListener(net.wurstclient.events.RenderListener) AnimalEntity(net.minecraft.entity.passive.AnimalEntity) Entity(net.minecraft.entity.Entity) EndCrystalEntity(net.minecraft.entity.decoration.EndCrystalEntity) PassiveEntity(net.minecraft.entity.passive.PassiveEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) PathFinder(net.wurstclient.ai.PathFinder) LivingEntity(net.minecraft.entity.LivingEntity) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity) Box(net.minecraft.util.math.Box) MatrixStack(net.minecraft.client.util.math.MatrixStack) BlockPos(net.minecraft.util.math.BlockPos) Hack(net.wurstclient.hack.Hack) FakePlayerEntity(net.wurstclient.util.FakePlayerEntity) PathCmd(net.wurstclient.commands.PathCmd) SliderSetting(net.wurstclient.settings.SliderSetting) WaterCreatureEntity(net.minecraft.entity.mob.WaterCreatureEntity) PathPos(net.wurstclient.ai.PathPos) Stream(java.util.stream.Stream) CheckboxSetting(net.wurstclient.settings.CheckboxSetting) Monster(net.minecraft.entity.mob.Monster) PathProcessor(net.wurstclient.ai.PathProcessor) UpdateListener(net.wurstclient.events.UpdateListener) EndermanEntity(net.minecraft.entity.mob.EndermanEntity) DontSaveState(net.wurstclient.hack.DontSaveState) Comparator(java.util.Comparator) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity) ZombifiedPiglinEntity(net.minecraft.entity.mob.ZombifiedPiglinEntity) TameableEntity(net.minecraft.entity.passive.TameableEntity) GolemEntity(net.minecraft.entity.passive.GolemEntity) AmbientEntity(net.minecraft.entity.mob.AmbientEntity) MerchantEntity(net.minecraft.entity.passive.MerchantEntity) AnimalEntity(net.minecraft.entity.passive.AnimalEntity) Entity(net.minecraft.entity.Entity) EndCrystalEntity(net.minecraft.entity.decoration.EndCrystalEntity) PassiveEntity(net.minecraft.entity.passive.PassiveEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) LivingEntity(net.minecraft.entity.LivingEntity) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity) FakePlayerEntity(net.wurstclient.util.FakePlayerEntity) WaterCreatureEntity(net.minecraft.entity.mob.WaterCreatureEntity) EndermanEntity(net.minecraft.entity.mob.EndermanEntity) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity) ZombifiedPiglinEntity(net.minecraft.entity.mob.ZombifiedPiglinEntity) TameableEntity(net.minecraft.entity.passive.TameableEntity) TameableEntity(net.minecraft.entity.passive.TameableEntity) MerchantEntity(net.minecraft.entity.passive.MerchantEntity) AnimalEntity(net.minecraft.entity.passive.AnimalEntity) Box(net.minecraft.util.math.Box) GolemEntity(net.minecraft.entity.passive.GolemEntity) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity) WaterCreatureEntity(net.minecraft.entity.mob.WaterCreatureEntity) FakePlayerEntity(net.wurstclient.util.FakePlayerEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) FakePlayerEntity(net.wurstclient.util.FakePlayerEntity) LivingEntity(net.minecraft.entity.LivingEntity) EndCrystalEntity(net.minecraft.entity.decoration.EndCrystalEntity) ZombifiedPiglinEntity(net.minecraft.entity.mob.ZombifiedPiglinEntity) AmbientEntity(net.minecraft.entity.mob.AmbientEntity) Monster(net.minecraft.entity.mob.Monster) EndermanEntity(net.minecraft.entity.mob.EndermanEntity) PassiveEntity(net.minecraft.entity.passive.PassiveEntity) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity)

Example 25 with ArmorStandEntity

use of net.minecraft.entity.decoration.ArmorStandEntity in project Wurst7 by Wurst-Imperium.

the class RemoteViewHack method onEnable.

@Override
public void onEnable() {
    // find entity if not already set
    if (entity == null) {
        Stream<Entity> stream = StreamSupport.stream(MC.world.getEntities().spliterator(), true).filter(e -> e instanceof LivingEntity).filter(e -> !e.isRemoved() && ((LivingEntity) e).getHealth() > 0).filter(e -> e != MC.player).filter(e -> !(e instanceof FakePlayerEntity));
        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 !MC.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 (filterStands.isChecked())
            stream = stream.filter(e -> !(e instanceof ArmorStandEntity));
        entity = stream.min(Comparator.comparingDouble(e -> MC.player.squaredDistanceTo(e))).orElse(null);
        // check if entity was found
        if (entity == null) {
            ChatUtils.error("Could not find a valid entity.");
            setEnabled(false);
            return;
        }
    }
    // save old data
    wasInvisible = entity.isInvisibleTo(MC.player);
    // enable NoClip
    MC.player.noClip = true;
    // spawn fake player
    fakePlayer = new FakePlayerEntity();
    // success message
    ChatUtils.message("Now viewing " + entity.getName().getString() + ".");
    // add listener
    EVENTS.add(UpdateListener.class, this);
    EVENTS.add(PacketOutputListener.class, this);
}
Also used : Category(net.wurstclient.Category) GolemEntity(net.minecraft.entity.passive.GolemEntity) AmbientEntity(net.minecraft.entity.mob.AmbientEntity) ChatUtils(net.wurstclient.util.ChatUtils) MerchantEntity(net.minecraft.entity.passive.MerchantEntity) SearchTags(net.wurstclient.SearchTags) ValueDisplay(net.wurstclient.settings.SliderSetting.ValueDisplay) Vec3d(net.minecraft.util.math.Vec3d) StreamSupport(java.util.stream.StreamSupport) AnimalEntity(net.minecraft.entity.passive.AnimalEntity) Entity(net.minecraft.entity.Entity) PassiveEntity(net.minecraft.entity.passive.PassiveEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) LivingEntity(net.minecraft.entity.LivingEntity) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity) Box(net.minecraft.util.math.Box) Hack(net.wurstclient.hack.Hack) FakePlayerEntity(net.wurstclient.util.FakePlayerEntity) SliderSetting(net.wurstclient.settings.SliderSetting) WaterCreatureEntity(net.minecraft.entity.mob.WaterCreatureEntity) Stream(java.util.stream.Stream) CheckboxSetting(net.wurstclient.settings.CheckboxSetting) Monster(net.minecraft.entity.mob.Monster) UpdateListener(net.wurstclient.events.UpdateListener) EndermanEntity(net.minecraft.entity.mob.EndermanEntity) PlayerMoveC2SPacket(net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket) PacketOutputListener(net.wurstclient.events.PacketOutputListener) DontSaveState(net.wurstclient.hack.DontSaveState) Comparator(java.util.Comparator) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity) ZombifiedPiglinEntity(net.minecraft.entity.mob.ZombifiedPiglinEntity) TameableEntity(net.minecraft.entity.passive.TameableEntity) GolemEntity(net.minecraft.entity.passive.GolemEntity) AmbientEntity(net.minecraft.entity.mob.AmbientEntity) MerchantEntity(net.minecraft.entity.passive.MerchantEntity) AnimalEntity(net.minecraft.entity.passive.AnimalEntity) Entity(net.minecraft.entity.Entity) PassiveEntity(net.minecraft.entity.passive.PassiveEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) LivingEntity(net.minecraft.entity.LivingEntity) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity) FakePlayerEntity(net.wurstclient.util.FakePlayerEntity) WaterCreatureEntity(net.minecraft.entity.mob.WaterCreatureEntity) EndermanEntity(net.minecraft.entity.mob.EndermanEntity) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity) ZombifiedPiglinEntity(net.minecraft.entity.mob.ZombifiedPiglinEntity) TameableEntity(net.minecraft.entity.passive.TameableEntity) TameableEntity(net.minecraft.entity.passive.TameableEntity) MerchantEntity(net.minecraft.entity.passive.MerchantEntity) AnimalEntity(net.minecraft.entity.passive.AnimalEntity) Box(net.minecraft.util.math.Box) GolemEntity(net.minecraft.entity.passive.GolemEntity) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity) WaterCreatureEntity(net.minecraft.entity.mob.WaterCreatureEntity) FakePlayerEntity(net.wurstclient.util.FakePlayerEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) FakePlayerEntity(net.wurstclient.util.FakePlayerEntity) LivingEntity(net.minecraft.entity.LivingEntity) ZombifiedPiglinEntity(net.minecraft.entity.mob.ZombifiedPiglinEntity) AmbientEntity(net.minecraft.entity.mob.AmbientEntity) Monster(net.minecraft.entity.mob.Monster) EndermanEntity(net.minecraft.entity.mob.EndermanEntity) PassiveEntity(net.minecraft.entity.passive.PassiveEntity) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity)

Aggregations

ArmorStandEntity (net.minecraft.entity.decoration.ArmorStandEntity)32 LivingEntity (net.minecraft.entity.LivingEntity)26 PlayerEntity (net.minecraft.entity.player.PlayerEntity)22 Entity (net.minecraft.entity.Entity)15 ArrayList (java.util.ArrayList)12 Monster (net.minecraft.entity.mob.Monster)11 Box (net.minecraft.util.math.Box)11 HorseBaseEntity (net.minecraft.entity.passive.HorseBaseEntity)10 TameableEntity (net.minecraft.entity.passive.TameableEntity)10 AnimationBuilder (software.bernie.geckolib3.core.builder.AnimationBuilder)10 Stream (java.util.stream.Stream)9 AmbientEntity (net.minecraft.entity.mob.AmbientEntity)9 EndermanEntity (net.minecraft.entity.mob.EndermanEntity)9 WaterCreatureEntity (net.minecraft.entity.mob.WaterCreatureEntity)9 ZombifiedPiglinEntity (net.minecraft.entity.mob.ZombifiedPiglinEntity)9 AnimalEntity (net.minecraft.entity.passive.AnimalEntity)9 GolemEntity (net.minecraft.entity.passive.GolemEntity)9 MerchantEntity (net.minecraft.entity.passive.MerchantEntity)9 PassiveEntity (net.minecraft.entity.passive.PassiveEntity)9 Hand (net.minecraft.util.Hand)9