refactored nonscarpet references yeet

This commit is contained in:
gnembon committed 2023-02-11 01:33:23 +01:00
1 parent e4c090c355
commit 2ff1f4fb71
22 files changed
+409 -401

No files matched your search

@@ -1,10 +1,5 @@
package carpet.script.utils.shapes;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
import net.minecraft.client.Camera;
import net.minecraft.world.phys.Vec3;
import javax.annotation.Nullable;
import java.util.Locale;
@@ -35,33 +30,4 @@ public enum ShapeDirection
default -> null;
};
}
public static void rotatePoseStackByShapeDirection(PoseStack poseStack, ShapeDirection shapeDirection, Camera camera, Vec3 objectPos)
{
switch (shapeDirection)
{
case NORTH -> {}
case SOUTH -> poseStack.mulPose(Axis.YP.rotationDegrees(180));
case EAST -> poseStack.mulPose(Axis.YP.rotationDegrees(270));
case WEST -> poseStack.mulPose(Axis.YP.rotationDegrees(90));
case UP -> poseStack.mulPose(Axis.XP.rotationDegrees(90));
case DOWN -> poseStack.mulPose(Axis.XP.rotationDegrees(-90));
case CAMERA -> poseStack.mulPose(camera.rotation());
case PLAYER -> {
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));
poseStack.mulPose(Axis.YP.rotation(rotX));
poseStack.mulPose(Axis.XP.rotation(-rotY));
}
}
}
}