Skip to content

Commit

Permalink
New feature for Freecam: Cheese Mode (#420)
Browse files Browse the repository at this point in the history
  • Loading branch information
Avanatiker authored Nov 28, 2022
1 parent b3bf037 commit 38b43e1
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import net.minecraft.entity.Entity
import net.minecraft.entity.MoverType
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.network.play.client.CPacketUseEntity
import net.minecraft.network.play.server.SPacketEntityHeadLook
import net.minecraft.util.MovementInput
import net.minecraft.util.MovementInputFromOptions
import net.minecraft.util.math.BlockPos
Expand All @@ -55,6 +56,7 @@ object Freecam : Module(
private val horizontalSpeed by setting("Horizontal Speed", 20.0f, 1.0f..50.0f, 1f)
private val verticalSpeed by setting("Vertical Speed", 20.0f, 1.0f..50.0f, 1f, { directionMode == FlightMode.CREATIVE })
private val autoRotate by setting("Auto Rotate", true)
private val cheese by setting("Cheese", false, description = "Make group pictures without headache")
private val arrowKeyMove by setting("Arrow Key Move", true)
private val disableOnDisconnect by setting("Disconnect Disable", true)
private val leftClickCome by setting("Left Click Come", false)
Expand Down Expand Up @@ -158,10 +160,26 @@ object Freecam : Module(

if (BaritoneUtils.isActive) return@safeListener

if (autoRotate) updatePlayerRotation()
if (cheese) {
cameraGuy?.let { camGuy ->
world.loadedEntityList.filterIsInstance<EntityPlayer>()
.filter { otherPlayer -> otherPlayer != camGuy }
.forEach { otherPlayer ->
val rotation = getRotationTo(otherPlayer.getPositionEyes(1.0f), camGuy.getPositionEyes(1.0f))

otherPlayer.rotationYaw = rotation.x
otherPlayer.rotationYawHead = rotation.x
otherPlayer.rotationPitch = rotation.y
}
}
} else if (autoRotate) updatePlayerRotation()
if (arrowKeyMove) updatePlayerMovement()
}

safeListener<PacketEvent.Receive> {
if (it.packet is SPacketEntityHeadLook && cheese) it.cancel()
}

listener<InputEvent.MouseInputEvent> {
if (leftClickCome && Mouse.getEventButton() == 0 && clickTimer.tick(1L)) {
val result: BlockPos = mc.objectMouseOver.blockPos ?: return@listener
Expand Down

0 comments on commit 38b43e1

Please sign in to comment.