From 0b3de7a8df1696bcb23124a74649a569150668cd Mon Sep 17 00:00:00 2001 From: Exterminate Date: Thu, 11 Sep 2025 22:22:15 +1000 Subject: [PATCH 1/2] Add grinds also updated the network api --- common/build.gradle | 2 +- .../mpkmod/compatibility/MCClasses/Player.java | 15 +++++++++++++++ .../io/github/kurrycat/mpkmod/util/Vector2D.java | 6 ++++++ fabric-1.21.6/build.gradle | 2 +- forge-1.8.9/build.gradle | 2 +- gradle.properties | 2 ++ 6 files changed, 26 insertions(+), 3 deletions(-) diff --git a/common/build.gradle b/common/build.gradle index f6bec329..d8fd35fa 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -8,7 +8,7 @@ dependencies { compileOnly 'org.apache.logging.log4j:log4j-api:2.0-beta9' compileOnly 'org.apache.logging.log4j:log4j-core:2.0-beta9' - library "com.github.MPKMod.MPKNetworkAPI:common:1.0.0" + library "com.github.MPKMod.MPKNetworkAPI:common:${project.networkApiVersion}" } compileJava.doLast { diff --git a/common/src/main/java/io/github/kurrycat/mpkmod/compatibility/MCClasses/Player.java b/common/src/main/java/io/github/kurrycat/mpkmod/compatibility/MCClasses/Player.java index 9939d4df..c48d3f3e 100644 --- a/common/src/main/java/io/github/kurrycat/mpkmod/compatibility/MCClasses/Player.java +++ b/common/src/main/java/io/github/kurrycat/mpkmod/compatibility/MCClasses/Player.java @@ -47,6 +47,7 @@ public class Player { public int[] deltaMouseY = null; public int airtime = 0; public Float last45 = null; + public int grinds = 0; public boolean jumpTick = false; public boolean landTick = false; public String lastTiming = "None"; @@ -217,6 +218,11 @@ public String getLastTiming() { return lastTiming; } + @InfoString.Getter + public int getGrinds() { + return grinds; + } + @SuppressWarnings("UnusedReturnValue") public Player buildAndSave() { Player prev = getLatest(); @@ -269,6 +275,15 @@ public Player buildAndSave() { lastTiming = TimingStorage.match(getInputHistory()); + //Grinds + grinds = prev.grinds; + if (jumpTick && pos.getY() == prev.pos.getY() && motion.getY() == 0) { + grinds++; + } else if (landTick) { + //If requested we could have a variable that keeps track of grinds until next attempt + grinds = 0; + } + //Blip lastBlip = prev.lastBlip; if (onGround && !prev.onGround && pos.getY() == prev.pos.getY() && !prev.jumpTick) { diff --git a/common/src/main/java/io/github/kurrycat/mpkmod/util/Vector2D.java b/common/src/main/java/io/github/kurrycat/mpkmod/util/Vector2D.java index 17e9f663..332ca3e5 100644 --- a/common/src/main/java/io/github/kurrycat/mpkmod/util/Vector2D.java +++ b/common/src/main/java/io/github/kurrycat/mpkmod/util/Vector2D.java @@ -177,6 +177,12 @@ public double dot(Vector2D other) { return x * other.x + y * other.y; } + public Vector2D normalize() { + double len = length(); + if (len == 0) return ZERO; + return new Vector2D(x / len, y / len); + } + /** * @param pos1 top left corner * @param pos2 bottom right corner diff --git a/fabric-1.21.6/build.gradle b/fabric-1.21.6/build.gradle index 163f139b..8def9c2d 100644 --- a/fabric-1.21.6/build.gradle +++ b/fabric-1.21.6/build.gradle @@ -13,7 +13,7 @@ dependencies { modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - implementation "com.github.MPKMod.MPKNetworkAPI:common:1.0.0" + implementation "com.github.MPKMod.MPKNetworkAPI:common:${project.networkApiVersion}" } processResources { diff --git a/forge-1.8.9/build.gradle b/forge-1.8.9/build.gradle index 4282b362..c56f008b 100644 --- a/forge-1.8.9/build.gradle +++ b/forge-1.8.9/build.gradle @@ -25,7 +25,7 @@ unimined.minecraft { } dependencies { - implementation "com.github.MPKMod.MPKNetworkAPI:common:1.0.0" + implementation "com.github.MPKMod.MPKNetworkAPI:common:${project.networkApiVersion}" } processResources { diff --git a/gradle.properties b/gradle.properties index 941581f5..c429414b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,4 +6,6 @@ $modBaseName=mpkmod $commonBaseName=mpkmod-common $vendor=kurrycat +networkApiVersion=1.0.1 + org.gradle.jvmargs=-Xmx4096m \ No newline at end of file From 807b8c01dbf48c352707cf506c3d452f9888b68f Mon Sep 17 00:00:00 2001 From: Exterminate Date: Fri, 12 Sep 2025 20:37:16 +1000 Subject: [PATCH 2/2] Update grind logic --- .../mpkmod/compatibility/MCClasses/Player.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/io/github/kurrycat/mpkmod/compatibility/MCClasses/Player.java b/common/src/main/java/io/github/kurrycat/mpkmod/compatibility/MCClasses/Player.java index c48d3f3e..2157679e 100644 --- a/common/src/main/java/io/github/kurrycat/mpkmod/compatibility/MCClasses/Player.java +++ b/common/src/main/java/io/github/kurrycat/mpkmod/compatibility/MCClasses/Player.java @@ -48,6 +48,7 @@ public class Player { public int airtime = 0; public Float last45 = null; public int grinds = 0; + public boolean grindTick = false; public boolean jumpTick = false; public boolean landTick = false; public String lastTiming = "None"; @@ -277,11 +278,13 @@ public Player buildAndSave() { //Grinds grinds = prev.grinds; - if (jumpTick && pos.getY() == prev.pos.getY() && motion.getY() == 0) { - grinds++; - } else if (landTick) { - //If requested we could have a variable that keeps track of grinds until next attempt - grinds = 0; + grindTick = jumpTick && pos.getY() == prev.pos.getY() && motion.getY() == (-0.08 * 0.98F); + + if (grindTick) { + if (prev.getPrevious().grindTick) + grinds++; + else + grinds = 1; } //Blip