@@ -53,26 +53,6 @@ interface IRotationRequest : Automated {
5353
5454 fun updateRotation ()
5555
56- class Pitch (
57- automated : Automated ,
58- val buildPitch : SafeContext .() -> Double
59- ) : RotationRequest(automated), PitchRot {
60- override val pitch = updatableLazy { runSafe { buildPitch() } }
61- override var keepTicks = rotationConfig.keepTicks
62- override var decayTicks = rotationConfig.decayTicks
63- override var age = 0
64-
65- override val done get(): Boolean {
66- return abs(RotationManager .activeRotation.pitch - (pitch.value ? : return false )) <= 0.001
67- }
68-
69- override fun dist (rotation : Rotation ): Double {
70- return wrap((pitch.value ? : return Double .MAX_VALUE ) - rotation.pitch)
71- }
72-
73- override fun updateRotation () = pitch.update()
74- }
75-
7656 class Yaw (
7757 automated : Automated ,
7858 val buildYaw : SafeContext .() -> Double
@@ -96,6 +76,26 @@ interface IRotationRequest : Automated {
9676 override fun updateRotation () = yaw.update()
9777 }
9878
79+ class Pitch (
80+ automated : Automated ,
81+ val buildPitch : SafeContext .() -> Double
82+ ) : RotationRequest(automated), PitchRot {
83+ override val pitch = updatableLazy { runSafe { buildPitch() } }
84+ override var keepTicks = rotationConfig.keepTicks
85+ override var decayTicks = rotationConfig.decayTicks
86+ override var age = 0
87+
88+ override val done get(): Boolean {
89+ return abs(RotationManager .activeRotation.pitch - (pitch.value ? : return false )) <= 0.001
90+ }
91+
92+ override fun dist (rotation : Rotation ): Double {
93+ return wrap((pitch.value ? : return Double .MAX_VALUE ) - rotation.pitch)
94+ }
95+
96+ override fun updateRotation () = pitch.update()
97+ }
98+
9999 class Full (
100100 automated : Automated ,
101101 val buildRotation : SafeContext .() -> Rotation
@@ -122,42 +122,42 @@ interface IRotationRequest : Automated {
122122 override fun updateRotation () = rotation.update()
123123 }
124124
125- interface PitchRot : IRotationRequest { val pitch: UpdatableLazy <Double ?> }
126125 interface YawRot : IRotationRequest { val yaw: UpdatableLazy <Double ?> }
126+ interface PitchRot : IRotationRequest { val pitch: UpdatableLazy <Double ?> }
127127 interface FullRot : YawRot , PitchRot { val rotation: UpdatableLazy <Rotation ?> }
128128
129129 class RotationRequestBuilder {
130130 var pitchBuilder: (SafeContext .() -> Double )? = null
131131 var yawBuilder: (SafeContext .() -> Double )? = null
132132 var rotationBuilder: (SafeContext .() -> Rotation )? = null
133133
134- @JvmName(" pitchBuilder1 " )
134+ @JvmName(" yawBuilder1 " )
135135 @RotationRequestDsl
136- fun pitch (builder : SafeContext .() -> Double ) { pitchBuilder = builder }
136+ fun yaw (builder : SafeContext .() -> Double ) { yawBuilder = builder }
137137
138- @JvmName(" pitchBuilder2 " )
138+ @JvmName(" yawBuilder2 " )
139139 @RotationRequestDsl
140- fun pitch (builder : SafeContext .() -> Float ) { pitchBuilder = { builder().toDouble() } }
140+ fun yaw (builder : SafeContext .() -> Float ) { yawBuilder = { builder().toDouble() } }
141141
142142 @RotationRequestDsl
143- fun pitch ( pitch : Double ) { pitchBuilder = { pitch } }
143+ fun yaw ( yaw : Double ) { yawBuilder = { yaw } }
144144
145145 @RotationRequestDsl
146- fun pitch ( pitch : Float ) { pitchBuilder = { pitch .toDouble() } }
146+ fun yaw ( yaw : Float ) { yawBuilder = { yaw .toDouble() } }
147147
148- @JvmName(" yawBuilder1 " )
148+ @JvmName(" pitchBuilder1 " )
149149 @RotationRequestDsl
150- fun yaw (builder : SafeContext .() -> Double ) { yawBuilder = builder }
150+ fun pitch (builder : SafeContext .() -> Double ) { pitchBuilder = builder }
151151
152- @JvmName(" yawBuilder2 " )
152+ @JvmName(" pitchBuilder2 " )
153153 @RotationRequestDsl
154- fun yaw (builder : SafeContext .() -> Float ) { yawBuilder = { builder().toDouble() } }
154+ fun pitch (builder : SafeContext .() -> Float ) { pitchBuilder = { builder().toDouble() } }
155155
156156 @RotationRequestDsl
157- fun yaw ( yaw : Double ) { yawBuilder = { yaw } }
157+ fun pitch ( pitch : Double ) { pitchBuilder = { pitch } }
158158
159159 @RotationRequestDsl
160- fun yaw ( yaw : Float ) { yawBuilder = { yaw .toDouble() } }
160+ fun pitch ( pitch : Float ) { pitchBuilder = { pitch .toDouble() } }
161161
162162 @RotationRequestDsl
163163 fun rotation (builder : SafeContext .() -> Rotation ) { rotationBuilder = builder }
@@ -182,14 +182,14 @@ interface IRotationRequest : Automated {
182182 @RotationRequestDsl
183183 context(automated: Automated )
184184 private fun RotationRequestBuilder.build (): RotationRequest {
185- val pitchBuilder = pitchBuilder
186185 val yawBuilder = yawBuilder
186+ val pitchBuilder = pitchBuilder
187187 val rotationBuilder = rotationBuilder
188188 return when {
189189 rotationBuilder != null -> Full (automated, rotationBuilder)
190- pitchBuilder != null && yawBuilder != null -> Full (automated) { Rotation (pitchBuilder(), yawBuilder()) }
191- pitchBuilder != null -> Pitch (automated, pitchBuilder)
190+ yawBuilder != null && pitchBuilder != null -> Full (automated) { Rotation (yawBuilder(), pitchBuilder()) }
192191 yawBuilder != null -> Yaw (automated, yawBuilder)
192+ pitchBuilder != null -> Pitch (automated, pitchBuilder)
193193 else -> throw IllegalArgumentException (" Must specify at least one rotation value to build a rotation request" )
194194 }
195195 }
0 commit comments