Skip to content

Commit

Permalink
bump Version
Browse files Browse the repository at this point in the history
  • Loading branch information
sakura-ryoko committed Dec 8, 2024
1 parent e6d5a70 commit b912d26
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/main/java/fi/dy/masa/litematica/util/RayTraceUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ public static BlockPos PRW_getPickBlockLastTrace(World worldClient, Entity entit
}

EntityHitResult entityTrace = (EntityHitResult) traceVanilla;
final double closestVanilla = MathUtils.squareDistanceTo(entityTrace.getPos(), eyesPos);
final double closestVanilla = squareDistanceTo(entityTrace.getPos(), eyesPos);

BlockPos closestVanillaPos = entityTrace.getEntity().getBlockPos();
World worldSchematic = SchematicWorldHandler.getSchematicWorld();
Expand All @@ -1119,7 +1119,7 @@ public static BlockPos PRW_getPickBlockLastTrace(World worldClient, Entity entit
for (BlockHitResult trace : list)
{
//double dist = trace.pos.squareDistanceTo(eyesPos);
double dist = MathUtils.squareDistanceTo(trace.getPos(), eyesPos);
double dist = squareDistanceTo(trace.getPos(), eyesPos);
BlockPos pos = trace.getBlockPos();

// Comparing with >= instead of > fixes the case where the player's head is inside the first schematic block,
Expand Down Expand Up @@ -1210,4 +1210,15 @@ public static List<BlockHitResult> PRW_rayTraceSchematicWorldBlocksToList(World

return hits;
}

// Copied from MathUtils
public static double squareDistanceTo(Vec3d i, Vec3d v)
{
return squareDistanceTo(i, v.x, v.y, v.z);
}

public static double squareDistanceTo(Vec3d v, double x, double y, double z)
{
return v.x * x + v.y * y + v.z * z;
}
}

0 comments on commit b912d26

Please sign in to comment.