forked from CCBlueX/LiquidBounce
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feats(legacy): FreeLook module, fixed rotation pitch not being smooth…
… and added FreezeYCamera option to Scaffold. (CCBlueX#4062)
- Loading branch information
Showing
14 changed files
with
216 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
src/main/java/net/ccbluex/liquidbounce/features/module/modules/render/FreeLook.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* LiquidBounce Hacked Client | ||
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge. | ||
* https://github.com/CCBlueX/LiquidBounce/ | ||
*/ | ||
package net.ccbluex.liquidbounce.features.module.modules.render | ||
|
||
import net.ccbluex.liquidbounce.event.EventTarget | ||
import net.ccbluex.liquidbounce.event.RotationSetEvent | ||
import net.ccbluex.liquidbounce.features.module.Category | ||
import net.ccbluex.liquidbounce.features.module.Module | ||
import net.ccbluex.liquidbounce.utils.Rotation | ||
import net.ccbluex.liquidbounce.utils.extensions.prevRotation | ||
import net.ccbluex.liquidbounce.utils.extensions.rotation | ||
|
||
object FreeLook : Module("FreeLook", Category.RENDER) { | ||
|
||
// The module's rotations | ||
private var currRotation = Rotation.ZERO | ||
private var prevRotation = currRotation | ||
|
||
// The player's rotations | ||
private var savedCurrRotation = Rotation.ZERO | ||
private var savedPrevRotation = Rotation.ZERO | ||
|
||
override fun onEnable() { | ||
mc.thePlayer?.run { | ||
currRotation = rotation | ||
prevRotation = prevRotation | ||
} | ||
} | ||
|
||
@EventTarget | ||
fun onRotationSet(event: RotationSetEvent) { | ||
if (mc.gameSettings.thirdPersonView != 0) { | ||
event.cancelEvent() | ||
} | ||
|
||
prevRotation = currRotation | ||
currRotation += Rotation(event.yawDiff, -event.pitchDiff) | ||
|
||
currRotation.withLimitedPitch() | ||
} | ||
|
||
fun useModifiedRotation() { | ||
val player = mc.thePlayer ?: return | ||
|
||
savedCurrRotation = player.rotation | ||
savedPrevRotation = player.prevRotation | ||
|
||
if (!handleEvents()) | ||
return | ||
|
||
player.rotation = currRotation | ||
player.prevRotation = prevRotation | ||
} | ||
|
||
fun restoreOriginalRotation() { | ||
val player = mc.thePlayer ?: return | ||
|
||
if (mc.gameSettings.thirdPersonView == 0) { | ||
savedCurrRotation = player.rotation | ||
savedPrevRotation = player.prevRotation | ||
return | ||
} | ||
|
||
if (!handleEvents()) | ||
return | ||
|
||
player.rotation = savedCurrRotation | ||
player.prevRotation = savedPrevRotation | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.