public static void doLightning(long seed, World world, Entity caster, Vec3d from, Vec3d to, double offshootRange, double potency, double duration)
{
RandUtilSeed rand = new RandUtilSeed(seed);
ArrayList<Vec3d> points = new ArrayList<>();
LightningGenerator.generate(rand, from, to, offshootRange).forEach(point -> points.add(point));
world.playSound(null, new BlockPos(to), ModSounds.LIGHTNING, SoundCategory.NEUTRAL, 0.5f, RandUtil.nextFloat(1, 1.5f));
HashSet<BlockPos> positions = new HashSet<>();
for (Vec3d point : points)
positions.add(new BlockPos(point));
HashSet<EntityLivingBase> entities = new HashSet<>();
for (BlockPos position : positions)
entities.addAll(world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(position).contract(0.2, 0.2, 0.2)));
entities.remove(caster);
for (Entity entity : entities)
LightningTracker.INSTANCE.addEntity(from, entity, caster, potency, duration);
doLightningRender(seed, world, from, to, offshootRange);
}