|
@@ -19,6 +19,7 @@
|
|
|
|
|
|
package me.shedaniel.math.impl;
|
|
|
|
|
|
+import me.shedaniel.math.FloatingPoint;
|
|
|
import me.shedaniel.math.Point;
|
|
|
import net.fabricmc.api.EnvType;
|
|
|
import net.fabricmc.api.Environment;
|
|
@@ -33,6 +34,13 @@ public class PointHelper {
|
|
|
return new Point(mx, my);
|
|
|
}
|
|
|
|
|
|
+ public static FloatingPoint ofFloatingMouse() {
|
|
|
+ Minecraft client = Minecraft.getInstance();
|
|
|
+ double mx = client.mouseHandler.xpos() * (double) client.getWindow().getGuiScaledWidth() / (double) client.getWindow().getScreenWidth();
|
|
|
+ double my = client.mouseHandler.ypos() * (double) client.getWindow().getGuiScaledHeight() / (double) client.getWindow().getScreenHeight();
|
|
|
+ return new FloatingPoint(mx, my);
|
|
|
+ }
|
|
|
+
|
|
|
public static int getMouseX() {
|
|
|
return ofMouse().x;
|
|
|
}
|
|
@@ -40,4 +48,12 @@ public class PointHelper {
|
|
|
public static int getMouseY() {
|
|
|
return ofMouse().y;
|
|
|
}
|
|
|
+
|
|
|
+ public static double getMouseFloatingX() {
|
|
|
+ return ofFloatingMouse().x;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static double getMouseFloatingY() {
|
|
|
+ return ofFloatingMouse().y;
|
|
|
+ }
|
|
|
}
|