@@ -2,9 +2,12 @@ package com.lambda.client.module.modules.player
22
33import com.lambda.client.module.Category
44import com.lambda.client.module.Module
5+ import com.lambda.client.util.math.RotationUtils.getRotationTo
6+ import com.lambda.client.util.text.MessageSendHelper
57import com.lambda.client.util.threads.safeListener
68import net.minecraft.client.entity.EntityPlayerSP
79import net.minecraft.entity.Entity
10+ import net.minecraft.util.math.Vec3d
811import net.minecraftforge.fml.common.gameevent.TickEvent
912import org.spongepowered.asm.mixin.injection.callback.CallbackInfo
1013import kotlin.math.abs
@@ -18,23 +21,32 @@ object ViewLock : Module(
1821 category = Category .PLAYER ,
1922 alias = arrayOf("YawLock ", "PitchLock ")
2023) {
21- private val page by setting(" Page" , Page .YAW )
22-
23- private val yaw by setting(" Yaw" , true , { page == Page .YAW })
24- private val autoYaw = setting(" Auto Yaw" , true , { page == Page .YAW && yaw })
25- private val disableMouseYaw by setting(" Disable Mouse Yaw" , false , { page == Page .YAW && yaw && yaw })
26- private val specificYaw by setting(" Specific Yaw" , 180.0f , - 180.0f .. 180.0f , 1.0f , { page == Page .YAW && ! autoYaw.value && yaw })
27- private val yawSlice = setting(" Yaw Slice" , 8 , 2 .. 32 , 1 , { page == Page .YAW && autoYaw.value && yaw })
28-
29- private val pitch by setting(" Pitch" , true , { page == Page .PITCH })
30- private val autoPitch = setting(" Auto Pitch" , true , { page == Page .PITCH && pitch })
31- private val disableMousePitch by setting(" Disable Mouse Pitch" , false , { page == Page .PITCH && pitch && pitch })
32- private val specificPitch by setting(" Specific Pitch" , 0.0f , - 90.0f .. 90.0f , 1.0f , { page == Page .PITCH && ! autoPitch.value && pitch })
33- private val pitchSlice = setting(" Pitch Slice" , 5 , 2 .. 32 , 1 , { page == Page .PITCH && autoPitch.value && pitch })
24+ private val mode by setting(" Mode" , Mode .TRADITIONAL )
25+ private val page by setting(" Page" , Page .YAW , { mode == Mode .TRADITIONAL })
26+
27+ private val yaw by setting(" Yaw" , true , { mode == Mode .TRADITIONAL && page == Page .YAW })
28+ private val autoYaw = setting(" Auto Yaw" , true , { mode == Mode .TRADITIONAL && page == Page .YAW && yaw })
29+ private val disableMouseYaw by setting(" Disable Mouse Yaw" , false , { mode == Mode .TRADITIONAL && page == Page .YAW && yaw && yaw })
30+ private val specificYaw by setting(" Specific Yaw" , 180.0f , - 180.0f .. 180.0f , 1.0f , { mode == Mode .TRADITIONAL && page == Page .YAW && ! autoYaw.value && yaw })
31+ private val yawSlice = setting(" Yaw Slice" , 8 , 2 .. 32 , 1 , { mode == Mode .TRADITIONAL && page == Page .YAW && autoYaw.value && yaw })
32+
33+ private val pitch by setting(" Pitch" , true , { mode == Mode .TRADITIONAL && page == Page .PITCH })
34+ private val autoPitch = setting(" Auto Pitch" , true , { mode == Mode .TRADITIONAL && page == Page .PITCH && pitch })
35+ private val disableMousePitch by setting(" Disable Mouse Pitch" , false , { mode == Mode .TRADITIONAL && page == Page .PITCH && pitch && pitch })
36+ private val specificPitch by setting(" Specific Pitch" , 0.0f , - 90.0f .. 90.0f , 1.0f , { mode == Mode .TRADITIONAL && page == Page .PITCH && ! autoPitch.value && pitch })
37+ private val pitchSlice = setting(" Pitch Slice" , 5 , 2 .. 32 , 1 , { mode == Mode .TRADITIONAL && page == Page .PITCH && autoPitch.value && pitch })
38+
39+ private val xCoord by setting(" X coordinate" , " " , { mode == Mode .COORDS })
40+ private val yCoord by setting(" Y coordinate" , " " , { mode == Mode .COORDS })
41+ private val zCoord by setting(" Z coordinate" , " " , { mode == Mode .COORDS })
3442
3543 private enum class Page {
3644 YAW , PITCH
3745 }
46+
47+ private enum class Mode {
48+ TRADITIONAL , COORDS
49+ }
3850
3951 private var yawSnap = 0
4052 private var pitchSnap = 0
@@ -52,6 +64,22 @@ object ViewLock : Module(
5264
5365 safeListener<TickEvent .ClientTickEvent > {
5466 if (it.phase != TickEvent .Phase .END ) return @safeListener
67+
68+ if (mode == Mode .COORDS ) {
69+ val x = xCoord.toDoubleOrNull()
70+ val y = yCoord.toDoubleOrNull()
71+ val z = zCoord.toDoubleOrNull()
72+ if (x == null || y == null || z == null ) {
73+ MessageSendHelper .sendErrorMessage(" Invalid coordinates" )
74+ disable()
75+ return @safeListener
76+ }
77+
78+ val rotation = getRotationTo(Vec3d (x, y, z))
79+ player.rotationYaw = rotation.x
80+ player.rotationPitch = rotation.y
81+ return @safeListener
82+ }
5583
5684 if (autoYaw.value || autoPitch.value) {
5785 snapToSlice()
@@ -69,7 +97,7 @@ object ViewLock : Module(
6997
7098 @JvmStatic
7199 fun handleTurn (entity : Entity , deltaX : Float , deltaY : Float , ci : CallbackInfo ) {
72- if (isDisabled) return
100+ if (isDisabled || mode == Mode . COORDS ) return
73101 val player = mc.player ? : return
74102 if (entity != player) return
75103
0 commit comments