This repository has been archived by the owner on Dec 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
36 additions
and
1 deletion.
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
28 changes: 28 additions & 0 deletions
28
agent/src/main/kotlin/io/github/nilsen84/lcqt/patches/NoHitDelayPatch.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,28 @@ | ||
package io.github.nilsen84.lcqt.patches | ||
|
||
import io.github.nilsen84.lcqt.Patch | ||
import org.objectweb.asm.Opcodes | ||
import org.objectweb.asm.tree.ClassNode | ||
import org.objectweb.asm.tree.FieldInsnNode | ||
import org.objectweb.asm.tree.IntInsnNode | ||
|
||
class NoHitDelayPatch : Patch() { | ||
override fun transform(cn: ClassNode): Boolean { | ||
if (cn.name != "net/minecraft/client/Minecraft") { | ||
return false | ||
} | ||
|
||
val clickMouse = cn.methods.find { it.name == "clickMouse" } ?: return false | ||
|
||
val instructions = clickMouse.instructions | ||
.filterIsInstance<IntInsnNode>() | ||
.filter { | ||
it.opcode == Opcodes.BIPUSH && it.operand == 10 && it.next.let { | ||
it is FieldInsnNode && it.name == "leftClickCounter" | ||
} | ||
} | ||
.onEach { it.operand = 0 } | ||
|
||
return instructions.isNotEmpty() | ||
} | ||
} |
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