Skip to content

Commit 38b43e1

Browse files
authored
New feature for Freecam: Cheese Mode (#420)
1 parent b3bf037 commit 38b43e1

File tree

1 file changed

+19
-1
lines changed
  • src/main/kotlin/com/lambda/client/module/modules/player

1 file changed

+19
-1
lines changed

src/main/kotlin/com/lambda/client/module/modules/player/Freecam.kt

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import net.minecraft.entity.Entity
3030
import net.minecraft.entity.MoverType
3131
import net.minecraft.entity.player.EntityPlayer
3232
import net.minecraft.network.play.client.CPacketUseEntity
33+
import net.minecraft.network.play.server.SPacketEntityHeadLook
3334
import net.minecraft.util.MovementInput
3435
import net.minecraft.util.MovementInputFromOptions
3536
import net.minecraft.util.math.BlockPos
@@ -55,6 +56,7 @@ object Freecam : Module(
5556
private val horizontalSpeed by setting("Horizontal Speed", 20.0f, 1.0f..50.0f, 1f)
5657
private val verticalSpeed by setting("Vertical Speed", 20.0f, 1.0f..50.0f, 1f, { directionMode == FlightMode.CREATIVE })
5758
private val autoRotate by setting("Auto Rotate", true)
59+
private val cheese by setting("Cheese", false, description = "Make group pictures without headache")
5860
private val arrowKeyMove by setting("Arrow Key Move", true)
5961
private val disableOnDisconnect by setting("Disconnect Disable", true)
6062
private val leftClickCome by setting("Left Click Come", false)
@@ -158,10 +160,26 @@ object Freecam : Module(
158160

159161
if (BaritoneUtils.isActive) return@safeListener
160162

161-
if (autoRotate) updatePlayerRotation()
163+
if (cheese) {
164+
cameraGuy?.let { camGuy ->
165+
world.loadedEntityList.filterIsInstance<EntityPlayer>()
166+
.filter { otherPlayer -> otherPlayer != camGuy }
167+
.forEach { otherPlayer ->
168+
val rotation = getRotationTo(otherPlayer.getPositionEyes(1.0f), camGuy.getPositionEyes(1.0f))
169+
170+
otherPlayer.rotationYaw = rotation.x
171+
otherPlayer.rotationYawHead = rotation.x
172+
otherPlayer.rotationPitch = rotation.y
173+
}
174+
}
175+
} else if (autoRotate) updatePlayerRotation()
162176
if (arrowKeyMove) updatePlayerMovement()
163177
}
164178

179+
safeListener<PacketEvent.Receive> {
180+
if (it.packet is SPacketEntityHeadLook && cheese) it.cancel()
181+
}
182+
165183
listener<InputEvent.MouseInputEvent> {
166184
if (leftClickCome && Mouse.getEventButton() == 0 && clickTimer.tick(1L)) {
167185
val result: BlockPos = mc.objectMouseOver.blockPos ?: return@listener

0 commit comments

Comments
 (0)