Skip to content

Commit ca1b162

Browse files
committed
better split settings
1 parent 5000f3e commit ca1b162

File tree

1 file changed

+57
-48
lines changed
  • common/src/main/kotlin/com/lambda/module/modules/render

1 file changed

+57
-48
lines changed

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

Lines changed: 57 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -26,59 +26,68 @@ object ViewModel : Module(
2626
) {
2727
private val page by setting("Page", Page.General)
2828

29-
//ToDo: implement the rest of the settings and maybe add a couple more
30-
3129
private val ignoreHand by setting("Ignore Hand", false, "Prevents adjusting the players hand") { page == Page.General }
3230
private val swingMode by setting("Swing Mode", SwingMode.Standard, "Changes which hands swing") { page == Page.General }
3331
val swingDuration by setting("Swing Duration", 6, 0..20, 1, "Adjusts how fast the player swings", "ticks") { page == Page.General }
3432
private val noSwingDelay by setting("No Swing Delay", false, "Removes the delay between swings") { page == Page.General }
3533
val mainSwingProgress by setting("Main Swing Progress", 0.0f, 0.0f..1.0f, 0.025f, "Renders as if the players main hand was this progress through the swing animation") { page == Page.General }
3634
val offhandSwingProgress by setting("Offhand Swing Progress", 0.0f, 0.0f..1.0f, 0.025f, "Renders as if the players offhand was this progress through the swing animation") { page == Page.General }
3735
val oldAnimations by setting("Old Animations", false, "Adjusts the animations to look like they did in 1.8") { page == Page.General }
38-
val swapAnimation by setting("Swap Animation", true, "If disabled, it removes the drop down animation when swapping item") { page == Page.General && oldAnimations }
39-
val shadow by setting("Shadows", true, "If disabled, it removes shadows on the model") { page == Page.General }
40-
41-
private val linkedScale by setting("Linked Scale", true, "Links both hands scale settings") { page == Page.Scale }
42-
private val leftXScale by setting("Left X Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale }.apply { onValueChange { _, to -> if (linkedScale) rightXScale = to } }
43-
private val leftYScale by setting("Left Y Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale }.apply { onValueChange { _, to -> if (linkedScale) rightYScale = to } }
44-
private val leftZScale by setting("Left Z Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale }.apply { onValueChange { _, to -> if (linkedScale) rightZScale = to } }
45-
private var rightXScale by setting("Right X Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && !linkedScale }
46-
private var rightYScale by setting("Right Y Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && !linkedScale }
47-
private var rightZScale by setting("Right Z Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && !linkedScale }
48-
49-
private val linkedPosition by setting("Linked Position", true, "Links both hands position settings") { page == Page.Position }
50-
private val leftXPosition by setting("Left X Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position }.apply { onValueChange { _, to -> if (linkedPosition) rightXPosition = to } }
51-
private val leftYPosition by setting("Left Y Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position }.apply { onValueChange { _, to -> if (linkedPosition) rightYPosition = to } }
52-
private val leftZPosition by setting("Left Z Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position }.apply { onValueChange { _, to -> if (linkedPosition) rightZPosition = to } }
53-
private var rightXPosition by setting("Right X Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && !linkedPosition }
54-
private var rightYPosition by setting("Right Y Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && !linkedPosition }
55-
private var rightZPosition by setting("Right Z Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && !linkedPosition }
56-
57-
private val linkedRotation by setting("Linked Rotation", true, "Links both hands rotation settings") { page == Page.Rotation }
58-
private val leftXRotation by setting("Left X Rotation", 0, -180..180, 1) { page == Page.Rotation }.apply { onValueChange { _, to -> if (linkedRotation) rightXRotation = to } }
59-
private val leftYRotation by setting("Left Y Rotation", 0, -180..180, 1) { page == Page.Rotation }.apply { onValueChange { _, to -> if (linkedRotation) rightYRotation = to } }
60-
private val leftZRotation by setting("Left Z Rotation", 0, -180..180, 1) { page == Page.Rotation }.apply { onValueChange { _, to -> if (linkedRotation) rightZRotation = to } }
61-
private var rightXRotation by setting("Right X Rotation", 0, -180..180, 1) { page == Page.Rotation && !linkedRotation }
62-
private var rightYRotation by setting("Right Y Rotation", 0, -180..180, 1) { page == Page.Rotation && !linkedRotation }
63-
private var rightZRotation by setting("Right Z Rotation", 0, -180..180, 1) { page == Page.Rotation && !linkedRotation }
64-
65-
private val linkedFOV by setting("Linked FOV", true, "Links both hands FOV settings") { page == Page.FOV }
66-
private val leftFOV by setting("Left FOV", 70, 10..180, 1) { page == Page.FOV }.apply { onValueChange { _, to -> if (linkedFOV) rightFOV = to } }
67-
private var leftFOVAnchorDistance by setting("Left FOV Anchor Distance", 0.5f, 0.0f..1.0f, 0.01f, "The distance to anchor the left hands fov transformation from") { page == Page.FOV }.apply { onValueChange { _, to -> if (linkedFOV) rightFOVAnchorDistance = to } }
68-
private var rightFOV by setting("Right FOV", 70, 10..180, 1) { page == Page.FOV && !linkedFOV }
69-
private var rightFOVAnchorDistance by setting("Right FOV Anchor Distance", 0.5f, 0.0f..1.0f, 0.01f, "The distance to anchor the right hands fov transformation from") { page == Page.FOV && !linkedFOV }
36+
val swapAnimation by setting("Swap Animation", true, "If disabled, removes the drop down animation when swapping item") { page == Page.General && oldAnimations }
37+
val shadow by setting("Shadows", true, "If disabled, removes shadows on the model") { page == Page.General }
38+
39+
private val splitScale by setting("Split Scale", false, "Splits left and right hand scale settings") { page == Page.Scale }
40+
private val xScale by setting("X Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && !splitScale }.apply { onValueChange { _, to -> leftXScale = to; rightXScale = to } }
41+
private val yScale by setting("Y Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && !splitScale }.apply { onValueChange { _, to -> leftYScale = to; rightYScale = to } }
42+
private val zScale by setting("Z Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && !splitScale }.apply { onValueChange { _, to -> leftZScale = to; rightZScale = to } }
43+
private var leftXScale by setting("Left X Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && splitScale }
44+
private var leftYScale by setting("Left Y Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && splitScale }
45+
private var leftZScale by setting("Left Z Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && splitScale }
46+
private var rightXScale by setting("Right X Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && splitScale }
47+
private var rightYScale by setting("Right Y Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && splitScale }
48+
private var rightZScale by setting("Right Z Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && splitScale }
49+
50+
private val splitPosition by setting("Split Position", false, "Splits left and right position settings") { page == Page.Position }
51+
private val xPosition by setting("X Position", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && !splitPosition }.apply { onValueChange { _, to -> leftXPosition = to; rightXPosition = to } }
52+
private val yPosition by setting("Y Position", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && !splitPosition }.apply { onValueChange { _, to -> leftYPosition = to; rightYPosition = to } }
53+
private val zPosition by setting("Z Position", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && !splitPosition }.apply { onValueChange { _, to -> leftZPosition = to; rightZPosition = to } }
54+
private var leftXPosition by setting("Left X Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && splitPosition }
55+
private var leftYPosition by setting("Left Y Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && splitPosition }
56+
private var leftZPosition by setting("Left Z Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && splitPosition }
57+
private var rightXPosition by setting("Right X Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && splitPosition }
58+
private var rightYPosition by setting("Right Y Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && splitPosition }
59+
private var rightZPosition by setting("Right Z Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && splitPosition }
60+
61+
private val splitRotation by setting("Split Rotation", false, "Splits left and right rotation settings") { page == Page.Rotation }
62+
private val xRotation by setting("X Rotation", 0, -180..180, 1) { page == Page.Rotation && !splitRotation }.apply { onValueChange { _, to -> leftXRotation = to; rightXRotation = to } }
63+
private val yRotation by setting("Y Rotation", 0, -180..180, 1) { page == Page.Rotation && !splitRotation }.apply { onValueChange { _, to -> leftYRotation = to; rightYRotation = to } }
64+
private val zRotation by setting("Z Rotation", 0, -180..180, 1) { page == Page.Rotation && !splitRotation }.apply { onValueChange { _, to -> leftZRotation = to; rightZRotation = to } }
65+
private var leftXRotation by setting("Left X Rotation", 0, -180..180, 1) { page == Page.Rotation && splitRotation }
66+
private var leftYRotation by setting("Left Y Rotation", 0, -180..180, 1) { page == Page.Rotation && splitRotation }
67+
private var leftZRotation by setting("Left Z Rotation", 0, -180..180, 1) { page == Page.Rotation && splitRotation }
68+
private var rightXRotation by setting("Right X Rotation", 0, -180..180, 1) { page == Page.Rotation && splitRotation }
69+
private var rightYRotation by setting("Right Y Rotation", 0, -180..180, 1) { page == Page.Rotation && splitRotation }
70+
private var rightZRotation by setting("Right Z Rotation", 0, -180..180, 1) { page == Page.Rotation && splitRotation }
71+
72+
private val splitFov by setting("Split FOV", false, "Splits left and right Fov settings") { page == Page.Fov }
73+
private val fov by setting("FOV", 70, 10..180, 1) { page == Page.Fov && !splitFov }.apply { onValueChange { _, to -> leftFov = to; rightFov = to } }
74+
private val fovAnchorDistance by setting("Anchor Distance", 0.5f, 0.0f..1.0f, 0.01f, "The distance to anchor the FOV transformation from") { page == Page.Fov && !splitFov }.apply { onValueChange { _, to -> leftFovAnchorDistance = to; rightFovAnchorDistance = to } }
75+
private var leftFov by setting("Left FOV", 70, 10..180, 1) { page == Page.Fov && splitFov}
76+
private var leftFovAnchorDistance by setting("Left Anchor Distance", 0.5f, 0.0f..1.0f, 0.01f, "The distance to anchor the left FOV transformation from") { page == Page.Fov && splitFov }
77+
private var rightFov by setting("Right FOV", 70, 10..180, 1) { page == Page.Fov && splitFov }
78+
private var rightFovAnchorDistance by setting("Right Anchor Distance", 0.5f, 0.0f..1.0f, 0.01f, "The distance to anchor the right FOV transformation from") { page == Page.Fov && splitFov }
7079

7180
private val handXScale by setting("Hand X Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
7281
private val handYScale by setting("Hand Y Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
7382
private val handZScale by setting("Hand Z Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
7483
private val handXPosition by setting("Hand X Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
7584
private val handYPosition by setting("Hand Y Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
7685
private val handZPosition by setting("Hand Z Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
77-
private var handXRotation by setting("Hand X Rotation", 0, -180..180, 1) { page == Page.Hand }
78-
private var handYRotation by setting("Hand Y Rotation", 0, -180..180, 1) { page == Page.Hand }
79-
private var handZRotation by setting("Hand Z Rotation", 0, -180..180, 1) { page == Page.Hand }
80-
private val handFOV by setting("Hand FOV", 70, 10..180, 1) { page == Page.Hand }
81-
private var handFOVAnchorDistance by setting("Hand FOV Anchor Distance", 0.5f, 0.0f..1.0f, 0.01f, "The distance to anchor the hands fov transformation from") { page == Page.Hand }
86+
private val handXRotation by setting("Hand X Rotation", 0, -180..180, 1) { page == Page.Hand }
87+
private val handYRotation by setting("Hand Y Rotation", 0, -180..180, 1) { page == Page.Hand }
88+
private val handZRotation by setting("Hand Z Rotation", 0, -180..180, 1) { page == Page.Hand }
89+
private val handFov by setting("Hand FOV", 70, 10..180, 1) { page == Page.Hand }
90+
private val handFovAnchorDistance by setting("Hand FOV Anchor Distance", 0.5f, 0.0f..1.0f, 0.01f, "The distance to anchor the hands FOV transformation from") { page == Page.Hand }
8291

8392
private var attackKeyTicksPressed = -1
8493

@@ -119,17 +128,17 @@ object ViewModel : Module(
119128
val emptyHand = itemStack.isEmpty
120129
if (ignoreHand && emptyHand) return
121130

122-
applyItemFOV(matrices, side, emptyHand)
131+
applyItemFov(matrices, side, emptyHand)
123132
scale(side, matrices, emptyHand)
124133
position(side, matrices, emptyHand)
125134
rotate(side, matrices, emptyHand)
126135
}
127136

128-
private fun applyItemFOV(matrices: MatrixStack, side: Side, emptyHand: Boolean) {
137+
private fun applyItemFov(matrices: MatrixStack, side: Side, emptyHand: Boolean) {
129138
val fov = when {
130-
side == Side.Left -> leftFOV
131-
emptyHand -> handFOV
132-
else -> rightFOV
139+
side == Side.Left -> leftFov
140+
emptyHand -> handFov
141+
else -> rightFov
133142
}.toFloat()
134143

135144
if (fov == 70f) return
@@ -139,11 +148,11 @@ object ViewModel : Module(
139148
val matrix = matrices.peek().positionMatrix
140149

141150
val distance = if (emptyHand) {
142-
handFOVAnchorDistance
151+
handFovAnchorDistance
143152
} else {
144153
when (side) {
145-
Side.Left -> leftFOVAnchorDistance
146-
Side.Right -> rightFOVAnchorDistance
154+
Side.Left -> leftFovAnchorDistance
155+
Side.Right -> rightFovAnchorDistance
147156
}
148157
}
149158

@@ -226,7 +235,7 @@ object ViewModel : Module(
226235
}
227236

228237
private enum class Page {
229-
General, Scale, Position, Rotation, FOV, Hand
238+
General, Scale, Position, Rotation, Fov, Hand
230239
}
231240

232241
private enum class Side {

0 commit comments

Comments
 (0)