-
Notifications
You must be signed in to change notification settings - Fork 45
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
13 changed files
with
167 additions
and
17 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
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
87 changes: 87 additions & 0 deletions
87
src/main/java/net/aspw/client/features/module/impl/visual/Test.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,87 @@ | ||
package net.aspw.client.features.module.impl.visual | ||
|
||
import net.aspw.client.event.EventTarget | ||
import net.aspw.client.event.PacketEvent | ||
import net.aspw.client.event.Render3DEvent | ||
import net.aspw.client.features.module.Module | ||
import net.aspw.client.features.module.ModuleCategory | ||
import net.aspw.client.features.module.ModuleInfo | ||
import net.aspw.client.utils.PredictUtils | ||
import net.aspw.client.utils.timer.TickTimer | ||
import net.minecraft.network.Packet | ||
import net.minecraft.network.play.client.C03PacketPlayer | ||
import java.util.concurrent.LinkedBlockingQueue | ||
import kotlin.math.abs | ||
|
||
@ModuleInfo(name = "Test", spacedName = "Test", category = ModuleCategory.VISUAL) | ||
class Test : Module() { | ||
|
||
private var packets = LinkedBlockingQueue<Packet<*>>() | ||
private var safeTimer = TickTimer() | ||
private var togglePrevent = false | ||
private var disableLogger = false | ||
private var preX: Double? = null | ||
private var preY: Double? = null | ||
private var preZ: Double? = null | ||
|
||
override fun onDisable() { | ||
reset() | ||
} | ||
|
||
@EventTarget | ||
fun onRender3D(event: Render3DEvent) { | ||
togglePrevent = PredictUtils.checkVoid() | ||
if (togglePrevent) { | ||
if (abs(mc.thePlayer.posY - preY!!) > 8) { | ||
mc.thePlayer.motionX = 0.0 | ||
mc.thePlayer.motionZ = 0.0 | ||
mc.thePlayer.setPositionAndUpdate(preX!!, preY!!, preZ!!) | ||
chat("set back") | ||
reset() | ||
} else if (safeTimer.hasTimePassed(60)) { | ||
sync() | ||
chat("realsync") | ||
} | ||
} else sync() | ||
} | ||
|
||
@EventTarget | ||
fun onPacket(event: PacketEvent) { | ||
val packet = event.packet | ||
if (mc.thePlayer == null || disableLogger) return | ||
if (packet is C03PacketPlayer && togglePrevent) { | ||
chat("CANCEL") | ||
if (preX == null) | ||
preX = mc.thePlayer.posX | ||
if (preY == null) | ||
preY = mc.thePlayer.posY | ||
if (preZ == null) | ||
preZ = mc.thePlayer.posZ | ||
packets.add(packet) | ||
safeTimer.update() | ||
event.cancelEvent() | ||
} | ||
} | ||
|
||
private fun sync() { | ||
try { | ||
disableLogger = true | ||
while (packets.isNotEmpty()) { | ||
mc.netHandler.networkManager.sendPacket(packets.take()) | ||
} | ||
reset() | ||
} catch (_: Exception) { | ||
} | ||
} | ||
|
||
private fun reset() { | ||
if (packets.isNotEmpty()) | ||
packets.clear() | ||
safeTimer.reset() | ||
togglePrevent = false | ||
disableLogger = false | ||
preX = null | ||
preY = null | ||
preZ = null | ||
} | ||
} |
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.