Skip to content

New feature for Freecam: Cheese Mode #420

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

Merged
merged 1 commit into from
Nov 28, 2022
Merged
Changes from all 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 @@ -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