@@ -94,29 +94,38 @@ object RotationManager : RequestHandler<RotationRequest>(
9494 mc.crosshairTarget = blockHit
9595 }
9696
97+ listen<PacketEvent .Receive .Post >(priority = Int .MIN_VALUE ) { event ->
98+ val packet = event.packet
99+ if (packet !is PlayerPositionLookS2CPacket ) return @listen
100+
101+ runGameScheduled {
102+ reset(Rotation (packet.change.yaw, packet.change.pitch))
103+ }
104+ }
105+
106+ listenUnsafe<ConnectionEvent .Connect .Pre >(priority = Int .MIN_VALUE ) {
107+ reset(Rotation .ZERO )
108+ }
109+
110+ // Override user interactions with max priority
97111 listen<PlayerEvent .Interact .Block > {
98112 activeRotation = player.rotation
99113 }
100114
101- listen<PlayerEvent .Interact . Entity > {
115+ listen<PlayerEvent .Attack . Block > {
102116 activeRotation = player.rotation
103117 }
104118
105- listen<PlayerEvent .Interact .Item > {
119+ listen<PlayerEvent .Interact .Entity > {
106120 activeRotation = player.rotation
107121 }
108122
109- listen<PacketEvent .Receive .Post >(priority = Int .MIN_VALUE ) { event ->
110- val packet = event.packet
111- if (packet !is PlayerPositionLookS2CPacket ) return @listen
112-
113- runGameScheduled {
114- reset(Rotation (packet.change.yaw, packet.change.pitch))
115- }
123+ listen<PlayerEvent .Attack .Entity > {
124+ activeRotation = player.rotation
116125 }
117126
118- listenUnsafe< ConnectionEvent . Connect . Pre >(priority = Int . MIN_VALUE ) {
119- reset( Rotation . ZERO )
127+ listen< PlayerEvent . Interact . Item > {
128+ activeRotation = player.rotation
120129 }
121130
122131 return " Loaded Rotation Manager"
0 commit comments