From f29c2f3bb59e46990fb3e9085cd7b2fe8689bdb2 Mon Sep 17 00:00:00 2001 From: winterflyt <36+winterflyt@noreply.skidsolutions.xyz> Date: Mon, 30 Nov 2026 06:05:54 +0200 Subject: [PATCH] Upload files to "src/openonyx/protocol/group_m" --- src/openonyx/protocol/group_m/Angles.java | 96 +++++++++++++++++++ .../protocol/group_m/RotationDelta.java | 7 ++ 2 files changed, 103 insertions(+) create mode 100644 src/openonyx/protocol/group_m/Angles.java create mode 100644 src/openonyx/protocol/group_m/RotationDelta.java diff --git a/src/openonyx/protocol/group_m/Angles.java b/src/openonyx/protocol/group_m/Angles.java new file mode 100644 index 0000000..2a93803 --- /dev/null +++ b/src/openonyx/protocol/group_m/Angles.java @@ -0,0 +1,96 @@ +package openonyx.protocol.group_m; + +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import openonyx.protocol.RotationHandler; +import openonyx.protocol.group_d.RotationAngleMath; +import openonyx.utilities.PlayerUtils; + +public record Angles(float yaw, float pitch, boolean isNormalized) { + public static final Angles INSTANCE = new Angles(0.0F, 0.0F); + + public float pitch2() { + return this.pitch; + } + + public float L(Angles angles1) { + return Math.min(this.L(angles1).L(), 180.0F); + } + + public Angles L(float f, float g) { + return new Angles(this.yaw + g, this.pitch + f); + } + + public Angles(float f, float g) { + this(f, g, false); + } + + public Vec3 L() { + return Vec3.directionFromRotation(this.pitch, this.yaw); + } + + public Angles L() { + Angles angles1 = this; + if (angles1.isNormalized) { + return angles1; + } + + double d = RotationAngleMath.d(); + if ((this = RotationHandler.INSTANCE.getAngles3()) == null) { + this = PlayerUtils.L((Entity)Minecraft.getMinecraft().thePlayer); + } + + RotationDelta rotationDelta = this.L(angles1); + double e = Math.round(rotationDelta.deltaYaw() / d) * d; + d = Math.round(rotationDelta.deltaPitch() / d) * d; + float g = this.yaw2() + (float)e; + float f = this.pitch2() + (float)d; + return new Angles(g, MathHelper.clamp_float(f, -90.0F, 90.0F), true); + } + + public boolean L(Angles angles1) { + return this.L(angles1, 2.0F); + } + + public static Angles L(Vec3 vec3) { + return L(vec3.xCoord, vec3.yCoord, vec3.zCoord); + } + + public Angles L(Angles angles1, float f) { + return new Angles(Math.fma(f, angles1.yaw - this.yaw, this.yaw), Math.fma(f, angles1.pitch - this.pitch, this.pitch)); + } + + public RotationDelta L(Angles angles1) { + return new RotationDelta(RotationAngleMath.L(angles1.yaw, this.yaw), RotationAngleMath.L(angles1.pitch, this.pitch)); + } + + public static Angles L(double d, double e, double f) { + return new Angles( + MathHelper.wrapAngleTo180_float((float)Math.toDegrees(Math.atan2(f, d)) - 90.0F), + MathHelper.wrapAngleTo180_float((float)(-Math.toDegrees(Math.atan2(e, Math.hypot(d, f))))) + ); + } + + public Angles L(Angles angles1, float f, float g) { + RotationDelta rotationDelta; + RotationDelta rotationDelta1 = rotationDelta = this.L(angles1); + float h = rotationDelta1.L(); + f = Math.abs(rotationDelta1.deltaYaw() / h) * f; + g = Math.abs(rotationDelta1.deltaPitch() / h) * g; + return this.L(RotationAngleMath.L(rotationDelta1.deltaPitch(), -g, g), RotationAngleMath.L(rotationDelta.deltaYaw(), -f, f)); + } + + public boolean L(Angles angles1, float f) { + return this.L(angles1) <= f; + } + + public float yaw2() { + return this.yaw; + } + + public static Angles L(Vec3 vec3, Vec3 vec31) { + return L(vec3.subtract(vec31)); + } +} diff --git a/src/openonyx/protocol/group_m/RotationDelta.java b/src/openonyx/protocol/group_m/RotationDelta.java new file mode 100644 index 0000000..4ba85fe --- /dev/null +++ b/src/openonyx/protocol/group_m/RotationDelta.java @@ -0,0 +1,7 @@ +package openonyx.protocol.group_m; + +public record RotationDelta(float deltaYaw, float deltaPitch) { + public float L() { + return (float)Math.hypot(this.deltaYaw, this.deltaPitch); + } +}