diff --git a/build.gradle b/build.gradle index c3e61f8d..2a1bb796 100644 --- a/build.gradle +++ b/build.gradle @@ -17,9 +17,9 @@ configure( dependencies { library 'com.github.JnCrMx:discord-game-sdk4j:v0.5.5' - library 'com.fasterxml.jackson.core:jackson-core:2.20.0' - library 'com.fasterxml.jackson.core:jackson-annotations:2.20' - library 'com.fasterxml.jackson.core:jackson-databind:2.20' + library 'com.fasterxml.jackson.core:jackson-core:2.8.8' + library 'com.fasterxml.jackson.core:jackson-annotations:2.8.8' + library 'com.fasterxml.jackson.core:jackson-databind:2.8.8' testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.1' 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 793156d3..2bc6ba9f 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 @@ -52,7 +52,8 @@ public class Player { public String lastTiming = "None"; public boolean sprinting = false; public BoundingBox3D boundingBox = null; - + public String sidestep = "None"; + public boolean wadStart = false; @InfoString.Getter public static LandingBlock getLatestLB() { @@ -66,7 +67,7 @@ public static LandingBlock getLatestLB() { public static List compressedInputHistory() { return getInputHistory().stream() .reduce(new ArrayList>(), (l, t) -> { - if (l.size() == 0) { + if (l.isEmpty()) { l.add(new Tuple<>(1, t)); return l; } @@ -272,6 +273,7 @@ public Player buildAndSave() { return this; } + //Blip lastBlip = prev.lastBlip; if (onGround && !prev.onGround && pos.getY() == prev.pos.getY() && !prev.jumpTick) { if (lastBlip == null) lastBlip = new Blip(1, pos); @@ -280,6 +282,24 @@ public Player buildAndSave() { if (lastBlip != null) lastBlip = new Blip(0, lastBlip.lastChainedBlips, lastBlip.pos); } + //Sidestep + sidestep = prev.sidestep; + wadStart = prev.wadStart; + if (jumpTick) { + if (prev.keyInput.isMovingSideways() && keyInput.isMovingSideways() && prev.keyInput.hasSwappedDirection(keyInput)) { + sidestep = "WDWA"; + } else if (prev.keyInput.isMovingSideways() && !keyInput.isMovingSideways()) { + sidestep = "None"; + wadStart = true; + } else { + sidestep = "None"; + wadStart = false; + } + } else if (wadStart && keyInput.isMovingSideways()) { + sidestep = airtime == 1 ? "WAD" : "WAD " + airtime + "t"; + wadStart = false; + } + Player.updateDisplayInstance(); return this; } @@ -366,6 +386,11 @@ public Player setLastPos(Vector3D lastPos) { return this; } + @InfoString.Getter + public String getSidestep() { + return sidestep; + } + @InfoString.DataClass public static class Blip implements FormatDecimals { @InfoString.Field @@ -484,5 +509,9 @@ public Vector2D getMovementVector() { public boolean isMovingSideways() { return left ^ right; } + + public boolean hasSwappedDirection(KeyInput other) { + return (this.left && other.right) || (this.right && other.left); + } } } diff --git a/common/src/main/java/io/github/kurrycat/mpkmod/save/Serializer.java b/common/src/main/java/io/github/kurrycat/mpkmod/save/Serializer.java index 0d9c21d7..9cb0d521 100644 --- a/common/src/main/java/io/github/kurrycat/mpkmod/save/Serializer.java +++ b/common/src/main/java/io/github/kurrycat/mpkmod/save/Serializer.java @@ -30,8 +30,7 @@ public static void registerSerializer() { module.addDeserializer(Color.class, new ColorDeserializer()); mapper.registerModule(module); - mapper.activateDefaultTyping( - mapper.getPolymorphicTypeValidator(), + mapper.enableDefaultTyping( ObjectMapper.DefaultTyping.OBJECT_AND_NON_CONCRETE, JsonTypeInfo.As.PROPERTY );