Upload files to "src/openonyx/protocol/group_m"
This commit is contained in:
1 parent
6f2dbadd2b
commit
f29c2f3bb5
2 files changed
+103
No files matched your search
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user