Search in sources :

Example 1 with EnderPearlEntity

use of net.minecraft.entity.projectile.thrown.EnderPearlEntity in project BleachHack by BleachDrinker420.

the class Trajectories method onTick.

@BleachSubscribe
public void onTick(EventTick event) {
    poses.clear();
    Entity entity = ProjectileSimulator.summonProjectile(mc.player, getSetting(1).asToggle().getState(), getSetting(2).asToggle().getState(), getSetting(3).asToggle().getState());
    if (entity != null) {
        poses.add(ProjectileSimulator.simulate(entity));
    }
    if (getSetting(4).asToggle().getState()) {
        for (Entity e : mc.world.getEntities()) {
            if (e instanceof ThrownEntity || e instanceof PersistentProjectileEntity) {
                if (!getSetting(4).asToggle().getChild(0).asToggle().getState() && (e instanceof SnowballEntity || e instanceof EggEntity || e instanceof EnderPearlEntity)) {
                    continue;
                }
                if (!getSetting(4).asToggle().getChild(1).asToggle().getState() && e instanceof ExperienceBottleEntity) {
                    continue;
                }
                if (!mc.world.getBlockCollisions(e, e.getBoundingBox()).allMatch(VoxelShape::isEmpty))
                    continue;
                Triple<List<Vec3d>, Entity, BlockPos> p = ProjectileSimulator.simulate(e);
                if (p.getLeft().size() >= 2)
                    poses.add(p);
            }
        }
    }
    if (getSetting(5).asToggle().getState()) {
        for (PlayerEntity e : mc.world.getPlayers()) {
            if (e == mc.player)
                continue;
            Entity proj = ProjectileSimulator.summonProjectile(e, getSetting(1).asToggle().getState(), getSetting(2).asToggle().getState(), getSetting(3).asToggle().getState());
            if (proj != null) {
                poses.add(ProjectileSimulator.simulate(proj));
            }
        }
    }
}
Also used : EnderPearlEntity(net.minecraft.entity.projectile.thrown.EnderPearlEntity) PersistentProjectileEntity(net.minecraft.entity.projectile.PersistentProjectileEntity) ThrownEntity(net.minecraft.entity.projectile.thrown.ThrownEntity) ExperienceBottleEntity(net.minecraft.entity.projectile.thrown.ExperienceBottleEntity) EggEntity(net.minecraft.entity.projectile.thrown.EggEntity) Entity(net.minecraft.entity.Entity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) SnowballEntity(net.minecraft.entity.projectile.thrown.SnowballEntity) EnderPearlEntity(net.minecraft.entity.projectile.thrown.EnderPearlEntity) ThrownEntity(net.minecraft.entity.projectile.thrown.ThrownEntity) PersistentProjectileEntity(net.minecraft.entity.projectile.PersistentProjectileEntity) EggEntity(net.minecraft.entity.projectile.thrown.EggEntity) ExperienceBottleEntity(net.minecraft.entity.projectile.thrown.ExperienceBottleEntity) ArrayList(java.util.ArrayList) List(java.util.List) BlockPos(net.minecraft.util.math.BlockPos) SnowballEntity(net.minecraft.entity.projectile.thrown.SnowballEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) BleachSubscribe(org.bleachhack.eventbus.BleachSubscribe)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 Entity (net.minecraft.entity.Entity)1 PlayerEntity (net.minecraft.entity.player.PlayerEntity)1 PersistentProjectileEntity (net.minecraft.entity.projectile.PersistentProjectileEntity)1 EggEntity (net.minecraft.entity.projectile.thrown.EggEntity)1 EnderPearlEntity (net.minecraft.entity.projectile.thrown.EnderPearlEntity)1 ExperienceBottleEntity (net.minecraft.entity.projectile.thrown.ExperienceBottleEntity)1 SnowballEntity (net.minecraft.entity.projectile.thrown.SnowballEntity)1 ThrownEntity (net.minecraft.entity.projectile.thrown.ThrownEntity)1 BlockPos (net.minecraft.util.math.BlockPos)1 BleachSubscribe (org.bleachhack.eventbus.BleachSubscribe)1