From 29d95e97a13e3fae52f5582acf31fd5b7c67f0c6 Mon Sep 17 00:00:00 2001 From: beanbag44 Date: Thu, 15 Aug 2024 23:10:35 +0100 Subject: [PATCH 01/16] view model base --- .../mixin/render/HeldItemRendererMixin.java | 26 +++ .../lambda/module/modules/render/ViewModel.kt | 204 ++++++++++++++++++ .../main/resources/lambda.mixins.common.json | 1 + 3 files changed, 231 insertions(+) create mode 100644 common/src/main/java/com/lambda/mixin/render/HeldItemRendererMixin.java create mode 100644 common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt diff --git a/common/src/main/java/com/lambda/mixin/render/HeldItemRendererMixin.java b/common/src/main/java/com/lambda/mixin/render/HeldItemRendererMixin.java new file mode 100644 index 000000000..df7ae0ec8 --- /dev/null +++ b/common/src/main/java/com/lambda/mixin/render/HeldItemRendererMixin.java @@ -0,0 +1,26 @@ +package com.lambda.mixin.render; + +import com.lambda.module.modules.render.ViewModel; +import net.minecraft.client.network.AbstractClientPlayerEntity; +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.item.HeldItemRenderer; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Hand; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(HeldItemRenderer.class) +public class HeldItemRendererMixin { + @Inject(method = "renderFirstPersonItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderArmHoldingItem(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IFFLnet/minecraft/util/Arm;)V")) + private void onRenderArmHoldingItem(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack itemStack, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { + if (ViewModel.INSTANCE.isEnabled()) ViewModel.INSTANCE.transform(itemStack, hand, matrices); + } + + @Inject(method = "renderFirstPersonItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V")) + private void onRenderFirstPersonItem(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack itemStack, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { + if (ViewModel.INSTANCE.isEnabled()) ViewModel.INSTANCE.transform(itemStack, hand, matrices); + } +} \ No newline at end of file diff --git a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt new file mode 100644 index 000000000..2aeee5d9e --- /dev/null +++ b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt @@ -0,0 +1,204 @@ +package com.lambda.module.modules.render + +import com.lambda.Lambda.mc +import com.lambda.module.Module +import com.lambda.module.tag.ModuleTag +import net.minecraft.client.util.math.MatrixStack +import net.minecraft.item.ItemStack +import net.minecraft.util.Arm +import net.minecraft.util.Hand +import net.minecraft.util.math.RotationAxis +import org.joml.Vector3f +import org.joml.Vector3i + +object ViewModel : Module( + name = "View Model", + description = "Adjusts hand and held item rendering", + defaultTags = setOf(ModuleTag.RENDER) +) { + private val page by setting("Page", Page.General) + + //ToDo: implement the rest of the settings and maybe add a couple more + + private val ignoreHand by setting("Ignore Hand", false, "Prevents adjusting the players hand", visibility = { page == Page.General }) + val oldSwingAnimation by setting("Old Swing Animation", false, "Adjusts the swing animation to what it looked like in 1.8", visibility = { page == Page.General }) + val swapAnimation by setting("Swap Animation", true, "If disabled, it removes the drop down animation when swapping item", visibility = { page == Page.General }) + val shadow by setting("Shadows", true, "If disabled, it removes shadows on the model", visibility = { page == Page.General }) + + private val linkedScale by setting("Linked", true, "Links both hands scale settings", visibility = { page == Page.Scale }) + private val leftXScale by setting("Left X Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale }).apply { onValueChange { _, to -> if (linkedScale) rightXScale = to } } + private val leftYScale by setting("Left Y Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale }).apply { onValueChange { _, to -> if (linkedScale) rightYScale = to } } + private val leftZScale by setting("Left Z Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale }).apply { onValueChange { _, to -> if (linkedScale) rightZScale = to } } + private var rightXScale by setting("Right X Scale", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale && !linkedScale }) + private var rightYScale by setting("Right Y Scale", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale && !linkedScale }) + private var rightZScale by setting("Right Z Scale", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale && !linkedScale }) + + private val linkedPosition by setting("Linked", true, "Links both hands position settings", visibility = { page == Page.Position }) + private val leftXPosition by setting("Left X Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Position }).apply { onValueChange { _, to -> if (linkedPosition) rightXPosition = to } } + private val leftYPosition by setting("Left Y Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Position }).apply { onValueChange { _, to -> if (linkedPosition) rightYPosition = to } } + private val leftZPosition by setting("Left Z Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Position }).apply { onValueChange { _, to -> if (linkedPosition) rightZPosition = to } } + private var rightXPosition by setting("Right X Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Position && !linkedPosition }) + private var rightYPosition by setting("Right Y Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Position && !linkedPosition }) + private var rightZPosition by setting("Right Z Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Position && !linkedPosition }) + + private val linkedRotation by setting("Linked", true, "Links both hands rotation settings", visibility = { page == Page.Rotation }) + private val leftXRotation by setting("Left X Rotation", 0, -180..180, 1, visibility = { page == Page.Rotation }).apply { onValueChange { _, to -> if (linkedRotation) rightXRotation = to } } + private val leftYRotation by setting("Left Y Rotation", 0, -180..180, 1, visibility = { page == Page.Rotation }).apply { onValueChange { _, to -> if (linkedRotation) rightYRotation = to } } + private val leftZRotation by setting("Left Z Rotation", 0, -180..180, 1, visibility = { page == Page.Rotation }).apply { onValueChange { _, to -> if (linkedRotation) rightZRotation = to } } + private var rightXRotation by setting("Right X Rotation", 0, -180..180, 1, visibility = { page == Page.Rotation && !linkedRotation }) + private var rightYRotation by setting("Right Y Rotation", 0, -180..180, 1, visibility = { page == Page.Rotation && !linkedRotation }) + private var rightZRotation by setting("Right Z Rotation", 0, -180..180, 1, visibility = { page == Page.Rotation && !linkedRotation }) + + private val linkedFOV by setting("Linked FOV", true, "Links both hands FOV settings", visibility = { page == Page.FOV }) + private val leftFOV by setting ("Left FOV", 80, 10..180, 1, visibility = { page == Page.FOV }).apply { onValueChange { _, to -> if (linkedFOV) rightFOV = to } } + private var rightFOV by setting ("Right FOV", 80, 10..180, 1, visibility = { page == Page.FOV && !linkedFOV }) + + private val handXScale by setting("Hand X Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Hand }) + private val handYScale by setting("Hand Y Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Hand }) + private val handZScale by setting("Hand Z Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Hand }) + private val handXPosition by setting("Hand X Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Hand }) + private val handYPosition by setting("Hand Y Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Hand }) + private val handZPosition by setting("Hand Z Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Hand }) + private var handXRotation by setting("Hand X Rotation", 0, -180..180, 1, visibility = { page == Page.Hand }) + private var handYRotation by setting("Hand Y Rotation", 0, -180..180, 1, visibility = { page == Page.Hand }) + private var handZRotation by setting("Hand Z Rotation", 0, -180..180, 1, visibility = { page == Page.Hand }) + private val handFOV by setting("Hand FOV", 80, 10..180, 1, visibility = { page == Page.Hand }) + + private enum class Page { + General, Scale, Position, Rotation, FOV, Hand + } + + private enum class Side { + Left, Right + } + + fun transform(itemStack: ItemStack, hand: Hand, matrices: MatrixStack) { + val side = if (mc.options.mainArm.value == Arm.LEFT) { + if (hand == Hand.MAIN_HAND) Side.Left else Side.Right + } else { + if (hand == Hand.MAIN_HAND) Side.Right else Side.Left + } + + val emptyHand = itemStack.isEmpty + if (ignoreHand && emptyHand) return + + scale(side, matrices, emptyHand) + position(side, matrices, emptyHand) + rotate(side, matrices, emptyHand) + } + + private fun scale(side: Side, matrices: MatrixStack, emptyHand: Boolean) { + val scaleVec = getScaleVec(side, emptyHand) + matrices.scale(scaleVec.x, scaleVec.y, scaleVec.z) + } + + private fun getScaleVec(side: Side, emptyHand: Boolean): Vector3f { + if (emptyHand) { + return Vector3f( + handXScale, + handYScale, + handZScale + ) + } + + when (side) { + Side.Left -> { + return Vector3f( + leftXScale, + leftYScale, + leftZScale + ) + } + Side.Right -> { + return Vector3f( + rightXScale, + rightYScale, + rightZScale + ) + } + } + } + + private fun position(side: Side, matrices: MatrixStack, emptyHand: Boolean) { + val positionVec = getPositionVec(side, emptyHand) + matrices.translate(positionVec.x, positionVec.y, positionVec.z) + } + + private fun getPositionVec(side: Side, emptyHand: Boolean): Vector3f { + when (side) { + Side.Left -> { + return if (emptyHand) { + Vector3f( + -handXPosition, + handYPosition, + handZPosition + ) + } else { + Vector3f( + -leftXPosition, + leftYPosition, + leftZPosition + ) + } + } + Side.Right -> { + return if (emptyHand) { + Vector3f( + handXPosition, + handYPosition, + handZPosition + ) + } else { + Vector3f( + rightXPosition, + rightYPosition, + rightZPosition + ) + } + } + } + } + + private fun rotate(side: Side, matrices: MatrixStack, emptyHand: Boolean) { + val rotationVec = getRotationVec(side, emptyHand) + + matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(rotationVec.x.toFloat())) + matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(rotationVec.y.toFloat())) + matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(rotationVec.z.toFloat())) + } + + private fun getRotationVec(side: Side, emptyHand: Boolean): Vector3i { + when (side) { + Side.Left -> { + return if (emptyHand) { + Vector3i( + handXRotation, + -handYRotation, + -handZRotation + ) + } else { + Vector3i( + leftXRotation, + -leftYRotation, + -leftZRotation + ) + } + } + Side.Right -> { + return if (emptyHand) { + Vector3i( + handXRotation, + handYRotation, + handZRotation + ) + } else { + Vector3i( + rightXRotation, + rightYRotation, + rightZRotation + ) + } + } + } + } +} \ No newline at end of file diff --git a/common/src/main/resources/lambda.mixins.common.json b/common/src/main/resources/lambda.mixins.common.json index ff8a0378b..840faecb7 100644 --- a/common/src/main/resources/lambda.mixins.common.json +++ b/common/src/main/resources/lambda.mixins.common.json @@ -24,6 +24,7 @@ "render.DebugHudMixin", "render.GameRendererMixin", "render.GlStateManagerMixin", + "render.HeldItemRendererMixin", "render.InGameHudMixin", "render.InGameOverlayRendererMixin", "render.LightmapTextureManagerMixin", From f3af72142c1e0e4b28f4b3aadd1a19a220f5831d Mon Sep 17 00:00:00 2001 From: beanbag44 Date: Fri, 16 Aug 2024 17:16:39 +0100 Subject: [PATCH 02/16] added few more settings --- .../kotlin/com/lambda/module/modules/render/ViewModel.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt index 2aeee5d9e..08a845028 100644 --- a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt +++ b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt @@ -21,6 +21,9 @@ object ViewModel : Module( //ToDo: implement the rest of the settings and maybe add a couple more private val ignoreHand by setting("Ignore Hand", false, "Prevents adjusting the players hand", visibility = { page == Page.General }) + val swingMode by setting("Swing Mode", SwingMode.MainHand, "Changes which hands swing", visibility = { page == Page.General }) + val swingSpeed by setting("Swing Speed", 6, 0..20, 1, "Adjusts how fast the player swings", visibility = { page == Page.General }) + val swingProgress by setting("Swing Progress", 0.0f, 0.0f..1.0f, 0.025f, "Renders as if the player was this progress through the swing animation", visibility = { page == Page.General }) val oldSwingAnimation by setting("Old Swing Animation", false, "Adjusts the swing animation to what it looked like in 1.8", visibility = { page == Page.General }) val swapAnimation by setting("Swap Animation", true, "If disabled, it removes the drop down animation when swapping item", visibility = { page == Page.General }) val shadow by setting("Shadows", true, "If disabled, it removes shadows on the model", visibility = { page == Page.General }) @@ -72,6 +75,10 @@ object ViewModel : Module( Left, Right } + enum class SwingMode { + MainHand, OffHand, Both, None + } + fun transform(itemStack: ItemStack, hand: Hand, matrices: MatrixStack) { val side = if (mc.options.mainArm.value == Arm.LEFT) { if (hand == Hand.MAIN_HAND) Side.Left else Side.Right From a17514eca32f9ce1659bea68bbab25445c0254c5 Mon Sep 17 00:00:00 2001 From: beanbag44 Date: Sat, 17 Aug 2024 03:37:22 +0100 Subject: [PATCH 03/16] added basic swing mode implementation, needs to also change/disable the drop down animation --- .../mixin/entity/ClientPlayerEntityMixin.java | 15 ++++++++++ .../mixin/render/HeldItemRendererMixin.java | 8 ++++-- .../lambda/module/modules/render/ViewModel.kt | 28 +++++++++++++++++-- .../src/main/resources/lambda.accesswidener | 1 + 4 files changed, 48 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/com/lambda/mixin/entity/ClientPlayerEntityMixin.java b/common/src/main/java/com/lambda/mixin/entity/ClientPlayerEntityMixin.java index 89cb14a95..1c446bcc3 100644 --- a/common/src/main/java/com/lambda/mixin/entity/ClientPlayerEntityMixin.java +++ b/common/src/main/java/com/lambda/mixin/entity/ClientPlayerEntityMixin.java @@ -6,9 +6,12 @@ import com.lambda.event.events.TickEvent; import com.lambda.interaction.PlayerPacketManager; import com.lambda.interaction.RotationManager; +import com.lambda.module.modules.render.ViewModel; import net.minecraft.client.input.Input; +import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.entity.MovementType; +import net.minecraft.util.Hand; import net.minecraft.util.math.Vec3d; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -91,4 +94,16 @@ float fixHeldItemYaw(ClientPlayerEntity instance) { float fixHeldItemPitch(ClientPlayerEntity instance) { return Objects.requireNonNullElse(RotationManager.getHandPitch(), instance.getPitch()); } + + @Redirect(method = "swingHand", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;swingHand(Lnet/minecraft/util/Hand;)V")) + private void adjustSwing(AbstractClientPlayerEntity instance, Hand hand) { + ViewModel viewModel = ViewModel.INSTANCE; + + if (!viewModel.isEnabled()) { + instance.swingHand(hand); + return; + } + + viewModel.adjustSwing(hand, instance); + } } diff --git a/common/src/main/java/com/lambda/mixin/render/HeldItemRendererMixin.java b/common/src/main/java/com/lambda/mixin/render/HeldItemRendererMixin.java index df7ae0ec8..c21d8c16f 100644 --- a/common/src/main/java/com/lambda/mixin/render/HeldItemRendererMixin.java +++ b/common/src/main/java/com/lambda/mixin/render/HeldItemRendererMixin.java @@ -16,11 +16,15 @@ public class HeldItemRendererMixin { @Inject(method = "renderFirstPersonItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderArmHoldingItem(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IFFLnet/minecraft/util/Arm;)V")) private void onRenderArmHoldingItem(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack itemStack, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { - if (ViewModel.INSTANCE.isEnabled()) ViewModel.INSTANCE.transform(itemStack, hand, matrices); + if (!ViewModel.INSTANCE.isEnabled()) return; + + ViewModel.INSTANCE.transform(itemStack, hand, matrices); } @Inject(method = "renderFirstPersonItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V")) private void onRenderFirstPersonItem(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack itemStack, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { - if (ViewModel.INSTANCE.isEnabled()) ViewModel.INSTANCE.transform(itemStack, hand, matrices); + if (!ViewModel.INSTANCE.isEnabled()) return; + + ViewModel.INSTANCE.transform(itemStack, hand, matrices); } } \ No newline at end of file diff --git a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt index 08a845028..5ed220f80 100644 --- a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt +++ b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt @@ -3,6 +3,7 @@ package com.lambda.module.modules.render import com.lambda.Lambda.mc import com.lambda.module.Module import com.lambda.module.tag.ModuleTag +import net.minecraft.client.network.AbstractClientPlayerEntity import net.minecraft.client.util.math.MatrixStack import net.minecraft.item.ItemStack import net.minecraft.util.Arm @@ -21,7 +22,7 @@ object ViewModel : Module( //ToDo: implement the rest of the settings and maybe add a couple more private val ignoreHand by setting("Ignore Hand", false, "Prevents adjusting the players hand", visibility = { page == Page.General }) - val swingMode by setting("Swing Mode", SwingMode.MainHand, "Changes which hands swing", visibility = { page == Page.General }) + private val swingMode by setting("Swing Mode", SwingMode.Standard, "Changes which hands swing", visibility = { page == Page.General }) val swingSpeed by setting("Swing Speed", 6, 0..20, 1, "Adjusts how fast the player swings", visibility = { page == Page.General }) val swingProgress by setting("Swing Progress", 0.0f, 0.0f..1.0f, 0.025f, "Renders as if the player was this progress through the swing animation", visibility = { page == Page.General }) val oldSwingAnimation by setting("Old Swing Animation", false, "Adjusts the swing animation to what it looked like in 1.8", visibility = { page == Page.General }) @@ -76,7 +77,7 @@ object ViewModel : Module( } enum class SwingMode { - MainHand, OffHand, Both, None + Standard, Opposites, MainHand, OffHand, None } fun transform(itemStack: ItemStack, hand: Hand, matrices: MatrixStack) { @@ -208,4 +209,27 @@ object ViewModel : Module( } } } + + fun adjustSwing(hand: Hand, player: AbstractClientPlayerEntity) { + when (swingMode) { + SwingMode.Standard -> swingHand(hand, player) + SwingMode.Opposites -> { + if (hand == Hand.MAIN_HAND) + swingHand(Hand.OFF_HAND, player) + else + swingHand(Hand.MAIN_HAND, player) + } + SwingMode.MainHand -> swingHand(Hand.MAIN_HAND, player) + SwingMode.OffHand -> swingHand(Hand.OFF_HAND, player) + SwingMode.None -> {} + } + } + + private fun swingHand(hand: Hand, player: AbstractClientPlayerEntity) { + if ((!player.handSwinging || player.handSwingTicks >= player.handSwingDuration / 2) || player.handSwingTicks < 0) { + player.handSwingTicks = -1 + player.handSwinging = true + player.preferredHand = hand + } + } } \ No newline at end of file diff --git a/common/src/main/resources/lambda.accesswidener b/common/src/main/resources/lambda.accesswidener index bd4ab6ec7..198173ae2 100644 --- a/common/src/main/resources/lambda.accesswidener +++ b/common/src/main/resources/lambda.accesswidener @@ -19,6 +19,7 @@ accessible method net/minecraft/entity/Entity movementInputToVelocity (Lnet/mine accessible method net/minecraft/entity/passive/AbstractHorseEntity setHorseFlag (IZ)V accessible method net/minecraft/entity/passive/AbstractHorseEntity updateSaddle ()V accessible field net/minecraft/entity/LivingEntity lastAttackedTicks I +accessible method net/minecraft/entity/LivingEntity getHandSwingDuration ()I # Camera accessible method net/minecraft/client/render/Camera setPos (DDD)V From bcd85d0eebd0580b7025392159a09362ae3ad5bd Mon Sep 17 00:00:00 2001 From: beanbag44 Date: Thu, 17 Apr 2025 21:23:49 +0100 Subject: [PATCH 04/16] small cleanup --- .../lambda/module/modules/render/ViewModel.kt | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt index 5ed220f80..04b069432 100644 --- a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt +++ b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt @@ -133,9 +133,9 @@ object ViewModel : Module( } private fun getPositionVec(side: Side, emptyHand: Boolean): Vector3f { - when (side) { + return when (side) { Side.Left -> { - return if (emptyHand) { + if (emptyHand) { Vector3f( -handXPosition, handYPosition, @@ -150,7 +150,7 @@ object ViewModel : Module( } } Side.Right -> { - return if (emptyHand) { + if (emptyHand) { Vector3f( handXPosition, handYPosition, @@ -169,16 +169,15 @@ object ViewModel : Module( private fun rotate(side: Side, matrices: MatrixStack, emptyHand: Boolean) { val rotationVec = getRotationVec(side, emptyHand) - matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(rotationVec.x.toFloat())) matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(rotationVec.y.toFloat())) matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(rotationVec.z.toFloat())) } private fun getRotationVec(side: Side, emptyHand: Boolean): Vector3i { - when (side) { + return when (side) { Side.Left -> { - return if (emptyHand) { + if (emptyHand) { Vector3i( handXRotation, -handYRotation, @@ -193,7 +192,7 @@ object ViewModel : Module( } } Side.Right -> { - return if (emptyHand) { + if (emptyHand) { Vector3i( handXRotation, handYRotation, @@ -226,10 +225,12 @@ object ViewModel : Module( } private fun swingHand(hand: Hand, player: AbstractClientPlayerEntity) { - if ((!player.handSwinging || player.handSwingTicks >= player.handSwingDuration / 2) || player.handSwingTicks < 0) { - player.handSwingTicks = -1 - player.handSwinging = true - player.preferredHand = hand + with(player) { + if ((!handSwinging || handSwingTicks >= handSwingDuration / 2) || handSwingTicks < 0) { + handSwingTicks = -1 + handSwinging = true + preferredHand = hand + } } } } \ No newline at end of file From 98daf85dac04dbc9613fdf8232d41a776b055fdb Mon Sep 17 00:00:00 2001 From: beanbag44 Date: Thu, 17 Apr 2025 22:07:18 +0100 Subject: [PATCH 05/16] merge fixes --- .../com/lambda/mixin/entity/ClientPlayerEntityMixin.java | 6 +----- .../kotlin/com/lambda/module/modules/render/ViewModel.kt | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/common/src/main/java/com/lambda/mixin/entity/ClientPlayerEntityMixin.java b/common/src/main/java/com/lambda/mixin/entity/ClientPlayerEntityMixin.java index 03d768eb4..a9b2edbfa 100644 --- a/common/src/main/java/com/lambda/mixin/entity/ClientPlayerEntityMixin.java +++ b/common/src/main/java/com/lambda/mixin/entity/ClientPlayerEntityMixin.java @@ -25,19 +25,15 @@ import com.lambda.interaction.PlayerPacketManager; import com.lambda.interaction.request.rotation.RotationManager; import com.lambda.module.modules.player.PortalGui; +import com.lambda.module.modules.render.ViewModel; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.DeathScreen; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.HandledScreen; -import com.lambda.interaction.RotationManager; -import com.lambda.module.modules.render.ViewModel; import net.minecraft.client.input.Input; import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.entity.MovementType; import net.minecraft.entity.damage.DamageSource; import net.minecraft.util.Hand; -import net.minecraft.util.Hand; import net.minecraft.util.math.Vec3d; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; diff --git a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt index 04b069432..6f24f9f1c 100644 --- a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt +++ b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt @@ -29,7 +29,7 @@ object ViewModel : Module( val swapAnimation by setting("Swap Animation", true, "If disabled, it removes the drop down animation when swapping item", visibility = { page == Page.General }) val shadow by setting("Shadows", true, "If disabled, it removes shadows on the model", visibility = { page == Page.General }) - private val linkedScale by setting("Linked", true, "Links both hands scale settings", visibility = { page == Page.Scale }) + private val linkedScale by setting("Linked Scale", true, "Links both hands scale settings", visibility = { page == Page.Scale }) private val leftXScale by setting("Left X Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale }).apply { onValueChange { _, to -> if (linkedScale) rightXScale = to } } private val leftYScale by setting("Left Y Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale }).apply { onValueChange { _, to -> if (linkedScale) rightYScale = to } } private val leftZScale by setting("Left Z Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale }).apply { onValueChange { _, to -> if (linkedScale) rightZScale = to } } @@ -37,7 +37,7 @@ object ViewModel : Module( private var rightYScale by setting("Right Y Scale", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale && !linkedScale }) private var rightZScale by setting("Right Z Scale", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale && !linkedScale }) - private val linkedPosition by setting("Linked", true, "Links both hands position settings", visibility = { page == Page.Position }) + private val linkedPosition by setting("Linked Position", true, "Links both hands position settings", visibility = { page == Page.Position }) private val leftXPosition by setting("Left X Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Position }).apply { onValueChange { _, to -> if (linkedPosition) rightXPosition = to } } private val leftYPosition by setting("Left Y Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Position }).apply { onValueChange { _, to -> if (linkedPosition) rightYPosition = to } } private val leftZPosition by setting("Left Z Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Position }).apply { onValueChange { _, to -> if (linkedPosition) rightZPosition = to } } @@ -45,7 +45,7 @@ object ViewModel : Module( private var rightYPosition by setting("Right Y Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Position && !linkedPosition }) private var rightZPosition by setting("Right Z Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Position && !linkedPosition }) - private val linkedRotation by setting("Linked", true, "Links both hands rotation settings", visibility = { page == Page.Rotation }) + private val linkedRotation by setting("Linked Rotation", true, "Links both hands rotation settings", visibility = { page == Page.Rotation }) private val leftXRotation by setting("Left X Rotation", 0, -180..180, 1, visibility = { page == Page.Rotation }).apply { onValueChange { _, to -> if (linkedRotation) rightXRotation = to } } private val leftYRotation by setting("Left Y Rotation", 0, -180..180, 1, visibility = { page == Page.Rotation }).apply { onValueChange { _, to -> if (linkedRotation) rightYRotation = to } } private val leftZRotation by setting("Left Z Rotation", 0, -180..180, 1, visibility = { page == Page.Rotation }).apply { onValueChange { _, to -> if (linkedRotation) rightZRotation = to } } From 3421d027d18ffccf0cd9d90eb0f5feedfc28b675 Mon Sep 17 00:00:00 2001 From: beanbag44 Date: Tue, 3 Jun 2025 19:15:59 +0100 Subject: [PATCH 06/16] working old swing animation and swap animation settings --- .../mixin/render/HeldItemRendererMixin.java | 39 +++++++++++++++++++ .../lambda/module/modules/render/ViewModel.kt | 13 ++++--- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/common/src/main/java/com/lambda/mixin/render/HeldItemRendererMixin.java b/common/src/main/java/com/lambda/mixin/render/HeldItemRendererMixin.java index c21d8c16f..17430e473 100644 --- a/common/src/main/java/com/lambda/mixin/render/HeldItemRendererMixin.java +++ b/common/src/main/java/com/lambda/mixin/render/HeldItemRendererMixin.java @@ -1,19 +1,29 @@ package com.lambda.mixin.render; import com.lambda.module.modules.render.ViewModel; +import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.item.HeldItemRenderer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; import net.minecraft.util.Hand; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyArg; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(HeldItemRenderer.class) public class HeldItemRendererMixin { + @Final @Shadow private MinecraftClient client; + @Shadow private ItemStack mainHand; + @Shadow private ItemStack offHand; + @Shadow private float equipProgressMainHand; + @Shadow private float equipProgressOffHand; + @Inject(method = "renderFirstPersonItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderArmHoldingItem(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IFFLnet/minecraft/util/Arm;)V")) private void onRenderArmHoldingItem(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack itemStack, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { if (!ViewModel.INSTANCE.isEnabled()) return; @@ -27,4 +37,33 @@ private void onRenderFirstPersonItem(AbstractClientPlayerEntity player, float ti ViewModel.INSTANCE.transform(itemStack, hand, matrices); } + + @ModifyArg(method = "updateHeldItems", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;clamp(FFF)F", ordinal = 2), index = 0) + private float modifyEquipProgressMainHand(float value) { + if (client.player == null || ViewModel.INSTANCE.isDisabled()) return value; + + ViewModel config = ViewModel.INSTANCE; + ItemStack currentStack = client.player.getMainHandStack(); + if (!config.getSwapAnimation()) { + mainHand = currentStack; + } + + float progress = config.getOldAnimations() || !config.getSwapAnimation() ? 1 : (float) Math.pow(client.player.getAttackCooldownProgress(1), 3); + + return (ItemStack.areEqual(mainHand, currentStack) ? progress : 0) - equipProgressMainHand; + } + + @ModifyArg(method = "updateHeldItems", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;clamp(FFF)F", ordinal = 3), index = 0) + private float modifyEquipProgressOffhand(float value) { + if (client.player == null || ViewModel.INSTANCE.isDisabled()) return value; + + ViewModel config = ViewModel.INSTANCE; + + ItemStack currentStack = client.player.getOffHandStack(); + if (!config.getSwapAnimation()) { + offHand = currentStack; + } + + return (ItemStack.areEqual(offHand, currentStack) || !config.getSwapAnimation() ? 1 : 0) - equipProgressOffHand; + } } \ No newline at end of file diff --git a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt index 6f24f9f1c..4687355ef 100644 --- a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt +++ b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt @@ -24,18 +24,19 @@ object ViewModel : Module( private val ignoreHand by setting("Ignore Hand", false, "Prevents adjusting the players hand", visibility = { page == Page.General }) private val swingMode by setting("Swing Mode", SwingMode.Standard, "Changes which hands swing", visibility = { page == Page.General }) val swingSpeed by setting("Swing Speed", 6, 0..20, 1, "Adjusts how fast the player swings", visibility = { page == Page.General }) - val swingProgress by setting("Swing Progress", 0.0f, 0.0f..1.0f, 0.025f, "Renders as if the player was this progress through the swing animation", visibility = { page == Page.General }) - val oldSwingAnimation by setting("Old Swing Animation", false, "Adjusts the swing animation to what it looked like in 1.8", visibility = { page == Page.General }) - val swapAnimation by setting("Swap Animation", true, "If disabled, it removes the drop down animation when swapping item", visibility = { page == Page.General }) + 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", visibility = { page == Page.General }) + 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", visibility = { page == Page.General }) + val oldAnimations by setting("Old Animations", false, "Adjusts the animations to look like they did in 1.8", visibility = { page == Page.General }) + val swapAnimation by setting("Swap Animation", true, "If disabled, it removes the drop down animation when swapping item", visibility = { page == Page.General && oldAnimations }) val shadow by setting("Shadows", true, "If disabled, it removes shadows on the model", visibility = { page == Page.General }) private val linkedScale by setting("Linked Scale", true, "Links both hands scale settings", visibility = { page == Page.Scale }) private val leftXScale by setting("Left X Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale }).apply { onValueChange { _, to -> if (linkedScale) rightXScale = to } } private val leftYScale by setting("Left Y Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale }).apply { onValueChange { _, to -> if (linkedScale) rightYScale = to } } private val leftZScale by setting("Left Z Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale }).apply { onValueChange { _, to -> if (linkedScale) rightZScale = to } } - private var rightXScale by setting("Right X Scale", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale && !linkedScale }) - private var rightYScale by setting("Right Y Scale", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale && !linkedScale }) - private var rightZScale by setting("Right Z Scale", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale && !linkedScale }) + private var rightXScale by setting("Right X Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale && !linkedScale }) + private var rightYScale by setting("Right Y Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale && !linkedScale }) + private var rightZScale by setting("Right Z Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale && !linkedScale }) private val linkedPosition by setting("Linked Position", true, "Links both hands position settings", visibility = { page == Page.Position }) private val leftXPosition by setting("Left X Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Position }).apply { onValueChange { _, to -> if (linkedPosition) rightXPosition = to } } From aae80d3be3c436486d15e487be51bcabe740763e Mon Sep 17 00:00:00 2001 From: beanbag44 Date: Tue, 3 Jun 2025 20:47:48 +0100 Subject: [PATCH 07/16] fix crash if modules disabled when swinging :skull: --- .../com/lambda/mixin/entity/ClientPlayerEntityMixin.java | 2 +- .../kotlin/com/lambda/module/modules/render/ViewModel.kt | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/com/lambda/mixin/entity/ClientPlayerEntityMixin.java b/common/src/main/java/com/lambda/mixin/entity/ClientPlayerEntityMixin.java index a9b2edbfa..064d1f425 100644 --- a/common/src/main/java/com/lambda/mixin/entity/ClientPlayerEntityMixin.java +++ b/common/src/main/java/com/lambda/mixin/entity/ClientPlayerEntityMixin.java @@ -159,7 +159,7 @@ private void adjustSwing(AbstractClientPlayerEntity instance, Hand hand) { ViewModel viewModel = ViewModel.INSTANCE; if (!viewModel.isEnabled()) { - instance.swingHand(hand); + instance.swingHand(hand, false); return; } diff --git a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt index 4687355ef..e45ac76e4 100644 --- a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt +++ b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt @@ -214,10 +214,8 @@ object ViewModel : Module( when (swingMode) { SwingMode.Standard -> swingHand(hand, player) SwingMode.Opposites -> { - if (hand == Hand.MAIN_HAND) - swingHand(Hand.OFF_HAND, player) - else - swingHand(Hand.MAIN_HAND, player) + if (hand == Hand.MAIN_HAND) swingHand(Hand.OFF_HAND, player) + else swingHand(Hand.MAIN_HAND, player) } SwingMode.MainHand -> swingHand(Hand.MAIN_HAND, player) SwingMode.OffHand -> swingHand(Hand.OFF_HAND, player) From 4266828d17889a262f3bce6d9ac9381edc6c84de Mon Sep 17 00:00:00 2001 From: beanbag44 Date: Wed, 4 Jun 2025 19:52:52 +0100 Subject: [PATCH 08/16] swing duration, swing progress, no swing delay settings and refactors / small fixes --- .../mixin/entity/LivingEntityMixin.java | 28 +- .../mixin/render/HeldItemRendererMixin.java | 29 +- .../lambda/module/modules/render/ViewModel.kt | 267 ++++++++---------- .../src/main/resources/lambda.accesswidener | 1 + 4 files changed, 160 insertions(+), 165 deletions(-) diff --git a/common/src/main/java/com/lambda/mixin/entity/LivingEntityMixin.java b/common/src/main/java/com/lambda/mixin/entity/LivingEntityMixin.java index 0092e7eb3..aa9e62d63 100644 --- a/common/src/main/java/com/lambda/mixin/entity/LivingEntityMixin.java +++ b/common/src/main/java/com/lambda/mixin/entity/LivingEntityMixin.java @@ -21,15 +21,14 @@ import com.lambda.event.EventFlow; import com.lambda.event.events.MovementEvent; import com.lambda.interaction.request.rotation.RotationManager; +import com.lambda.module.modules.render.ViewModel; import net.minecraft.entity.LivingEntity; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.Slice; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(LivingEntity.class) @@ -38,6 +37,9 @@ public abstract class LivingEntityMixin extends EntityMixin { @Shadow protected abstract float getJumpVelocity(); + @Unique + private final LivingEntity lambda$instance = (LivingEntity) (Object) this; + /** * Overwrites the jump function to use our rotation and movements *
{@code
@@ -55,7 +57,7 @@ public abstract class LivingEntityMixin extends EntityMixin {
      */
     @Inject(method = "jump", at = @At("HEAD"), cancellable = true)
     void onJump(CallbackInfo ci) {
-        LivingEntity self = (LivingEntity) (Object) this;
+        LivingEntity self = lambda$instance;
         if (self != Lambda.getMc().player) return;
         ci.cancel();
 
@@ -78,15 +80,14 @@ void onJump(CallbackInfo ci) {
 
     @Inject(method = "travel", at = @At("HEAD"), cancellable = true)
     void onTravelPre(Vec3d movementInput, CallbackInfo ci) {
-        LivingEntity entity = (LivingEntity) (Object) this;
-        if (EventFlow.post(new MovementEvent.Entity.Pre(entity, movementInput)).isCanceled()) {
+        if (EventFlow.post(new MovementEvent.Entity.Pre(lambda$instance, movementInput)).isCanceled()) {
             ci.cancel();
         }
     }
 
     @Inject(method = "travel", at = @At("TAIL"))
     void onTravelPost(Vec3d movementInput, CallbackInfo ci) {
-        EventFlow.post(new MovementEvent.Entity.Post((LivingEntity) (Object) this, movementInput));
+        EventFlow.post(new MovementEvent.Entity.Post(lambda$instance, movementInput));
     }
 
     /**
@@ -123,7 +124,7 @@ private float hookModifyFallFlyingPitch(LivingEntity entity) {
      */
     @Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getYaw()F"), slice = @Slice(to = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getYaw()F", ordinal = 1)))
     private float rotBody(LivingEntity entity) {
-        if ((Object) this != Lambda.getMc().player) {
+        if (lambda$instance != Lambda.getMc().player) {
             return entity.getYaw();
         }
 
@@ -154,11 +155,18 @@ private float rotBody(LivingEntity entity) {
      */
     @Redirect(method = "turnHead", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getYaw()F"))
     private float rotHead(LivingEntity entity) {
-        if ((Object) this != Lambda.getMc().player) {
+        if (lambda$instance != Lambda.getMc().player) {
             return entity.getYaw();
         }
 
         Float yaw = RotationManager.getRenderYaw();
         return (yaw == null) ? entity.getYaw() : yaw;
     }
+
+    @ModifyConstant(method = "getHandSwingDuration", constant = @Constant(intValue = 6))
+    private int getHandSwingDuration(int constant) {
+        if (lambda$instance != Lambda.getMc().player || ViewModel.INSTANCE.isDisabled()) return constant;
+
+        return ViewModel.INSTANCE.getSwingDuration();
+    }
 }
diff --git a/common/src/main/java/com/lambda/mixin/render/HeldItemRendererMixin.java b/common/src/main/java/com/lambda/mixin/render/HeldItemRendererMixin.java
index 17430e473..905a74025 100644
--- a/common/src/main/java/com/lambda/mixin/render/HeldItemRendererMixin.java
+++ b/common/src/main/java/com/lambda/mixin/render/HeldItemRendererMixin.java
@@ -1,5 +1,7 @@
 package com.lambda.mixin.render;
 
+import com.google.common.base.MoreObjects;
+import com.lambda.Lambda;
 import com.lambda.module.modules.render.ViewModel;
 import net.minecraft.client.MinecraftClient;
 import net.minecraft.client.network.AbstractClientPlayerEntity;
@@ -14,6 +16,7 @@
 import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.Inject;
 import org.spongepowered.asm.mixin.injection.ModifyArg;
+import org.spongepowered.asm.mixin.injection.ModifyVariable;
 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 
 @Mixin(HeldItemRenderer.class)
@@ -44,26 +47,42 @@ private float modifyEquipProgressMainHand(float value) {
 
         ViewModel config = ViewModel.INSTANCE;
         ItemStack currentStack = client.player.getMainHandStack();
-        if (!config.getSwapAnimation()) {
+        if (config.getOldAnimations() && !config.getSwapAnimation()) {
             mainHand = currentStack;
         }
 
-        float progress = config.getOldAnimations() || !config.getSwapAnimation() ? 1 : (float) Math.pow(client.player.getAttackCooldownProgress(1), 3);
+        float progress = config.getOldAnimations() ? 1 : (float) Math.pow(client.player.getAttackCooldownProgress(1), 3);
 
         return (ItemStack.areEqual(mainHand, currentStack) ? progress : 0) - equipProgressMainHand;
     }
 
     @ModifyArg(method = "updateHeldItems", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;clamp(FFF)F", ordinal = 3), index = 0)
-    private float modifyEquipProgressOffhand(float value) {
+    private float modifyEquipProgressOffHand(float value) {
         if (client.player == null || ViewModel.INSTANCE.isDisabled()) return value;
 
         ViewModel config = ViewModel.INSTANCE;
 
         ItemStack currentStack = client.player.getOffHandStack();
-        if (!config.getSwapAnimation()) {
+        if (config.getOldAnimations() && !config.getSwapAnimation()) {
             offHand = currentStack;
         }
 
-        return (ItemStack.areEqual(offHand, currentStack) || !config.getSwapAnimation() ? 1 : 0) - equipProgressOffHand;
+        return (ItemStack.areEqual(offHand, currentStack) ? 1 : 0) - equipProgressOffHand;
+    }
+
+    @ModifyVariable(method = "renderItem(FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider$Immediate;Lnet/minecraft/client/network/ClientPlayerEntity;I)V", at = @At(value = "STORE", ordinal = 0), index = 6)
+    private float modifySwing(float swingProgress) {
+        ViewModel config = ViewModel.INSTANCE;
+        MinecraftClient mc = Lambda.getMc();
+        if (config.isDisabled() || mc.player == null) return swingProgress;
+        Hand hand = MoreObjects.firstNonNull(mc.player.preferredHand, Hand.MAIN_HAND);
+
+        if (hand == Hand.MAIN_HAND) {
+            return swingProgress + config.getMainSwingProgress();
+        } else if (hand == Hand.OFF_HAND) {
+            return swingProgress + config.getOffhandSwingProgress();
+        }
+
+        return swingProgress;
     }
 }
\ No newline at end of file
diff --git a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
index e45ac76e4..b49b4a917 100644
--- a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
+++ b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
@@ -1,8 +1,13 @@
 package com.lambda.module.modules.render
 
 import com.lambda.Lambda.mc
+import com.lambda.event.events.KeyboardEvent
+import com.lambda.event.events.MouseEvent
+import com.lambda.event.events.TickEvent
+import com.lambda.event.listener.SafeListener.Companion.listen
 import com.lambda.module.Module
 import com.lambda.module.tag.ModuleTag
+import com.lambda.util.Mouse
 import net.minecraft.client.network.AbstractClientPlayerEntity
 import net.minecraft.client.util.math.MatrixStack
 import net.minecraft.item.ItemStack
@@ -21,64 +26,82 @@ object ViewModel : Module(
 
     //ToDo: implement the rest of the settings and maybe add a couple more
 
-    private val ignoreHand by setting("Ignore Hand", false, "Prevents adjusting the players hand", visibility = { page == Page.General })
-    private val swingMode by setting("Swing Mode", SwingMode.Standard, "Changes which hands swing", visibility = { page == Page.General })
-    val swingSpeed by setting("Swing Speed", 6, 0..20, 1, "Adjusts how fast the player swings", visibility = { page == Page.General })
-    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", visibility = { page == Page.General })
-    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", visibility = { page == Page.General })
-    val oldAnimations by setting("Old Animations", false, "Adjusts the animations to look like they did in 1.8", visibility = { page == Page.General })
-    val swapAnimation by setting("Swap Animation", true, "If disabled, it removes the drop down animation when swapping item", visibility = { page == Page.General && oldAnimations })
-    val shadow by setting("Shadows", true, "If disabled, it removes shadows on the model", visibility = { page == Page.General })
-
-    private val linkedScale by setting("Linked Scale", true, "Links both hands scale settings", visibility = { page == Page.Scale })
-    private val leftXScale by setting("Left X Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale }).apply { onValueChange { _, to -> if (linkedScale) rightXScale = to } }
-    private val leftYScale by setting("Left Y Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale }).apply { onValueChange { _, to -> if (linkedScale) rightYScale = to } }
-    private val leftZScale by setting("Left Z Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale }).apply { onValueChange { _, to -> if (linkedScale) rightZScale = to } }
-    private var rightXScale by setting("Right X Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale && !linkedScale })
-    private var rightYScale by setting("Right Y Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale && !linkedScale })
-    private var rightZScale by setting("Right Z Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Scale && !linkedScale })
-
-    private val linkedPosition by setting("Linked Position", true, "Links both hands position settings", visibility = { page == Page.Position })
-    private val leftXPosition by setting("Left X Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Position }).apply { onValueChange { _, to -> if (linkedPosition) rightXPosition = to } }
-    private val leftYPosition by setting("Left Y Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Position }).apply { onValueChange { _, to -> if (linkedPosition) rightYPosition = to } }
-    private val leftZPosition by setting("Left Z Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Position }).apply { onValueChange { _, to -> if (linkedPosition) rightZPosition = to } }
-    private var rightXPosition by setting("Right X Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Position && !linkedPosition })
-    private var rightYPosition by setting("Right Y Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Position && !linkedPosition })
-    private var rightZPosition by setting("Right Z Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Position && !linkedPosition })
-
-    private val linkedRotation by setting("Linked Rotation", true, "Links both hands rotation settings", visibility = { page == Page.Rotation })
-    private val leftXRotation by setting("Left X Rotation", 0, -180..180, 1, visibility = { page == Page.Rotation }).apply { onValueChange { _, to -> if (linkedRotation) rightXRotation = to } }
-    private val leftYRotation by setting("Left Y Rotation", 0, -180..180, 1, visibility = { page == Page.Rotation }).apply { onValueChange { _, to -> if (linkedRotation) rightYRotation = to } }
-    private val leftZRotation by setting("Left Z Rotation", 0, -180..180, 1, visibility = { page == Page.Rotation }).apply { onValueChange { _, to -> if (linkedRotation) rightZRotation = to } }
-    private var rightXRotation by setting("Right X Rotation", 0, -180..180, 1, visibility = { page == Page.Rotation && !linkedRotation })
-    private var rightYRotation by setting("Right Y Rotation", 0, -180..180, 1, visibility = { page == Page.Rotation && !linkedRotation })
-    private var rightZRotation by setting("Right Z Rotation", 0, -180..180, 1, visibility = { page == Page.Rotation && !linkedRotation })
-
-    private val linkedFOV by setting("Linked FOV", true, "Links both hands FOV settings", visibility = { page == Page.FOV })
-    private val leftFOV by setting ("Left FOV", 80, 10..180, 1, visibility = { page == Page.FOV }).apply { onValueChange { _, to -> if (linkedFOV) rightFOV = to } }
-    private var rightFOV by setting ("Right FOV", 80, 10..180, 1, visibility = { page == Page.FOV && !linkedFOV })
-
-    private val handXScale by setting("Hand X Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Hand })
-    private val handYScale by setting("Hand Y Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Hand })
-    private val handZScale by setting("Hand Z Scale", 1.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Hand })
-    private val handXPosition by setting("Hand X Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Hand })
-    private val handYPosition by setting("Hand Y Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Hand })
-    private val handZPosition by setting("Hand Z Position", 0.0f, -1.0f..1.0f, 0.025f, visibility = { page == Page.Hand })
-    private var handXRotation by setting("Hand X Rotation", 0, -180..180, 1, visibility = { page == Page.Hand })
-    private var handYRotation by setting("Hand Y Rotation", 0, -180..180, 1, visibility = { page == Page.Hand })
-    private var handZRotation by setting("Hand Z Rotation", 0, -180..180, 1, visibility = { page == Page.Hand })
-    private val handFOV by setting("Hand FOV", 80, 10..180, 1, visibility = { page == Page.Hand })
-
-    private enum class Page {
-        General, Scale, Position, Rotation, FOV, Hand
-    }
-
-    private enum class Side {
-        Left, Right
-    }
+    private val ignoreHand by setting("Ignore Hand", false, "Prevents adjusting the players hand") { page == Page.General }
+    private val swingMode by setting("Swing Mode", SwingMode.Standard, "Changes which hands swing") { page == Page.General }
+    val swingDuration by setting("Swing Duration", 6, 0..20, 1, "Adjusts how fast the player swings", "ticks") { page == Page.General }
+    private val noSwingDelay by setting("No Swing Delay", false, "Removes the delay between swings") { page == Page.General }
+    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 }
+    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 }
+    val oldAnimations by setting("Old Animations", false, "Adjusts the animations to look like they did in 1.8") { page == Page.General }
+    val swapAnimation by setting("Swap Animation", true, "If disabled, it removes the drop down animation when swapping item") { page == Page.General && oldAnimations }
+    val shadow by setting("Shadows", true, "If disabled, it removes shadows on the model") { page == Page.General }
+
+    private val linkedScale by setting("Linked Scale", true, "Links both hands scale settings") { page == Page.Scale }
+    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 } }
+    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 } }
+    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 } }
+    private var rightXScale by setting("Right X Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && !linkedScale }
+    private var rightYScale by setting("Right Y Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && !linkedScale }
+    private var rightZScale by setting("Right Z Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && !linkedScale }
+
+    private val linkedPosition by setting("Linked Position", true, "Links both hands position settings") { page == Page.Position }
+    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 } }
+    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 } }
+    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 } }
+    private var rightXPosition by setting("Right X Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && !linkedPosition }
+    private var rightYPosition by setting("Right Y Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && !linkedPosition }
+    private var rightZPosition by setting("Right Z Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && !linkedPosition }
+
+    private val linkedRotation by setting("Linked Rotation", true, "Links both hands rotation settings") { page == Page.Rotation }
+    private val leftXRotation by setting("Left X Rotation", 0, -180..180, 1) { page == Page.Rotation }.apply { onValueChange { _, to -> if (linkedRotation) rightXRotation = to } }
+    private val leftYRotation by setting("Left Y Rotation", 0, -180..180, 1) { page == Page.Rotation }.apply { onValueChange { _, to -> if (linkedRotation) rightYRotation = to } }
+    private val leftZRotation by setting("Left Z Rotation", 0, -180..180, 1) { page == Page.Rotation }.apply { onValueChange { _, to -> if (linkedRotation) rightZRotation = to } }
+    private var rightXRotation by setting("Right X Rotation", 0, -180..180, 1) { page == Page.Rotation && !linkedRotation }
+    private var rightYRotation by setting("Right Y Rotation", 0, -180..180, 1) { page == Page.Rotation && !linkedRotation }
+    private var rightZRotation by setting("Right Z Rotation", 0, -180..180, 1) { page == Page.Rotation && !linkedRotation }
+
+    private val linkedFOV by setting("Linked FOV", true, "Links both hands FOV settings") { page == Page.FOV }
+    private val leftFOV by setting ("Left FOV", 80, 10..180, 1) { page == Page.FOV }.apply { onValueChange { _, to -> if (linkedFOV) rightFOV = to } }
+    private var rightFOV by setting ("Right FOV", 80, 10..180, 1) { page == Page.FOV && !linkedFOV }
+
+    private val handXScale by setting("Hand X Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
+    private val handYScale by setting("Hand Y Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
+    private val handZScale by setting("Hand Z Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
+    private val handXPosition by setting("Hand X Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
+    private val handYPosition by setting("Hand Y Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
+    private val handZPosition by setting("Hand Z Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
+    private var handXRotation by setting("Hand X Rotation", 0, -180..180, 1) { page == Page.Hand }
+    private var handYRotation by setting("Hand Y Rotation", 0, -180..180, 1) { page == Page.Hand }
+    private var handZRotation by setting("Hand Z Rotation", 0, -180..180, 1) { page == Page.Hand }
+    private val handFOV by setting("Hand FOV", 80, 10..180, 1) { page == Page.Hand }
+
+    private var attackKeyTicksPressed = -1
+
+    init {
+        listen { event ->
+            if (event.button.key == mc.options.attackKey.boundKey.code) {
+                // For some reason click and release seem to be swapped???
+                attackKeyTicksPressed = when (event.action) {
+                    Mouse.Action.Click -> -1
+                    Mouse.Action.Release -> 0
+                }
+            }
+        }
+        listen { event ->
+            if (event.keyCode == mc.options.attackKey.boundKey.code) {
+                if (event.isPressed) {
+                    attackKeyTicksPressed = 0
+                } else if (event.isReleased) {
+                    attackKeyTicksPressed = -1
+                }
+            }
+        }
 
-    enum class SwingMode {
-        Standard, Opposites, MainHand, OffHand, None
+        listen {
+            if (attackKeyTicksPressed != -1) {
+                attackKeyTicksPressed++
+            }
+        }
     }
 
     fun transform(itemStack: ItemStack, hand: Hand, matrices: MatrixStack) {
@@ -101,72 +124,27 @@ object ViewModel : Module(
         matrices.scale(scaleVec.x, scaleVec.y, scaleVec.z)
     }
 
-    private fun getScaleVec(side: Side, emptyHand: Boolean): Vector3f {
-        if (emptyHand) {
-            return Vector3f(
-                handXScale,
-                handYScale,
-                handZScale
-            )
+    private fun getScaleVec(side: Side, emptyHand: Boolean): Vector3f =
+        if (emptyHand) Vector3f(handXScale, handYScale, handZScale)
+        else when (side) {
+            Side.Left -> Vector3f(leftXScale, leftYScale, leftZScale)
+            Side.Right -> Vector3f(rightXScale, rightYScale, rightZScale)
         }
 
-        when (side) {
-            Side.Left -> {
-                return Vector3f(
-                    leftXScale,
-                    leftYScale,
-                    leftZScale
-                )
-            }
-            Side.Right -> {
-                return Vector3f(
-                    rightXScale,
-                    rightYScale,
-                    rightZScale
-                )
-            }
-        }
-    }
-
     private fun position(side: Side, matrices: MatrixStack, emptyHand: Boolean) {
         val positionVec = getPositionVec(side, emptyHand)
         matrices.translate(positionVec.x, positionVec.y, positionVec.z)
     }
 
-    private fun getPositionVec(side: Side, emptyHand: Boolean): Vector3f {
-        return when (side) {
-            Side.Left -> {
-                if (emptyHand) {
-                    Vector3f(
-                        -handXPosition,
-                        handYPosition,
-                        handZPosition
-                    )
-                } else {
-                    Vector3f(
-                        -leftXPosition,
-                        leftYPosition,
-                        leftZPosition
-                    )
-                }
-            }
-            Side.Right -> {
-                if (emptyHand) {
-                    Vector3f(
-                        handXPosition,
-                        handYPosition,
-                        handZPosition
-                    )
-                } else {
-                    Vector3f(
-                        rightXPosition,
-                        rightYPosition,
-                        rightZPosition
-                    )
-                }
-            }
+    private fun getPositionVec(side: Side, emptyHand: Boolean) =
+        when (side) {
+            Side.Left ->
+                if (emptyHand) Vector3f(-handXPosition, handYPosition, handZPosition)
+                else Vector3f(-leftXPosition, leftYPosition, leftZPosition)
+            Side.Right ->
+                if (emptyHand) Vector3f(handXPosition, handYPosition, handZPosition)
+                else Vector3f(rightXPosition, rightYPosition, rightZPosition)
         }
-    }
 
     private fun rotate(side: Side, matrices: MatrixStack, emptyHand: Boolean) {
         val rotationVec = getRotationVec(side, emptyHand)
@@ -175,61 +153,50 @@ object ViewModel : Module(
         matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(rotationVec.z.toFloat()))
     }
 
-    private fun getRotationVec(side: Side, emptyHand: Boolean): Vector3i {
-        return when (side) {
+    private fun getRotationVec(side: Side, emptyHand: Boolean) =
+        when (side) {
             Side.Left -> {
-                if (emptyHand) {
-                    Vector3i(
-                        handXRotation,
-                        -handYRotation,
-                        -handZRotation
-                    )
-                } else {
-                    Vector3i(
-                        leftXRotation,
-                        -leftYRotation,
-                        -leftZRotation
-                    )
-                }
+                if (emptyHand) Vector3i(handXRotation, -handYRotation, -handZRotation)
+                else Vector3i(leftXRotation, -leftYRotation, -leftZRotation)
             }
             Side.Right -> {
-                if (emptyHand) {
-                    Vector3i(
-                        handXRotation,
-                        handYRotation,
-                        handZRotation
-                    )
-                } else {
-                    Vector3i(
-                        rightXRotation,
-                        rightYRotation,
-                        rightZRotation
-                    )
-                }
+                if (emptyHand) Vector3i(handXRotation, handYRotation, handZRotation)
+                else Vector3i(rightXRotation, rightYRotation, rightZRotation)
             }
         }
-    }
 
-    fun adjustSwing(hand: Hand, player: AbstractClientPlayerEntity) {
+    fun adjustSwing(hand: Hand, player: AbstractClientPlayerEntity) =
         when (swingMode) {
             SwingMode.Standard -> swingHand(hand, player)
-            SwingMode.Opposites -> {
+            SwingMode.Opposites ->
                 if (hand == Hand.MAIN_HAND) swingHand(Hand.OFF_HAND, player)
                 else swingHand(Hand.MAIN_HAND, player)
-            }
             SwingMode.MainHand -> swingHand(Hand.MAIN_HAND, player)
             SwingMode.OffHand -> swingHand(Hand.OFF_HAND, player)
             SwingMode.None -> {}
         }
-    }
 
-    private fun swingHand(hand: Hand, player: AbstractClientPlayerEntity) {
+    private fun swingHand(hand: Hand, player: AbstractClientPlayerEntity) =
         with(player) {
-            if ((!handSwinging || handSwingTicks >= handSwingDuration / 2) || handSwingTicks < 0) {
+            if ((!handSwinging || handSwingTicks >= handSwingDuration / 2)
+                || handSwingTicks < 0
+                || (noSwingDelay && attackKeyTicksPressed <= 1)
+                ) {
                 handSwingTicks = -1
                 handSwinging = true
                 preferredHand = hand
             }
         }
+
+    private enum class Page {
+        General, Scale, Position, Rotation, FOV, Hand
+    }
+
+    private enum class Side {
+        Left, Right
+    }
+
+    enum class SwingMode {
+        Standard, Opposites, MainHand, OffHand, None
     }
 }
\ No newline at end of file
diff --git a/common/src/main/resources/lambda.accesswidener b/common/src/main/resources/lambda.accesswidener
index fd1fc5fbe..31054ddb6 100644
--- a/common/src/main/resources/lambda.accesswidener
+++ b/common/src/main/resources/lambda.accesswidener
@@ -6,6 +6,7 @@ accessible field net/minecraft/client/MinecraftClient paused Z
 accessible field net/minecraft/client/MinecraftClient pausedTickDelta F
 accessible field net/minecraft/client/MinecraftClient thread Ljava/lang/Thread;
 accessible field net/minecraft/client/MinecraftClient uptimeInTicks J
+accessible field net/minecraft/client/option/KeyBinding boundKey Lnet/minecraft/client/util/InputUtil$Key;
 
 # World
 accessible field net/minecraft/client/world/ClientWorld entityManager Lnet/minecraft/client/world/ClientEntityManager;

From 5000f3e21db25df353e37e2f35b4ad69057ff3bd Mon Sep 17 00:00:00 2001
From: beanbag44 
Date: Wed, 4 Jun 2025 22:40:18 +0100
Subject: [PATCH 09/16] fov settings

---
 .../lambda/module/modules/render/ViewModel.kt | 43 +++++++++++++++++--
 1 file changed, 40 insertions(+), 3 deletions(-)

diff --git a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
index b49b4a917..555ad231a 100644
--- a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
+++ b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
@@ -14,8 +14,10 @@ import net.minecraft.item.ItemStack
 import net.minecraft.util.Arm
 import net.minecraft.util.Hand
 import net.minecraft.util.math.RotationAxis
+import org.joml.Matrix4f
 import org.joml.Vector3f
 import org.joml.Vector3i
+import kotlin.math.tan
 
 object ViewModel : Module(
     name = "View Model",
@@ -61,8 +63,10 @@ object ViewModel : Module(
     private var rightZRotation by setting("Right Z Rotation", 0, -180..180, 1) { page == Page.Rotation && !linkedRotation }
 
     private val linkedFOV by setting("Linked FOV", true, "Links both hands FOV settings") { page == Page.FOV }
-    private val leftFOV by setting ("Left FOV", 80, 10..180, 1) { page == Page.FOV }.apply { onValueChange { _, to -> if (linkedFOV) rightFOV = to } }
-    private var rightFOV by setting ("Right FOV", 80, 10..180, 1) { page == Page.FOV && !linkedFOV }
+    private val leftFOV by setting("Left FOV", 70, 10..180, 1) { page == Page.FOV }.apply { onValueChange { _, to -> if (linkedFOV) rightFOV = to } }
+    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 } }
+    private var rightFOV by setting("Right FOV", 70, 10..180, 1) { page == Page.FOV && !linkedFOV }
+    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 }
 
     private val handXScale by setting("Hand X Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
     private val handYScale by setting("Hand Y Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
@@ -73,7 +77,8 @@ object ViewModel : Module(
     private var handXRotation by setting("Hand X Rotation", 0, -180..180, 1) { page == Page.Hand }
     private var handYRotation by setting("Hand Y Rotation", 0, -180..180, 1) { page == Page.Hand }
     private var handZRotation by setting("Hand Z Rotation", 0, -180..180, 1) { page == Page.Hand }
-    private val handFOV by setting("Hand FOV", 80, 10..180, 1) { page == Page.Hand }
+    private val handFOV by setting("Hand FOV", 70, 10..180, 1) { page == Page.Hand }
+    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 }
 
     private var attackKeyTicksPressed = -1
 
@@ -114,11 +119,43 @@ object ViewModel : Module(
         val emptyHand = itemStack.isEmpty
         if (ignoreHand && emptyHand) return
 
+        applyItemFOV(matrices, side, emptyHand)
         scale(side, matrices, emptyHand)
         position(side, matrices, emptyHand)
         rotate(side, matrices, emptyHand)
     }
 
+    private fun applyItemFOV(matrices: MatrixStack, side: Side, emptyHand: Boolean) {
+        val fov = when {
+            side == Side.Left -> leftFOV
+            emptyHand -> handFOV
+            else -> rightFOV
+        }.toFloat()
+
+        if (fov == 70f) return
+
+        val fovRatio = tan(Math.toRadians(fov.toDouble()/2)).toFloat() / tan(Math.toRadians(70.0/2)).toFloat()
+
+        val matrix = matrices.peek().positionMatrix
+
+        val distance = if (emptyHand) {
+            handFOVAnchorDistance
+        } else {
+            when (side) {
+                Side.Left -> leftFOVAnchorDistance
+                Side.Right -> rightFOVAnchorDistance
+            }
+        }
+
+        val warpMatrix = Matrix4f().apply {
+            translate(0f, 0f, -distance)
+            scale(1f, 1f, fovRatio)
+            translate(0f, 0f, distance)
+        }
+
+        matrix.mul(warpMatrix)
+    }
+
     private fun scale(side: Side, matrices: MatrixStack, emptyHand: Boolean) {
         val scaleVec = getScaleVec(side, emptyHand)
         matrices.scale(scaleVec.x, scaleVec.y, scaleVec.z)

From ca1b162834002a9b489b7a2785f25b8a42129530 Mon Sep 17 00:00:00 2001
From: beanbag44 
Date: Wed, 4 Jun 2025 23:35:44 +0100
Subject: [PATCH 10/16] better split settings

---
 .../lambda/module/modules/render/ViewModel.kt | 105 ++++++++++--------
 1 file changed, 57 insertions(+), 48 deletions(-)

diff --git a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
index 555ad231a..86704131b 100644
--- a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
+++ b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
@@ -26,8 +26,6 @@ object ViewModel : Module(
 ) {
     private val page by setting("Page", Page.General)
 
-    //ToDo: implement the rest of the settings and maybe add a couple more
-
     private val ignoreHand by setting("Ignore Hand", false, "Prevents adjusting the players hand") { page == Page.General }
     private val swingMode by setting("Swing Mode", SwingMode.Standard, "Changes which hands swing") { page == Page.General }
     val swingDuration by setting("Swing Duration", 6, 0..20, 1, "Adjusts how fast the player swings", "ticks") { page == Page.General }
@@ -35,38 +33,49 @@ object ViewModel : Module(
     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 }
     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 }
     val oldAnimations by setting("Old Animations", false, "Adjusts the animations to look like they did in 1.8") { page == Page.General }
-    val swapAnimation by setting("Swap Animation", true, "If disabled, it removes the drop down animation when swapping item") { page == Page.General && oldAnimations }
-    val shadow by setting("Shadows", true, "If disabled, it removes shadows on the model") { page == Page.General }
-
-    private val linkedScale by setting("Linked Scale", true, "Links both hands scale settings") { page == Page.Scale }
-    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 } }
-    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 } }
-    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 } }
-    private var rightXScale by setting("Right X Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && !linkedScale }
-    private var rightYScale by setting("Right Y Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && !linkedScale }
-    private var rightZScale by setting("Right Z Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && !linkedScale }
-
-    private val linkedPosition by setting("Linked Position", true, "Links both hands position settings") { page == Page.Position }
-    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 } }
-    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 } }
-    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 } }
-    private var rightXPosition by setting("Right X Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && !linkedPosition }
-    private var rightYPosition by setting("Right Y Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && !linkedPosition }
-    private var rightZPosition by setting("Right Z Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && !linkedPosition }
-
-    private val linkedRotation by setting("Linked Rotation", true, "Links both hands rotation settings") { page == Page.Rotation }
-    private val leftXRotation by setting("Left X Rotation", 0, -180..180, 1) { page == Page.Rotation }.apply { onValueChange { _, to -> if (linkedRotation) rightXRotation = to } }
-    private val leftYRotation by setting("Left Y Rotation", 0, -180..180, 1) { page == Page.Rotation }.apply { onValueChange { _, to -> if (linkedRotation) rightYRotation = to } }
-    private val leftZRotation by setting("Left Z Rotation", 0, -180..180, 1) { page == Page.Rotation }.apply { onValueChange { _, to -> if (linkedRotation) rightZRotation = to } }
-    private var rightXRotation by setting("Right X Rotation", 0, -180..180, 1) { page == Page.Rotation && !linkedRotation }
-    private var rightYRotation by setting("Right Y Rotation", 0, -180..180, 1) { page == Page.Rotation && !linkedRotation }
-    private var rightZRotation by setting("Right Z Rotation", 0, -180..180, 1) { page == Page.Rotation && !linkedRotation }
-
-    private val linkedFOV by setting("Linked FOV", true, "Links both hands FOV settings") { page == Page.FOV }
-    private val leftFOV by setting("Left FOV", 70, 10..180, 1) { page == Page.FOV }.apply { onValueChange { _, to -> if (linkedFOV) rightFOV = to } }
-    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 } }
-    private var rightFOV by setting("Right FOV", 70, 10..180, 1) { page == Page.FOV && !linkedFOV }
-    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 }
+    val swapAnimation by setting("Swap Animation", true, "If disabled, removes the drop down animation when swapping item") { page == Page.General && oldAnimations }
+    val shadow by setting("Shadows", true, "If disabled, removes shadows on the model") { page == Page.General }
+
+    private val splitScale by setting("Split Scale", false, "Splits left and right hand scale settings") { page == Page.Scale }
+    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 } }
+    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 } }
+    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 } }
+    private var leftXScale by setting("Left X Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && splitScale }
+    private var leftYScale by setting("Left Y Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && splitScale }
+    private var leftZScale by setting("Left Z Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && splitScale }
+    private var rightXScale by setting("Right X Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && splitScale }
+    private var rightYScale by setting("Right Y Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && splitScale }
+    private var rightZScale by setting("Right Z Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && splitScale }
+
+    private val splitPosition by setting("Split Position", false, "Splits left and right position settings") { page == Page.Position }
+    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 } }
+    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 } }
+    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 } }
+    private var leftXPosition by setting("Left X Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && splitPosition }
+    private var leftYPosition by setting("Left Y Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && splitPosition }
+    private var leftZPosition by setting("Left Z Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && splitPosition }
+    private var rightXPosition by setting("Right X Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && splitPosition }
+    private var rightYPosition by setting("Right Y Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && splitPosition }
+    private var rightZPosition by setting("Right Z Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && splitPosition }
+
+    private val splitRotation by setting("Split Rotation", false, "Splits left and right rotation settings") { page == Page.Rotation }
+    private val xRotation by setting("X Rotation", 0, -180..180, 1) { page == Page.Rotation && !splitRotation }.apply { onValueChange { _, to -> leftXRotation = to; rightXRotation = to } }
+    private val yRotation by setting("Y Rotation", 0, -180..180, 1) { page == Page.Rotation && !splitRotation }.apply { onValueChange { _, to -> leftYRotation = to; rightYRotation = to } }
+    private val zRotation by setting("Z Rotation", 0, -180..180, 1) { page == Page.Rotation && !splitRotation }.apply { onValueChange { _, to -> leftZRotation = to; rightZRotation = to } }
+    private var leftXRotation by setting("Left X Rotation", 0, -180..180, 1) { page == Page.Rotation && splitRotation }
+    private var leftYRotation by setting("Left Y Rotation", 0, -180..180, 1) { page == Page.Rotation && splitRotation }
+    private var leftZRotation by setting("Left Z Rotation", 0, -180..180, 1) { page == Page.Rotation && splitRotation }
+    private var rightXRotation by setting("Right X Rotation", 0, -180..180, 1) { page == Page.Rotation && splitRotation }
+    private var rightYRotation by setting("Right Y Rotation", 0, -180..180, 1) { page == Page.Rotation && splitRotation }
+    private var rightZRotation by setting("Right Z Rotation", 0, -180..180, 1) { page == Page.Rotation && splitRotation }
+
+    private val splitFov by setting("Split FOV", false, "Splits left and right Fov settings") { page == Page.Fov }
+    private val fov by setting("FOV", 70, 10..180, 1) { page == Page.Fov && !splitFov }.apply { onValueChange { _, to -> leftFov = to; rightFov = to } }
+    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 } }
+    private var leftFov by setting("Left FOV", 70, 10..180, 1) { page == Page.Fov  && splitFov}
+    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 }
+    private var rightFov by setting("Right FOV", 70, 10..180, 1) { page == Page.Fov && splitFov }
+    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 }
 
     private val handXScale by setting("Hand X Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
     private val handYScale by setting("Hand Y Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
@@ -74,11 +83,11 @@ object ViewModel : Module(
     private val handXPosition by setting("Hand X Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
     private val handYPosition by setting("Hand Y Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
     private val handZPosition by setting("Hand Z Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
-    private var handXRotation by setting("Hand X Rotation", 0, -180..180, 1) { page == Page.Hand }
-    private var handYRotation by setting("Hand Y Rotation", 0, -180..180, 1) { page == Page.Hand }
-    private var handZRotation by setting("Hand Z Rotation", 0, -180..180, 1) { page == Page.Hand }
-    private val handFOV by setting("Hand FOV", 70, 10..180, 1) { page == Page.Hand }
-    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 }
+    private val handXRotation by setting("Hand X Rotation", 0, -180..180, 1) { page == Page.Hand }
+    private val handYRotation by setting("Hand Y Rotation", 0, -180..180, 1) { page == Page.Hand }
+    private val handZRotation by setting("Hand Z Rotation", 0, -180..180, 1) { page == Page.Hand }
+    private val handFov by setting("Hand FOV", 70, 10..180, 1) { page == Page.Hand }
+    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 }
 
     private var attackKeyTicksPressed = -1
 
@@ -119,17 +128,17 @@ object ViewModel : Module(
         val emptyHand = itemStack.isEmpty
         if (ignoreHand && emptyHand) return
 
-        applyItemFOV(matrices, side, emptyHand)
+        applyItemFov(matrices, side, emptyHand)
         scale(side, matrices, emptyHand)
         position(side, matrices, emptyHand)
         rotate(side, matrices, emptyHand)
     }
 
-    private fun applyItemFOV(matrices: MatrixStack, side: Side, emptyHand: Boolean) {
+    private fun applyItemFov(matrices: MatrixStack, side: Side, emptyHand: Boolean) {
         val fov = when {
-            side == Side.Left -> leftFOV
-            emptyHand -> handFOV
-            else -> rightFOV
+            side == Side.Left -> leftFov
+            emptyHand -> handFov
+            else -> rightFov
         }.toFloat()
 
         if (fov == 70f) return
@@ -139,11 +148,11 @@ object ViewModel : Module(
         val matrix = matrices.peek().positionMatrix
 
         val distance = if (emptyHand) {
-            handFOVAnchorDistance
+            handFovAnchorDistance
         } else {
             when (side) {
-                Side.Left -> leftFOVAnchorDistance
-                Side.Right -> rightFOVAnchorDistance
+                Side.Left -> leftFovAnchorDistance
+                Side.Right -> rightFovAnchorDistance
             }
         }
 
@@ -226,7 +235,7 @@ object ViewModel : Module(
         }
 
     private enum class Page {
-        General, Scale, Position, Rotation, FOV, Hand
+        General, Scale, Position, Rotation, Fov, Hand
     }
 
     private enum class Side {

From 5267d85b754b944623fae3d32e2033a6474c5ad7 Mon Sep 17 00:00:00 2001
From: beanbag44 
Date: Wed, 4 Jun 2025 23:52:48 +0100
Subject: [PATCH 11/16] moved and renamed ignoreHand

---
 .../main/kotlin/com/lambda/module/modules/render/ViewModel.kt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
index 86704131b..80a83eb62 100644
--- a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
+++ b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
@@ -26,7 +26,6 @@ object ViewModel : Module(
 ) {
     private val page by setting("Page", Page.General)
 
-    private val ignoreHand by setting("Ignore Hand", false, "Prevents adjusting the players hand") { page == Page.General }
     private val swingMode by setting("Swing Mode", SwingMode.Standard, "Changes which hands swing") { page == Page.General }
     val swingDuration by setting("Swing Duration", 6, 0..20, 1, "Adjusts how fast the player swings", "ticks") { page == Page.General }
     private val noSwingDelay by setting("No Swing Delay", false, "Removes the delay between swings") { page == Page.General }
@@ -77,6 +76,7 @@ object ViewModel : Module(
     private var rightFov by setting("Right FOV", 70, 10..180, 1) { page == Page.Fov && splitFov }
     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 }
 
+    private val enableHand by setting("Hand", false, "Enables settings for the players hand") { page == Page.Hand }
     private val handXScale by setting("Hand X Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
     private val handYScale by setting("Hand Y Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
     private val handZScale by setting("Hand Z Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
@@ -126,7 +126,7 @@ object ViewModel : Module(
         }
 
         val emptyHand = itemStack.isEmpty
-        if (ignoreHand && emptyHand) return
+        if (!enableHand) return
 
         applyItemFov(matrices, side, emptyHand)
         scale(side, matrices, emptyHand)

From 80d358e32d1bb4bde3e2645320cde6ef4e0fac79 Mon Sep 17 00:00:00 2001
From: beanbag44 
Date: Thu, 5 Jun 2025 19:52:16 +0100
Subject: [PATCH 12/16] forgor empty hand check

---
 .../main/kotlin/com/lambda/module/modules/render/ViewModel.kt   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
index 80a83eb62..a5f2cf951 100644
--- a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
+++ b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
@@ -126,7 +126,7 @@ object ViewModel : Module(
         }
 
         val emptyHand = itemStack.isEmpty
-        if (!enableHand) return
+        if (!enableHand && emptyHand) return
 
         applyItemFov(matrices, side, emptyHand)
         scale(side, matrices, emptyHand)

From c592f17615d74eda8316204f3c506cf86f30a199 Mon Sep 17 00:00:00 2001
From: beanbag44 
Date: Sat, 7 Jun 2025 21:21:55 +0100
Subject: [PATCH 13/16] private SwingMode enum

---
 .../main/kotlin/com/lambda/module/modules/render/ViewModel.kt   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
index a5f2cf951..ea553d38c 100644
--- a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
+++ b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
@@ -242,7 +242,7 @@ object ViewModel : Module(
         Left, Right
     }
 
-    enum class SwingMode {
+    private enum class SwingMode {
         Standard, Opposites, MainHand, OffHand, None
     }
 }
\ No newline at end of file

From 8f54315dee20dee4bf7a6da31a4d0e7683642c40 Mon Sep 17 00:00:00 2001
From: beanbag44 
Date: Thu, 17 Jul 2025 13:02:21 +0100
Subject: [PATCH 14/16] commented out and added todo for shadow setting

---
 .../lambda/module/modules/render/ViewModel.kt | 25 ++++++++++---------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
index ea553d38c..1dfd4bba8 100644
--- a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
+++ b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
@@ -33,7 +33,8 @@ object ViewModel : Module(
     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 }
     val oldAnimations by setting("Old Animations", false, "Adjusts the animations to look like they did in 1.8") { page == Page.General }
     val swapAnimation by setting("Swap Animation", true, "If disabled, removes the drop down animation when swapping item") { page == Page.General && oldAnimations }
-    val shadow by setting("Shadows", true, "If disabled, removes shadows on the model") { page == Page.General }
+    //ToDo: Implement
+//    val shadow by setting("Shadows", true, "If disabled, removes shadows on the model") { page == Page.General }
 
     private val splitScale by setting("Split Scale", false, "Splits left and right hand scale settings") { page == Page.Scale }
     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 } }
@@ -77,17 +78,17 @@ object ViewModel : Module(
     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 }
 
     private val enableHand by setting("Hand", false, "Enables settings for the players hand") { page == Page.Hand }
-    private val handXScale by setting("Hand X Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
-    private val handYScale by setting("Hand Y Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
-    private val handZScale by setting("Hand Z Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
-    private val handXPosition by setting("Hand X Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
-    private val handYPosition by setting("Hand Y Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
-    private val handZPosition by setting("Hand Z Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand }
-    private val handXRotation by setting("Hand X Rotation", 0, -180..180, 1) { page == Page.Hand }
-    private val handYRotation by setting("Hand Y Rotation", 0, -180..180, 1) { page == Page.Hand }
-    private val handZRotation by setting("Hand Z Rotation", 0, -180..180, 1) { page == Page.Hand }
-    private val handFov by setting("Hand FOV", 70, 10..180, 1) { page == Page.Hand }
-    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 }
+    private val handXScale by setting("Hand X Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand && enableHand }
+    private val handYScale by setting("Hand Y Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand && enableHand }
+    private val handZScale by setting("Hand Z Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand && enableHand }
+    private val handXPosition by setting("Hand X Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand && enableHand }
+    private val handYPosition by setting("Hand Y Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand && enableHand }
+    private val handZPosition by setting("Hand Z Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Hand && enableHand }
+    private val handXRotation by setting("Hand X Rotation", 0, -180..180, 1) { page == Page.Hand && enableHand }
+    private val handYRotation by setting("Hand Y Rotation", 0, -180..180, 1) { page == Page.Hand && enableHand }
+    private val handZRotation by setting("Hand Z Rotation", 0, -180..180, 1) { page == Page.Hand && enableHand }
+    private val handFov by setting("Hand FOV", 70, 10..180, 1) { page == Page.Hand && enableHand }
+    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 && enableHand }
 
     private var attackKeyTicksPressed = -1
 

From c0cb1e1fa86fb833e049cbf651e819b056acfd64 Mon Sep 17 00:00:00 2001
From: beanbag44 
Date: Thu, 17 Jul 2025 13:07:47 +0100
Subject: [PATCH 15/16] fixed mouse click event listener

---
 .../kotlin/com/lambda/module/modules/render/ViewModel.kt | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
index 1dfd4bba8..ad11c7868 100644
--- a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
+++ b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
@@ -7,7 +7,6 @@ import com.lambda.event.events.TickEvent
 import com.lambda.event.listener.SafeListener.Companion.listen
 import com.lambda.module.Module
 import com.lambda.module.tag.ModuleTag
-import com.lambda.util.Mouse
 import net.minecraft.client.network.AbstractClientPlayerEntity
 import net.minecraft.client.util.math.MatrixStack
 import net.minecraft.item.ItemStack
@@ -94,12 +93,8 @@ object ViewModel : Module(
 
     init {
         listen { event ->
-            if (event.button.key == mc.options.attackKey.boundKey.code) {
-                // For some reason click and release seem to be swapped???
-                attackKeyTicksPressed = when (event.action) {
-                    Mouse.Action.Click -> -1
-                    Mouse.Action.Release -> 0
-                }
+            if (event.button == mc.options.attackKey.boundKey.code) {
+                attackKeyTicksPressed = if (event.action == 0) -1 else 0
             }
         }
         listen { event ->

From 9b9ad3e7b75df9a84919c194b01c23ceaff9d34d Mon Sep 17 00:00:00 2001
From: Edouard127 <46357922+Edouard127@users.noreply.github.com>
Date: Thu, 24 Jul 2025 15:27:21 -0400
Subject: [PATCH 16/16] nit

---
 .../lambda/module/modules/render/ViewModel.kt | 40 +++++++++----------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
index ad11c7868..9475833bc 100644
--- a/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
+++ b/common/src/main/kotlin/com/lambda/module/modules/render/ViewModel.kt
@@ -36,9 +36,9 @@ object ViewModel : Module(
 //    val shadow by setting("Shadows", true, "If disabled, removes shadows on the model") { page == Page.General }
 
     private val splitScale by setting("Split Scale", false, "Splits left and right hand scale settings") { page == Page.Scale }
-    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 } }
-    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 } }
-    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 } }
+    private val xScale by setting("X Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && !splitScale }.onValueChange { _, to -> leftXScale = to; rightXScale = to }
+    private val yScale by setting("Y Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && !splitScale }.onValueChange { _, to -> leftYScale = to; rightYScale = to }
+    private val zScale by setting("Z Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && !splitScale }.onValueChange { _, to -> leftZScale = to; rightZScale = to }
     private var leftXScale by setting("Left X Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && splitScale }
     private var leftYScale by setting("Left Y Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && splitScale }
     private var leftZScale by setting("Left Z Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && splitScale }
@@ -47,9 +47,9 @@ object ViewModel : Module(
     private var rightZScale by setting("Right Z Scale", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Scale && splitScale }
 
     private val splitPosition by setting("Split Position", false, "Splits left and right position settings") { page == Page.Position }
-    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 } }
-    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 } }
-    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 } }
+    private val xPosition by setting("X Position", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && !splitPosition }.onValueChange { _, to -> leftXPosition = to; rightXPosition = to }
+    private val yPosition by setting("Y Position", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && !splitPosition }.onValueChange { _, to -> leftYPosition = to; rightYPosition = to }
+    private val zPosition by setting("Z Position", 1.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && !splitPosition }.onValueChange { _, to -> leftZPosition = to; rightZPosition = to }
     private var leftXPosition by setting("Left X Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && splitPosition }
     private var leftYPosition by setting("Left Y Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && splitPosition }
     private var leftZPosition by setting("Left Z Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && splitPosition }
@@ -58,9 +58,9 @@ object ViewModel : Module(
     private var rightZPosition by setting("Right Z Position", 0.0f, -1.0f..1.0f, 0.025f) { page == Page.Position && splitPosition }
 
     private val splitRotation by setting("Split Rotation", false, "Splits left and right rotation settings") { page == Page.Rotation }
-    private val xRotation by setting("X Rotation", 0, -180..180, 1) { page == Page.Rotation && !splitRotation }.apply { onValueChange { _, to -> leftXRotation = to; rightXRotation = to } }
-    private val yRotation by setting("Y Rotation", 0, -180..180, 1) { page == Page.Rotation && !splitRotation }.apply { onValueChange { _, to -> leftYRotation = to; rightYRotation = to } }
-    private val zRotation by setting("Z Rotation", 0, -180..180, 1) { page == Page.Rotation && !splitRotation }.apply { onValueChange { _, to -> leftZRotation = to; rightZRotation = to } }
+    private val xRotation by setting("X Rotation", 0, -180..180, 1) { page == Page.Rotation && !splitRotation }.onValueChange { _, to -> leftXRotation = to; rightXRotation = to }
+    private val yRotation by setting("Y Rotation", 0, -180..180, 1) { page == Page.Rotation && !splitRotation }.onValueChange { _, to -> leftYRotation = to; rightYRotation = to }
+    private val zRotation by setting("Z Rotation", 0, -180..180, 1) { page == Page.Rotation && !splitRotation }.onValueChange { _, to -> leftZRotation = to; rightZRotation = to }
     private var leftXRotation by setting("Left X Rotation", 0, -180..180, 1) { page == Page.Rotation && splitRotation }
     private var leftYRotation by setting("Left Y Rotation", 0, -180..180, 1) { page == Page.Rotation && splitRotation }
     private var leftZRotation by setting("Left Z Rotation", 0, -180..180, 1) { page == Page.Rotation && splitRotation }
@@ -69,8 +69,8 @@ object ViewModel : Module(
     private var rightZRotation by setting("Right Z Rotation", 0, -180..180, 1) { page == Page.Rotation && splitRotation }
 
     private val splitFov by setting("Split FOV", false, "Splits left and right Fov settings") { page == Page.Fov }
-    private val fov by setting("FOV", 70, 10..180, 1) { page == Page.Fov && !splitFov }.apply { onValueChange { _, to -> leftFov = to; rightFov = to } }
-    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 } }
+    private val fov by setting("FOV", 70, 10..180, 1) { page == Page.Fov && !splitFov }.onValueChange { _, to -> leftFov = to; rightFov = to }
+    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 }.onValueChange { _, to -> leftFovAnchorDistance = to; rightFovAnchorDistance = to }
     private var leftFov by setting("Left FOV", 70, 10..180, 1) { page == Page.Fov  && splitFov}
     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 }
     private var rightFov by setting("Right FOV", 70, 10..180, 1) { page == Page.Fov && splitFov }
@@ -93,10 +93,10 @@ object ViewModel : Module(
 
     init {
         listen { event ->
-            if (event.button == mc.options.attackKey.boundKey.code) {
+            if (event.button == mc.options.attackKey.boundKey.code)
                 attackKeyTicksPressed = if (event.action == 0) -1 else 0
-            }
         }
+
         listen { event ->
             if (event.keyCode == mc.options.attackKey.boundKey.code) {
                 if (event.isPressed) {
@@ -108,9 +108,8 @@ object ViewModel : Module(
         }
 
         listen {
-            if (attackKeyTicksPressed != -1) {
+            if (attackKeyTicksPressed != -1)
                 attackKeyTicksPressed++
-            }
         }
     }
 
@@ -220,10 +219,11 @@ object ViewModel : Module(
 
     private fun swingHand(hand: Hand, player: AbstractClientPlayerEntity) =
         with(player) {
-            if ((!handSwinging || handSwingTicks >= handSwingDuration / 2)
-                || handSwingTicks < 0
-                || (noSwingDelay && attackKeyTicksPressed <= 1)
-                ) {
+            if (
+                (!handSwinging || handSwingTicks >= handSwingDuration / 2) ||
+                handSwingTicks < 0 ||
+                (noSwingDelay && attackKeyTicksPressed <= 1))
+            {
                 handSwingTicks = -1
                 handSwinging = true
                 preferredHand = hand
@@ -241,4 +241,4 @@ object ViewModel : Module(
     private enum class SwingMode {
         Standard, Opposites, MainHand, OffHand, None
     }
-}
\ No newline at end of file
+}