Upload files to "src/openonyx/protocol/internal/internal/internal/internal"
This commit is contained in:
1 parent
f29c2f3bb5
commit
cfb35da36f
5 files changed
+179
No files matched your search
@@ -0,0 +1,118 @@
|
|||||||
|
package openonyx.protocol.internal.internal.internal.internal;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import openonyx.history.internal.RangeSetting;
|
||||||
|
import openonyx.protocol.RotationHandler;
|
||||||
|
import openonyx.protocol.RotationRequest;
|
||||||
|
import openonyx.protocol.group_d.RotationAngleMath;
|
||||||
|
import openonyx.protocol.group_m.Angles;
|
||||||
|
import openonyx.protocol.group_m.RotationDelta;
|
||||||
|
import openonyx.protocol.internal.internal.internal.SmoothingMode;
|
||||||
|
import openonyx.protocol.internal.internal.internal.Vec2;
|
||||||
|
import openonyx.utilities.PlayerUtils;
|
||||||
|
import openonyx.utilities.RotationRayTrace;
|
||||||
|
|
||||||
|
public class AccelerationSmoothing extends SmoothingMode {
|
||||||
|
private final AccelerationSmoothingPart accelerationSmoothingPart;
|
||||||
|
private final RangeSetting t2;
|
||||||
|
private final RangeSetting t = RangeSetting.of("Yaw acceleration", 20.0, 25.0, 1.0, 180.0).withSuffix("°/t²");
|
||||||
|
private final AccelerationSmoothingPart2 accelerationSmoothingPart2;
|
||||||
|
private final AccelerationSmoothingPart4 accelerationSmoothingPart4;
|
||||||
|
private final AccelerationSmoothingPart3 accelerationSmoothingPart3;
|
||||||
|
|
||||||
|
private Vec2 L(RotationDelta rotationDelta, RotationDelta rotationDelta1, boolean bl, double d) {
|
||||||
|
float f = this.accelerationSmoothingPart2.isEnabled() ? this.accelerationSmoothingPart2.L(rotationDelta1.L()) : 1.0F;
|
||||||
|
boolean bl1 = this.accelerationSmoothingPart4.isEnabled() && bl;
|
||||||
|
float h = (float)(this.accelerationSmoothingPart4.distanceFactor.getValue() * d);
|
||||||
|
AccelerationSmoothingData accelerationSmoothingData2 = new AccelerationSmoothingData;
|
||||||
|
float j;
|
||||||
|
AccelerationSmoothing accelerationSmoothing1;
|
||||||
|
if (this.accelerationSmoothingPart3.isEnabled()) {
|
||||||
|
j = this.accelerationSmoothingPart3.yawError.getValue().floatValue();
|
||||||
|
accelerationSmoothing1 = this;
|
||||||
|
} else {
|
||||||
|
j = 0.0F;
|
||||||
|
accelerationSmoothing1 = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
accelerationSmoothingData2./* $VF: Unable to resugar constructor */<init>(
|
||||||
|
j, accelerationSmoothing1.accelerationSmoothingPart.isEnabled() ? this.accelerationSmoothingPart.yawError.getValue().floatValue() : 0.0F
|
||||||
|
);
|
||||||
|
AccelerationSmoothingData accelerationSmoothingData1 = accelerationSmoothingData2;
|
||||||
|
accelerationSmoothingData2 = new AccelerationSmoothingData;
|
||||||
|
if (this.accelerationSmoothingPart3.isEnabled()) {
|
||||||
|
j = this.accelerationSmoothingPart3.pitchError.getValue().floatValue();
|
||||||
|
accelerationSmoothing1 = this;
|
||||||
|
} else {
|
||||||
|
j = 0.0F;
|
||||||
|
accelerationSmoothing1 = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
accelerationSmoothingData2./* $VF: Unable to resugar constructor */<init>(
|
||||||
|
j, accelerationSmoothing1.accelerationSmoothingPart.isEnabled() ? this.accelerationSmoothingPart.pitchError.getValue().floatValue() : 0.0F
|
||||||
|
);
|
||||||
|
AccelerationSmoothingData accelerationSmoothingData = accelerationSmoothingData2;
|
||||||
|
RangeSetting rangeSetting = bl1 ? this.accelerationSmoothingPart4.t : this.t;
|
||||||
|
RangeSetting rangeSetting1 = bl1 ? this.accelerationSmoothingPart4.t2 : this.t2;
|
||||||
|
float g = this.L(rotationDelta1.deltaYaw(), rotationDelta.deltaYaw(), -rangeSetting.L() + h, rangeSetting.L() + h, f);
|
||||||
|
float i = this.L(rotationDelta1.deltaPitch(), rotationDelta.deltaPitch(), -rangeSetting1.L() + h, rangeSetting1.L() + h, f);
|
||||||
|
return new Vec2(rotationDelta.deltaYaw() + g + accelerationSmoothingData1.L(g), rotationDelta.deltaPitch() + i + accelerationSmoothingData.L(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccelerationSmoothing() {
|
||||||
|
super("Acceleration");
|
||||||
|
this.t2 = RangeSetting.of("Pitch acceleration", 20.0, 25.0, 1.0, 180.0).withSuffix("°/t²");
|
||||||
|
this.accelerationSmoothingPart3 = new AccelerationSmoothingPart3();
|
||||||
|
this.accelerationSmoothingPart = new AccelerationSmoothingPart();
|
||||||
|
this.accelerationSmoothingPart4 = new AccelerationSmoothingPart4();
|
||||||
|
this.accelerationSmoothingPart2 = new AccelerationSmoothingPart2();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Angles L(RotationRequest rotationRequest, Angles angles, Angles angles1) {
|
||||||
|
Angles angles2;
|
||||||
|
if ((angles2 = RotationHandler.INSTANCE.getAngles2()) == null) {
|
||||||
|
angles2 = PlayerUtils.d((Entity)mc.thePlayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
RotationDelta rotationDelta1 = angles2.L(angles);
|
||||||
|
RotationDelta rotationDelta = angles.L(angles1);
|
||||||
|
Entity entity;
|
||||||
|
double d = (entity = rotationRequest.getEntity()) != null ? PlayerUtils.d(mc.thePlayer, entity) : 0.0;
|
||||||
|
boolean bl = entity != null && RotationRayTrace.L(entity, Math.max(3.0, d), angles) != null;
|
||||||
|
Vec2 vec2 = this.L(rotationDelta1, rotationDelta, bl, d);
|
||||||
|
return new Angles(angles.yaw2() + vec2.x(), angles.pitch2() + vec2.y());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int L(Angles angles, Angles angles1) {
|
||||||
|
Angles angles2;
|
||||||
|
if ((angles2 = RotationHandler.INSTANCE.getAngles2()) == null) {
|
||||||
|
angles2 = PlayerUtils.d((Entity)mc.thePlayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
RotationDelta rotationDelta1 = angles2.L(angles);
|
||||||
|
RotationDelta rotationDelta;
|
||||||
|
if (L((rotationDelta = angles.L(angles1)).deltaYaw(), 0.0F) && L(rotationDelta.deltaPitch(), 0.0F)) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
Vec2 vec2;
|
||||||
|
if ((!L((vec2 = this.L(rotationDelta1, rotationDelta, false, 0.0)).x(), 0.0F) || !L(vec2.y(), 0.0F))
|
||||||
|
&& (!(Math.abs(rotationDelta.deltaYaw()) < Math.abs(vec2.x())) || !(Math.abs(rotationDelta.deltaPitch()) < Math.abs(vec2.y())))) {
|
||||||
|
double d = Math.floor(Math.abs(rotationDelta.deltaYaw()) / Math.abs(vec2.x()));
|
||||||
|
double e = Math.floor(Math.abs(rotationDelta.deltaPitch()) / Math.abs(vec2.y()));
|
||||||
|
return !Double.isNaN(d) && !Double.isNaN(e) ? (int)Math.max(d, e) : 0;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private float L(float f, float g, float h, float i, float j) {
|
||||||
|
return RotationAngleMath.L(RotationAngleMath.L(f, g), h, i) * j;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean L(float f, float g) {
|
||||||
|
return Math.abs(g - f) < 1.0E-5F;
|
||||||
|
}
|
||||||
|
}
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
package openonyx.protocol.internal.internal.internal.internal;
|
||||||
|
|
||||||
|
record AccelerationSmoothingData(float accelerationError, float constantError) {
|
||||||
|
float L(float f) {
|
||||||
|
AccelerationSmoothingData accelerationSmoothingData1 = this;
|
||||||
|
float g = L(-accelerationSmoothingData1.accelerationError, accelerationSmoothingData1.accelerationError);
|
||||||
|
float h = L(-accelerationSmoothingData1.constantError, accelerationSmoothingData1.constantError);
|
||||||
|
return f * g + h;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float L(float f, float g) {
|
||||||
|
return g <= f ? f : (float)(f + Math.random() * (g - f));
|
||||||
|
}
|
||||||
|
}
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
package openonyx.protocol.internal.internal.internal.internal;
|
||||||
|
|
||||||
|
import openonyx.history.SettingSection;
|
||||||
|
import openonyx.history.internal.NumberSetting;
|
||||||
|
|
||||||
|
class AccelerationSmoothingPart extends SettingSection {
|
||||||
|
private final NumberSetting yawError = new NumberSetting("Yaw error", 0.1, 0.01, 1.0, 0.01);
|
||||||
|
private final NumberSetting pitchError = new NumberSetting("Pitch error", 0.1, 0.01, 1.0, 0.01);
|
||||||
|
|
||||||
|
AccelerationSmoothingPart() {
|
||||||
|
super("Constant error", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
package openonyx.protocol.internal.internal.internal.internal;
|
||||||
|
|
||||||
|
import openonyx.history.SettingSection;
|
||||||
|
import openonyx.history.internal.NumberSetting;
|
||||||
|
import openonyx.protocol.group_d.RotationAngleMath;
|
||||||
|
|
||||||
|
class AccelerationSmoothingPart2 extends SettingSection {
|
||||||
|
private final NumberSetting slowdownSharpness = new NumberSetting("Slowdown sharpness", 10.0, 0.0, 20.0, 0.1)
|
||||||
|
.describe("How abruptly the aim shifts between slow (near the target) and full speed (far from it)");
|
||||||
|
private final NumberSetting halfSpeedDistance = new NumberSetting("Half speed distance", 0.3, 0.0, 1.0, 0.01)
|
||||||
|
.describe("Fraction of a 120° turn left to the target at which the aim moves at half speed");
|
||||||
|
|
||||||
|
AccelerationSmoothingPart2() {
|
||||||
|
super("Sigmoid deceleration", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
float L(float f) {
|
||||||
|
double d = f / 120.0F;
|
||||||
|
return RotationAngleMath.L((float)(1.0 / (1.0 + Math.exp(-this.slowdownSharpness.getValue() * (d - this.halfSpeedDistance.getValue())))), 0.0F, 180.0F);
|
||||||
|
}
|
||||||
|
}
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
package openonyx.protocol.internal.internal.internal.internal;
|
||||||
|
|
||||||
|
import openonyx.history.SettingSection;
|
||||||
|
import openonyx.history.internal.NumberSetting;
|
||||||
|
|
||||||
|
class AccelerationSmoothingPart3 extends SettingSection {
|
||||||
|
private final NumberSetting yawError = new NumberSetting("Yaw error", 0.1, 0.01, 1.0, 0.01);
|
||||||
|
private final NumberSetting pitchError = new NumberSetting("Pitch error", 0.1, 0.01, 1.0, 0.01);
|
||||||
|
|
||||||
|
AccelerationSmoothingPart3() {
|
||||||
|
super("Acceleration error", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user