@@ -2,9 +2,12 @@ package com.lambda.client.module.modules.player
2
2
3
3
import com.lambda.client.module.Category
4
4
import com.lambda.client.module.Module
5
+ import com.lambda.client.util.math.RotationUtils.getRotationTo
6
+ import com.lambda.client.util.text.MessageSendHelper
5
7
import com.lambda.client.util.threads.safeListener
6
8
import net.minecraft.client.entity.EntityPlayerSP
7
9
import net.minecraft.entity.Entity
10
+ import net.minecraft.util.math.Vec3d
8
11
import net.minecraftforge.fml.common.gameevent.TickEvent
9
12
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo
10
13
import kotlin.math.abs
@@ -18,23 +21,32 @@ object ViewLock : Module(
18
21
category = Category .PLAYER ,
19
22
alias = arrayOf("YawLock ", "PitchLock ")
20
23
) {
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 })
34
42
35
43
private enum class Page {
36
44
YAW , PITCH
37
45
}
46
+
47
+ private enum class Mode {
48
+ TRADITIONAL , COORDS
49
+ }
38
50
39
51
private var yawSnap = 0
40
52
private var pitchSnap = 0
@@ -52,6 +64,22 @@ object ViewLock : Module(
52
64
53
65
safeListener<TickEvent .ClientTickEvent > {
54
66
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
+ }
55
83
56
84
if (autoYaw.value || autoPitch.value) {
57
85
snapToSlice()
@@ -69,7 +97,7 @@ object ViewLock : Module(
69
97
70
98
@JvmStatic
71
99
fun handleTurn (entity : Entity , deltaX : Float , deltaY : Float , ci : CallbackInfo ) {
72
- if (isDisabled) return
100
+ if (isDisabled || mode == Mode . COORDS ) return
73
101
val player = mc.player ? : return
74
102
if (entity != player) return
75
103
0 commit comments