Bladeren bron

Update basic math to 0.6.0

shedaniel 3 jaren geleden
bovenliggende
commit
ad272c015e

+ 1 - 1
common/build.gradle

@@ -18,7 +18,7 @@ dependencies {
     // Do NOT use other classes from fabric loader
     modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
 
-    modApi("me.shedaniel.cloth:basic-math:0.5.1")
+    modApi("me.shedaniel.cloth:basic-math:0.6.0")
 
     compileOnly("blue.endless:jankson:${rootProject.jankson_version}")
     compileOnly("com.moandjiezana.toml:toml4j:${rootProject.toml4j_version}")

+ 16 - 0
common/src/main/java/me/shedaniel/math/impl/PointHelper.java

@@ -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;
+    }
 }

+ 2 - 2
fabric/build.gradle

@@ -33,8 +33,8 @@ dependencies {
     modApi "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
     modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
 
-    modApi("me.shedaniel.cloth:basic-math:0.5.1")
-    include("me.shedaniel.cloth:basic-math:0.5.1")
+    modApi("me.shedaniel.cloth:basic-math:0.6.0")
+    include("me.shedaniel.cloth:basic-math:0.6.0")
 
     implementation("blue.endless:jankson:${rootProject.jankson_version}")
     implementation("com.moandjiezana.toml:toml4j:${rootProject.toml4j_version}")

+ 2 - 2
forge/build.gradle

@@ -24,8 +24,8 @@ dependencies {
 
     forge "net.minecraftforge:forge:${rootProject.architectury.minecraft}-${rootProject.forge_version}"
 
-    modApi("me.shedaniel.cloth:basic-math:0.5.1")
-    shadow("me.shedaniel.cloth:basic-math:0.5.1")
+    modApi("me.shedaniel.cloth:basic-math:0.6.0")
+    shadow("me.shedaniel.cloth:basic-math:0.6.0")
 
     implementation("blue.endless:jankson:${rootProject.jankson_version}")
     implementation("com.moandjiezana.toml:toml4j:${rootProject.toml4j_version}")

+ 1 - 1
gradle.properties

@@ -6,7 +6,7 @@ supported_version=1.16.4/5
 
 archives_base_name=cloth-config
 archives_base_name_snapshot=cloth-config-snapshot
-base_version=4.11
+base_version=4.12
 maven_group=me.shedaniel.cloth
 
 jankson_version=1.2.0