|
@@ -459,9 +459,9 @@ public class Utils
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
- public static List<Entity> getEntitiesExcluding(Entity ent, World w, BlockPos pos, BlockPos pos2)
|
|
|
+ public static List<Entity> getEntitiesExcluding(Entity ent, World w, double x1, double y1, double z1, double x2, double y2, double z2)
|
|
|
{
|
|
|
- return w.getEntitiesWithinAABBExcludingEntity(ent, new AxisAlignedBB(pos, pos2).grow(1));
|
|
|
+ return w.getEntitiesWithinAABBExcludingEntity(ent, new AxisAlignedBB(x1, y1, z1, x2, y2, z2));
|
|
|
}
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
@@ -554,7 +554,7 @@ public class Utils
|
|
|
double radius, double mX, double mY, double mZ, Class<T> type)
|
|
|
{
|
|
|
World w = p.getEntityWorld();
|
|
|
- BlockPos l = getPlayerTarget(p, radius);
|
|
|
+ Vec3d l = getPlayerTargetVector(p, radius, false);
|
|
|
Vec3d eye = getEyeLocation(p);
|
|
|
if(mX != 0 || mY != 0 || mZ != 0)
|
|
|
{
|
|
@@ -563,9 +563,9 @@ public class Utils
|
|
|
mY *= r.nextDouble();
|
|
|
mZ *= r.nextDouble();
|
|
|
}
|
|
|
- Vec3d unit = new Vec3d(l.getX() - eye.x + mX, l.getY() - eye.y + mY, l.getZ() - eye.z + mZ);
|
|
|
+ Vec3d unit = new Vec3d(l.x - eye.x + mX, l.y - eye.y + mY, l.z - eye.z + mZ);
|
|
|
|
|
|
- List<Entity> col = getEntitiesExcluding(p, w, new BlockPos(eye), l);
|
|
|
+ List<Entity> col = getEntitiesExcluding(p, w, eye.x, eye.y, eye.z, l.x, l.y, l.z);
|
|
|
col.removeIf(ent -> !type.isAssignableFrom(ent.getClass()));
|
|
|
// Entfernt Entities, die sich nicht mit dem Blick-Vektor schneiden
|
|
|
col.removeIf(ent -> !doesIntersect(ent.getEntityBoundingBox().grow(0.1), eye, unit));
|
|
@@ -591,7 +591,7 @@ public class Utils
|
|
|
return w.playerEntities.stream().min((p1, p2) -> Double.compare(p1.getDistanceSq(v.x, v.y, v.z), p2.getDistanceSq(v.x, v.y, v.z))).orElse(null);
|
|
|
}
|
|
|
|
|
|
- public static BlockPos getPlayerTarget(EntityPlayer p, double range, boolean boundingBox)
|
|
|
+ public static Vec3d getPlayerTargetVector(EntityPlayer p, double range, boolean boundingBox)
|
|
|
{
|
|
|
if(range > 128)
|
|
|
{
|
|
@@ -603,9 +603,14 @@ public class Utils
|
|
|
RayTraceResult ray = w.rayTraceBlocks(start, end, true, !boundingBox, false);
|
|
|
if(ray == null)
|
|
|
{
|
|
|
- return new BlockPos(end);
|
|
|
+ return end;
|
|
|
}
|
|
|
- return ray.getBlockPos();
|
|
|
+ return ray.hitVec;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static BlockPos getPlayerTarget(EntityPlayer p, double range, boolean boundingBox)
|
|
|
+ {
|
|
|
+ return new BlockPos(getPlayerTargetVector(p, range, boundingBox));
|
|
|
}
|
|
|
|
|
|
public static BlockPos getPlayerTarget(EntityPlayer p, double range)
|