Compare commits

..
4 Commits
Author SHA1 Message Date
Martin Robertz d610d598c4 update 2024-02-14 12:43:57 +01:00
gitboy 707e8582c7 Spotless 2024-02-14 11:19:01 +08:00
gitboy 64446eef4b Configuration & Separating lookAtTarget() 2024-02-12 19:36:32 +08:00
gitboy 4ffd7ee108 init 2024-02-07 08:40:42 +08:00
3 changed files with 8 additions and 11 deletions

No files matched your search

+2 -2
View File
@@ -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.17-GTNH:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.64:dev')
}
@@ -1,6 +1,7 @@
package com.gtnh.findit.util;
import net.minecraft.util.Vec3;
import net.minecraft.world.ChunkPosition;
public class AxisUtils {
@@ -23,10 +24,10 @@ public class AxisUtils {
}
}
public static AxisPair calculateAxisPair(Vec3 player, Vec3 target) {
double deltaX = target.xCoord - player.xCoord;
double deltaY = target.yCoord - player.yCoord;
double deltaZ = target.zCoord - player.zCoord;
public static AxisPair calculateAxisPair(Vec3 player, ChunkPosition target) {
double deltaX = target.chunkPosX - player.xCoord;
double deltaY = target.chunkPosY - player.yCoord;
double deltaZ = target.chunkPosZ - player.zCoord;
double distanceXZ = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ);
@@ -21,15 +21,11 @@ public class ClientFinderHelperUtils {
public static void rotateViewHelper(EntityClientPlayerMP player, List<ChunkPosition> targets) {
Vec3 playerVec = player.getPosition(1.0F);
Vec3 first = center(targets.remove(0));
ChunkPosition first = targets.remove(0);
AxisUtils.AxisPair pair = AxisUtils.calculateAxisPair(playerVec, first);
player.rotationYaw = pair.yaw();
player.rotationPitch = pair.pitch();
}
public static Vec3 center(ChunkPosition p) {
return Vec3.createVectorHelper(p.chunkPosX + 0.5, p.chunkPosY + 0.5, p.chunkPosZ + 0.5);
}
}