Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Step): NCP mode #5273

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ object ModuleStep : ClientModule("Step", Category.MOVEMENT) {
Instant,
Legit,
Vulcan286,
BlocksMC
BlocksMC,
NCP
)).apply { tagBy(this) }

object Legit : Choice("Legit") {
Expand Down Expand Up @@ -258,3 +259,71 @@ object ModuleStep : ClientModule("Step", Category.MOVEMENT) {
}

}

/**
* NCP Step
*
* @author Jucku (code ported from legacy)
Jucku marked this conversation as resolved.
Show resolved Hide resolved
*/
object NCP : Choice("NCP") {

override val parent: ChoiceConfigurable<Choice>
get() = modes

private val delay by int("Delay", 400, 0..500, "ms")
private var stepping = false
private var lastStepTime = 0L

private val jumpOrder = listOf(
0.41999998688698,
0.7531999805212,
1.001335979112147
)

@Suppress("unused")
private val movementInputHandler = sequenceHandler<MovementInputEvent> { event ->
if (player.canStep(1.0) && !stepping) {
event.jump = true
}
}

@Suppress("unused")
private val stepHandler = handler<PlayerStepEvent> { event ->
if (!player.isOnGround || !player.canStep(1.0) || System.currentTimeMillis() - lastStepTime < delay) {
return@handler
}

event.height = 1.0F
}

@Suppress("unused")
private val stepConfirmHandler = handler<PlayerStepSuccessEvent> { event ->
val stepHeight = event.adjustedVec.y
if (stepHeight <= 0.5 || jumpOrder.isEmpty()) {
return@handler
}

player.incrementStat(Stats.JUMP)

jumpOrder.forEachIndexed { index, additionalY ->
val destinationY = player.y + additionalY

network.sendPacket(MovePacketType.FULL.generatePacket().apply {
x = player.x
y = destinationY
z = player.z
onGround = index == jumpOrder.size - 1
})
}

lastStepTime = System.currentTimeMillis()

stepping = true
}

override fun disable() {
stepping = false
lastStepTime = 0L
super.disable()
}
}
3 changes: 2 additions & 1 deletion src/main/resources/resources/liquidbounce/lang/de_de.json
Original file line number Diff line number Diff line change
Expand Up @@ -628,5 +628,6 @@
"liquidbounce.module.baritone.description": "Einstellungen für Baritone.",
"liquidbounce.command.tps.description": "Schätzt die TPS des Servers ab.",
"liquidbounce.command.tps.result.tpsCheck": "Die TPS des Servers betragen %s.",
"liquidbounce.command.tps.result.nan": "noch nicht berechnet"
"liquidbounce.command.tps.result.nan": "noch nicht berechnet",
"liquidbounce.module.anchor.description": "Geht automatisch in sichere Löcher für Crystal PvP."
}
Loading