Skip to content

Commit bcd85d0

Browse files
committed
small cleanup
1 parent a17514e commit bcd85d0

File tree

1 file changed

+12
-11
lines changed
  • common/src/main/kotlin/com/lambda/module/modules/render

1 file changed

+12
-11
lines changed

common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ object ViewModel : Module(
133133
}
134134

135135
private fun getPositionVec(side: Side, emptyHand: Boolean): Vector3f {
136-
when (side) {
136+
return when (side) {
137137
Side.Left -> {
138-
return if (emptyHand) {
138+
if (emptyHand) {
139139
Vector3f(
140140
-handXPosition,
141141
handYPosition,
@@ -150,7 +150,7 @@ object ViewModel : Module(
150150
}
151151
}
152152
Side.Right -> {
153-
return if (emptyHand) {
153+
if (emptyHand) {
154154
Vector3f(
155155
handXPosition,
156156
handYPosition,
@@ -169,16 +169,15 @@ object ViewModel : Module(
169169

170170
private fun rotate(side: Side, matrices: MatrixStack, emptyHand: Boolean) {
171171
val rotationVec = getRotationVec(side, emptyHand)
172-
173172
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(rotationVec.x.toFloat()))
174173
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(rotationVec.y.toFloat()))
175174
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(rotationVec.z.toFloat()))
176175
}
177176

178177
private fun getRotationVec(side: Side, emptyHand: Boolean): Vector3i {
179-
when (side) {
178+
return when (side) {
180179
Side.Left -> {
181-
return if (emptyHand) {
180+
if (emptyHand) {
182181
Vector3i(
183182
handXRotation,
184183
-handYRotation,
@@ -193,7 +192,7 @@ object ViewModel : Module(
193192
}
194193
}
195194
Side.Right -> {
196-
return if (emptyHand) {
195+
if (emptyHand) {
197196
Vector3i(
198197
handXRotation,
199198
handYRotation,
@@ -226,10 +225,12 @@ object ViewModel : Module(
226225
}
227226

228227
private fun swingHand(hand: Hand, player: AbstractClientPlayerEntity) {
229-
if ((!player.handSwinging || player.handSwingTicks >= player.handSwingDuration / 2) || player.handSwingTicks < 0) {
230-
player.handSwingTicks = -1
231-
player.handSwinging = true
232-
player.preferredHand = hand
228+
with(player) {
229+
if ((!handSwinging || handSwingTicks >= handSwingDuration / 2) || handSwingTicks < 0) {
230+
handSwingTicks = -1
231+
handSwinging = true
232+
preferredHand = hand
233+
}
233234
}
234235
}
235236
}

0 commit comments

Comments
 (0)