mirror of
https://github.com/GTNewHorizons/FindIt.git
synced 2026-11-24 10:14:21 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2961c8ad9e | ||
|
|
63b1fc85ec |
No files matched your search
+2
-2
@@ -1,6 +1,6 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
implementation('com.github.GTNewHorizons:NotEnoughItems:2.5.18-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.68:dev')
|
||||
implementation('com.github.GTNewHorizons:NotEnoughItems:2.5.23-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.84:dev')
|
||||
}
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.14'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.15'
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ public class ClientFinderHelperUtils {
|
||||
|
||||
public static void rotateViewHelper(EntityClientPlayerMP player, List<ChunkPosition> targets) {
|
||||
Vec3 playerVec = player.getPosition(1.0F);
|
||||
Vec3 first = center(targets.get(0));
|
||||
Vec3 first = center(getNearBlock(playerVec, targets));
|
||||
|
||||
AxisUtils.AxisPair pair = AxisUtils.calculateAxisPair(playerVec, first);
|
||||
|
||||
@@ -27,4 +27,27 @@ public class ClientFinderHelperUtils {
|
||||
public static Vec3 center(ChunkPosition p) {
|
||||
return Vec3.createVectorHelper(p.chunkPosX + 0.5, p.chunkPosY + 0.5, p.chunkPosZ + 0.5);
|
||||
}
|
||||
|
||||
private static ChunkPosition getNearBlock(Vec3 player, List<ChunkPosition> targets) {
|
||||
ChunkPosition result = null;
|
||||
double minDistance = Double.MAX_VALUE;
|
||||
|
||||
for (ChunkPosition target : targets) {
|
||||
double distance = getDistance(player, target);
|
||||
if (distance < minDistance) {
|
||||
result = target;
|
||||
minDistance = distance;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static double getDistance(Vec3 player, ChunkPosition target) {
|
||||
double deltaX = target.chunkPosX - player.xCoord;
|
||||
double deltaY = target.chunkPosY - player.yCoord;
|
||||
double deltaZ = target.chunkPosZ - player.zCoord;
|
||||
|
||||
return Math.sqrt(deltaX * deltaX + deltaZ * deltaZ + deltaY * deltaY);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user