warning cleanup
This commit is contained in:
1 parent
5ab4a9e442
commit
277872b33c
106 files changed
+4495
-4345
No files matched your search
@@ -5,6 +5,7 @@ import com.mojang.math.Axis;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Locale;
|
||||
|
||||
public enum ShapeDirection
|
||||
@@ -18,7 +19,8 @@ public enum ShapeDirection
|
||||
CAMERA,
|
||||
PLAYER;
|
||||
|
||||
public static ShapeDirection fromString(final String direction)
|
||||
@Nullable
|
||||
public static ShapeDirection fromString(String direction)
|
||||
{
|
||||
return switch (direction.toLowerCase(Locale.ROOT))
|
||||
{
|
||||
@@ -34,7 +36,7 @@ public enum ShapeDirection
|
||||
};
|
||||
}
|
||||
|
||||
public static void rotatePoseStackByShapeDirection(final PoseStack poseStack, final ShapeDirection shapeDirection, final Camera camera, final Vec3 objectPos)
|
||||
public static void rotatePoseStackByShapeDirection(PoseStack poseStack, ShapeDirection shapeDirection, Camera camera, Vec3 objectPos)
|
||||
{
|
||||
switch (shapeDirection)
|
||||
{
|
||||
@@ -46,13 +48,13 @@ public enum ShapeDirection
|
||||
case DOWN -> poseStack.mulPose(Axis.XP.rotationDegrees(-90));
|
||||
case CAMERA -> poseStack.mulPose(camera.rotation());
|
||||
case PLAYER -> {
|
||||
final Vec3 vector = objectPos.subtract(camera.getPosition());
|
||||
final double x = vector.x;
|
||||
final double y = vector.y;
|
||||
final double z = vector.z;
|
||||
final double d = Math.sqrt(x * x + z * z);
|
||||
final float rotX = (float) (Math.atan2(x, z));
|
||||
final float rotY = (float) (Math.atan2(y, d));
|
||||
Vec3 vector = objectPos.subtract(camera.getPosition());
|
||||
double x = vector.x;
|
||||
double y = vector.y;
|
||||
double z = vector.z;
|
||||
double d = Math.sqrt(x * x + z * z);
|
||||
float rotX = (float) (Math.atan2(x, z));
|
||||
float rotY = (float) (Math.atan2(y, d));
|
||||
|
||||
// that should work somehow but it doesn't for some reason
|
||||
//matrices.mulPose(new Quaternion( -rotY, rotX, 0, false));
|
||||
|
||||
Reference in new issue
Block a user