-
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
11 changed files
with
181 additions
and
84 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
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
125 changes: 125 additions & 0 deletions
125
src/main/java/net/aspw/client/features/module/impl/player/ReverseFreecam.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,125 @@ | ||
package net.aspw.client.features.module.impl.player | ||
|
||
import net.aspw.client.event.* | ||
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.MovementUtils | ||
import net.aspw.client.utils.PacketUtils | ||
import net.aspw.client.value.FloatValue | ||
import net.minecraft.client.entity.EntityOtherPlayerMP | ||
import net.minecraft.client.settings.GameSettings | ||
import net.minecraft.network.play.client.C03PacketPlayer | ||
import kotlin.math.cos | ||
import kotlin.math.sin | ||
|
||
@ModuleInfo(name = "ReverseFreecam", "Reverse Freecam", category = ModuleCategory.PLAYER) | ||
class ReverseFreecam : Module() { | ||
private var speedValue = FloatValue("Speed", 0.5f, 0f, 1f) | ||
private var vSpeedValue = FloatValue("V-Speed", 0.5f, 0f, 1f) | ||
|
||
private var fakePlayer: EntityOtherPlayerMP? = null | ||
private var startX: Double? = null | ||
private var startY: Double? = null | ||
private var startZ: Double? = null | ||
|
||
override fun onDisable() { | ||
reset() | ||
} | ||
|
||
private fun reset() { | ||
if (fakePlayer != null) { | ||
mc.theWorld.removeEntityFromWorld(fakePlayer!!.entityId) | ||
fakePlayer = null | ||
} | ||
if (startX != null && startY != null && startZ != null) { | ||
startX = null | ||
startY = null | ||
startZ = null | ||
} | ||
if (GameSettings.isKeyDown(mc.gameSettings.keyBindSneak)) | ||
mc.gameSettings.keyBindSneak.pressed = true | ||
} | ||
|
||
@EventTarget | ||
fun onWorld(event: WorldEvent) { | ||
state = false | ||
chat("ReverseFreecam was disabled") | ||
} | ||
|
||
@EventTarget | ||
fun onUpdate(event: UpdateEvent) { | ||
if (startX != null && startY != null && startZ != null) { | ||
if (MovementUtils.isMoving()) { | ||
startX = startX!! - sin(MovementUtils.getDirection()) * speedValue.get() | ||
startZ = startZ!! + cos(MovementUtils.getDirection()) * speedValue.get() | ||
} | ||
if (GameSettings.isKeyDown(mc.gameSettings.keyBindJump)) | ||
startY = startY!! + vSpeedValue.get() | ||
if (GameSettings.isKeyDown(mc.gameSettings.keyBindSneak)) { | ||
startY = startY!! - vSpeedValue.get() | ||
mc.gameSettings.keyBindSneak.pressed = false | ||
} | ||
} | ||
} | ||
|
||
@EventTarget | ||
fun onMotion(event: MotionEvent) { | ||
if (startX == null) | ||
startX = mc.thePlayer.posX | ||
if (startY == null) | ||
startY = mc.thePlayer.posY | ||
if (startZ == null) | ||
startZ = mc.thePlayer.posZ | ||
mc.thePlayer.cameraPitch = 0f | ||
mc.thePlayer.cameraYaw = 0f | ||
} | ||
|
||
@EventTarget | ||
fun onTeleport(event: TeleportEvent) { | ||
startX = event.posX | ||
startY = event.posY | ||
startZ = event.posZ | ||
event.cancelEvent() | ||
} | ||
|
||
@EventTarget | ||
fun onMove(event: MoveEvent) { | ||
event.zero() | ||
} | ||
|
||
@EventTarget | ||
fun onPacket(event: PacketEvent) { | ||
val packet = event.packet | ||
|
||
if (packet is C03PacketPlayer) { | ||
fakePlayer = EntityOtherPlayerMP(mc.theWorld, mc.thePlayer.gameProfile) | ||
fakePlayer!!.clonePlayer(mc.thePlayer, true) | ||
fakePlayer!!.copyLocationAndAnglesFrom(mc.thePlayer) | ||
fakePlayer!!.prevRotationYaw = mc.thePlayer.prevRotationYaw | ||
fakePlayer!!.prevRotationPitch = mc.thePlayer.prevRotationPitch | ||
fakePlayer!!.prevRenderYawOffset = mc.thePlayer.prevRenderYawOffset | ||
fakePlayer!!.prevRotationYawHead = mc.thePlayer.prevRotationYawHead | ||
fakePlayer!!.rotationYaw = mc.thePlayer.rotationYaw | ||
fakePlayer!!.rotationPitch = mc.thePlayer.rotationPitch | ||
fakePlayer!!.renderYawOffset = mc.thePlayer.renderYawOffset | ||
fakePlayer!!.rotationYawHead = mc.thePlayer.rotationYawHead | ||
fakePlayer!!.posX = startX!! | ||
fakePlayer!!.posY = startY!! | ||
fakePlayer!!.posZ = startZ!! | ||
mc.theWorld.addEntityToWorld(-1337, fakePlayer) | ||
event.cancelEvent() | ||
if (startX != null && startY != null && startZ != null) | ||
PacketUtils.sendPacketNoEvent( | ||
C03PacketPlayer.C06PacketPlayerPosLook( | ||
startX!!, | ||
startY!!, | ||
startZ!!, | ||
packet.yaw, | ||
packet.pitch, | ||
packet.onGround | ||
) | ||
) | ||
} | ||
} | ||
} |
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.