Entity entity = null;
List<Entity> list = worldObj.getLoadedEntityList();
for (Entity entity1 : list)
{
if ((entity1 != this && entity1 != this.riddenByEntity))
{
Vec3 vec3 = this.getLook(2.0F).normalize();
Vec3 vec31 = Vec3.createVectorHelper(entity1.posX - this.posX, entity1.posY - (this.posY + 1), entity1.posZ - this.posZ);
double d0 = vec31.lengthVector();
vec31 = vec31.normalize();
double d1 = vec3.dotProduct(vec31);
if ( d1 > 1.0D - 0.025D / d0 &&
this.worldObj.rayTraceBlocks(Vec3.createVectorHelper(this.posX, this.posY + 1, this.posZ), Vec3.createVectorHelper(entity1.posX, entity1.posY + ((entity1.boundingBox.maxY - entity1.boundingBox.minY) / 2), entity1.posZ)) == null &&
d0 < 128D)
{entity = entity1;}
}
}