diff --git a/src/main/kotlin/com/lambda/module/modules/render/Freecam.kt b/src/main/kotlin/com/lambda/module/modules/render/Freecam.kt index 959dd43ce..ea23ddf72 100644 --- a/src/main/kotlin/com/lambda/module/modules/render/Freecam.kt +++ b/src/main/kotlin/com/lambda/module/modules/render/Freecam.kt @@ -22,6 +22,7 @@ import com.lambda.config.AutomationConfig.Companion.setDefaultAutomationConfig import com.lambda.config.applyEdits import com.lambda.context.SafeContext import com.lambda.event.events.MovementEvent +import com.lambda.event.events.PacketEvent import com.lambda.event.events.PlayerEvent import com.lambda.event.events.RenderEvent import com.lambda.event.events.TickEvent @@ -55,6 +56,7 @@ import com.lambda.util.world.raycast.RayCastUtils.orMiss import net.minecraft.client.network.ClientPlayerEntity import net.minecraft.client.option.Perspective import net.minecraft.entity.player.PlayerEntity +import net.minecraft.network.packet.s2c.play.PlayerRespawnS2CPacket import net.minecraft.util.hit.BlockHitResult import net.minecraft.util.hit.HitResult import net.minecraft.util.math.BlockPos @@ -228,6 +230,11 @@ object Freecam : Module( mc.crosshairTarget = rotation.rayCast(reach, lerpPos).orMiss // Can't be null (otherwise mc will spam "Null returned as 'hitResult', this shouldn't happen!") mc.crosshairTarget?.let { if (it.type != HitResult.Type.MISS) event.cancel() } } + + listen { event -> + val packet = event.packet + if (packet is PlayerRespawnS2CPacket) toggle() + } } private fun SafeContext.findFollowTarget(): PlayerEntity? {