diff --git a/src/openonyx/features/player/internal/ScaffoldRotationSettings.java b/src/openonyx/features/player/internal/ScaffoldRotationSettings.java new file mode 100644 index 0000000..626def6 --- /dev/null +++ b/src/openonyx/features/player/internal/ScaffoldRotationSettings.java @@ -0,0 +1,35 @@ +package openonyx.features.player.internal; + +import java.util.List; +import openonyx.history.Setting; +import openonyx.history.internal.BooleanSetting; +import openonyx.history.internal.NumberSetting; +import openonyx.protocol.RotationConfig; +import openonyx.protocol.RotationRequest; + +public class ScaffoldRotationSettings extends RotationConfig { + public BooleanSetting considerInventory = new BooleanSetting("Consider inventory", false).visibleWhen(Setting.BOOLEAN_SUPPLIER); + private final transient FeatureSupport_419 featureSupport_419; + public NumberSetting rotationVariance = new NumberSetting("Rotation variance", 0.3, 0.0, 3.0, 0.05) + .withSuffix("°") + .describe("Wobbles the sent yaw by a mouse step or two each tick so no two placements go out with the same yaw (Grim DuplicateRotPlace). 0 turns it off."); + + public RotationRequest L(RotationRequest rotationRequest) { + return this.rotationVariance.getValue() <= 0.0 + ? rotationRequest + : new RotationRequest( + rotationRequest.getAngles(), + rotationRequest.getEntity(), + List.of(new ScaffoldRotationSettingsPart(this, rotationRequest.getRotationSmoothers())), + rotationRequest.L(), + rotationRequest.L(), + rotationRequest.L(), + rotationRequest.getMovementFixMode(), + rotationRequest.getConditionalAction() + ); + } + + public ScaffoldRotationSettings() { + this.featureSupport_419 = new FeatureSupport_419(); + } +} diff --git a/src/openonyx/features/player/internal/ScaffoldRotationSettingsPart.java b/src/openonyx/features/player/internal/ScaffoldRotationSettingsPart.java new file mode 100644 index 0000000..65f5483 --- /dev/null +++ b/src/openonyx/features/player/internal/ScaffoldRotationSettingsPart.java @@ -0,0 +1,30 @@ +package openonyx.features.player.internal; + +import java.util.Iterator; +import java.util.List; +import openonyx.protocol.RotationRequest; +import openonyx.protocol.group_m.Angles; +import openonyx.protocol.internal.internal.RotationSmoother; + +final class ScaffoldRotationSettingsPart implements RotationSmoother { + private final List rotationSmoothers; + + private ScaffoldRotationSettingsPart(ScaffoldRotationSettings scaffoldRotationSettings, List list) { + this.scaffoldRotationSettings = scaffoldRotationSettingsx; + this.rotationSmoothers = list; + } + + @Override + public Angles L(RotationRequest rotationRequest, Angles angles, Angles angles1) { + angles1 = angles1; + + Iterator iterator; + for (Iterator iterator1 = iterator = this.rotationSmoothers.iterator(); iterator1.hasNext(); iterator1 = iterator) { + angles1 = ((RotationSmoother)iterator.next()).L(rotationRequest, angles, angles1); + } + + return new Angles( + this.scaffoldRotationSettings.featureSupport_419.L(angles1.yaw2(), this.scaffoldRotationSettings.rotationVariance.getValue()), angles1.pitch2() + ); + } +}