Search in sources :

Example 6 with ArmorStandEntity

use of net.minecraft.entity.decoration.ArmorStandEntity 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();
}
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) ValueDisplay(net.wurstclient.settings.SliderSetting.ValueDisplay) 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) EntityHitResult(net.minecraft.util.hit.EntityHitResult) 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) ClientPlayerEntity(net.minecraft.client.network.ClientPlayerEntity) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity) ZombifiedPiglinEntity(net.minecraft.entity.mob.ZombifiedPiglinEntity) TameableEntity(net.minecraft.entity.passive.TameableEntity) ClientWorld(net.minecraft.client.world.ClientWorld) 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) 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) 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) EndermanEntity(net.minecraft.entity.mob.EndermanEntity) PassiveEntity(net.minecraft.entity.passive.PassiveEntity) ClientWorld(net.minecraft.client.world.ClientWorld) ClientPlayerEntity(net.minecraft.client.network.ClientPlayerEntity) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity)

Example 7 with ArmorStandEntity

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

the class BowAimbotHack method filterEntities.

private Entity filterEntities(Stream<Entity> s) {
    Stream<Entity> stream = s.filter(e -> e != null && !e.isRemoved()).filter(e -> e instanceof LivingEntity && ((LivingEntity) e).getHealth() > 0 || e instanceof EndCrystalEntity).filter(e -> e != MC.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));
    return stream.min(priority.getSelected().comparator).orElse(null);
}
Also used : Color(java.awt.Color) Category(net.wurstclient.Category) GolemEntity(net.minecraft.entity.passive.GolemEntity) AmbientEntity(net.minecraft.entity.mob.AmbientEntity) Item(net.minecraft.item.Item) GUIRenderListener(net.wurstclient.events.GUIRenderListener) MerchantEntity(net.minecraft.entity.passive.MerchantEntity) SearchTags(net.wurstclient.SearchTags) VertexFormat(net.minecraft.client.render.VertexFormat) BufferRenderer(net.minecraft.client.render.BufferRenderer) GL11(org.lwjgl.opengl.GL11) RenderListener(net.wurstclient.events.RenderListener) VertexFormats(net.minecraft.client.render.VertexFormats) Tessellator(net.minecraft.client.render.Tessellator) EndCrystalEntity(net.minecraft.entity.decoration.EndCrystalEntity) Matrix4f(net.minecraft.util.math.Matrix4f) PassiveEntity(net.minecraft.entity.passive.PassiveEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) CrossbowItem(net.minecraft.item.CrossbowItem) LivingEntity(net.minecraft.entity.LivingEntity) GameRenderer(net.minecraft.client.render.GameRenderer) MatrixStack(net.minecraft.client.util.math.MatrixStack) Hack(net.wurstclient.hack.Hack) FakePlayerEntity(net.wurstclient.util.FakePlayerEntity) Window(net.minecraft.client.util.Window) Stream(java.util.stream.Stream) Monster(net.minecraft.entity.mob.Monster) ToDoubleFunction(java.util.function.ToDoubleFunction) BufferBuilder(net.minecraft.client.render.BufferBuilder) UpdateListener(net.wurstclient.events.UpdateListener) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity) ZombifiedPiglinEntity(net.minecraft.entity.mob.ZombifiedPiglinEntity) TameableEntity(net.minecraft.entity.passive.TameableEntity) ColorSetting(net.wurstclient.settings.ColorSetting) ValueDisplay(net.wurstclient.settings.SliderSetting.ValueDisplay) ItemStack(net.minecraft.item.ItemStack) RotationUtils(net.wurstclient.util.RotationUtils) EnumSetting(net.wurstclient.settings.EnumSetting) StreamSupport(java.util.stream.StreamSupport) BowItem(net.minecraft.item.BowItem) AnimalEntity(net.minecraft.entity.passive.AnimalEntity) Entity(net.minecraft.entity.Entity) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity) Box(net.minecraft.util.math.Box) SliderSetting(net.wurstclient.settings.SliderSetting) WaterCreatureEntity(net.minecraft.entity.mob.WaterCreatureEntity) CheckboxSetting(net.wurstclient.settings.CheckboxSetting) RenderSystem(com.mojang.blaze3d.systems.RenderSystem) EndermanEntity(net.minecraft.entity.mob.EndermanEntity) ClientPlayerEntity(net.minecraft.client.network.ClientPlayerEntity) Comparator(java.util.Comparator) RenderUtils(net.wurstclient.util.RenderUtils) GolemEntity(net.minecraft.entity.passive.GolemEntity) AmbientEntity(net.minecraft.entity.mob.AmbientEntity) MerchantEntity(net.minecraft.entity.passive.MerchantEntity) EndCrystalEntity(net.minecraft.entity.decoration.EndCrystalEntity) PassiveEntity(net.minecraft.entity.passive.PassiveEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) LivingEntity(net.minecraft.entity.LivingEntity) FakePlayerEntity(net.wurstclient.util.FakePlayerEntity) HorseBaseEntity(net.minecraft.entity.passive.HorseBaseEntity) ZombifiedPiglinEntity(net.minecraft.entity.mob.ZombifiedPiglinEntity) TameableEntity(net.minecraft.entity.passive.TameableEntity) AnimalEntity(net.minecraft.entity.passive.AnimalEntity) Entity(net.minecraft.entity.Entity) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity) WaterCreatureEntity(net.minecraft.entity.mob.WaterCreatureEntity) EndermanEntity(net.minecraft.entity.mob.EndermanEntity) ClientPlayerEntity(net.minecraft.client.network.ClientPlayerEntity) 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) 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) EndermanEntity(net.minecraft.entity.mob.EndermanEntity) PassiveEntity(net.minecraft.entity.passive.PassiveEntity) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity)

Example 8 with ArmorStandEntity

use of net.minecraft.entity.decoration.ArmorStandEntity 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);
}
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) 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) LeftClickListener(net.wurstclient.events.LeftClickListener) 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) Rotation(net.wurstclient.util.RotationUtils.Rotation) 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) 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) ClientWorld(net.minecraft.client.world.ClientWorld) 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) 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) Rotation(net.wurstclient.util.RotationUtils.Rotation) WaterCreatureEntity(net.minecraft.entity.mob.WaterCreatureEntity) EndermanEntity(net.minecraft.entity.mob.EndermanEntity) PassiveEntity(net.minecraft.entity.passive.PassiveEntity) ClientWorld(net.minecraft.client.world.ClientWorld)

Example 9 with ArmorStandEntity

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

the class WatcherArmorItem 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.WATCHER_HELMET, MoreWeaponryItems.WATCHER_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 10 with ArmorStandEntity

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

the class CracklerArmorItem method predicate.

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.CRACKLER_HELMET, MoreWeaponryItems.CRACKLER_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)

Aggregations

ArmorStandEntity (net.minecraft.entity.decoration.ArmorStandEntity)25 LivingEntity (net.minecraft.entity.LivingEntity)23 PlayerEntity (net.minecraft.entity.player.PlayerEntity)20 Entity (net.minecraft.entity.Entity)13 ArrayList (java.util.ArrayList)11 Monster (net.minecraft.entity.mob.Monster)10 HorseBaseEntity (net.minecraft.entity.passive.HorseBaseEntity)10 TameableEntity (net.minecraft.entity.passive.TameableEntity)10 Box (net.minecraft.util.math.Box)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 Category (net.wurstclient.Category)9