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;
}
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);
}
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);
}
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);
}
}
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);
}
Aggregations