Slipstream

Slipstream

Ultra-fast, zero-allocation packet framework for Paper 1.21+. Coroutine-first, ProtocolLib-style API for modern Kotlin developers.

87 downloads 1 followers

⚑ Slipstream Engine (v2.0.0)

Slipstream is a Next-Gen framework for packet interception and physics simulation in Minecraft (Paper). Built as an ultra-fast, modern alternative to heavy libraries (like ProtocolLib), designed specifically for Kotlin developers with an absolute focus on maximum performance and production stability.

Starting with v2.0.0, Slipstream utilizes a Multi-Module Architecture with automatic generation of @JvmInline value class wrappers directly from NMS, providing 100% type safety, Java Records support, and Zero-Allocation access without polluting the global namespace.

πŸ”₯ Why Slipstream?

  • πŸš€ Zero-Reflection Bytecode Bridge: Uses MethodHandles and Kotlin value classes. Packets are processed at the speed of compiled JIT bytecode.
  • πŸ›‘οΈ Type-Safe & Clean API: Forget packet.isMovePacket(). Use our beautifully crafted packet.wrapAs<WrapperMovePacket>() which uses inline reified magic to guarantee zero runtime overhead and a clean autocomplete scope.
  • πŸ“¦ Zero-Allocation Nested Structures: Automatically generated wrappers for internal NMS types like BlockPos, Vec3, ItemStack ensure no objects are unnecessarily instantiated in the heap.
  • 🧡 Coroutine-First & Lazy Suspend: Asynchronous packet processing directly in the Netty thread. Slipstream only launches coroutines when a listener is interested, otherwise, it stays 100% synchronous.
  • πŸͺ„ Full Packet Mutation: Mutate packets easily via generated setters for mutable fields, or via .copy() for immutable Java Records.
  • πŸ—ΊοΈ Native Mojang Mappings: Deeply integrated with Paper's native Mojang-mapped environment (1.21+).

πŸ“– Documentation & Wiki

πŸš‰ Quick Start

Gradle (JitPack)

repositories {
    maven("https://jitpack.io")
}

dependencies {
    // You only need to depend on the core module, the generated wrappers are pulled automatically!
    implementation("com.github.ClCody.Slipstream:slipstream-core:2.0.0")
}

πŸ’» Usage Examples (API)

1. Type-Safe Casts (wrapAs) & Synchronous Listeners

The core of Slipstream's DX. Check and cast a packet in one single zero-overhead line:

val manager = SlipstreamPlugin.instance.manager

manager.registerListener(object : PacketListener {
    override fun onPacketIn(player: Player, packet: Any): Boolean {
        // wrapAs<T>() returns null if it's the wrong packet. 
        // Powered by inline reified, so 0 overhead!
        packet.wrapAs<WrapperServerboundMovePlayerPacket>()?.let { movePacket ->
            val pos = movePacket.pos // Returns a WrapperBlockPos (zero-allocation)
            println("Player moved to X: ${pos.x}, Y: ${pos.y}")
        }
        return true
    }
})

2. Asynchronous Listeners (Suspend Listeners)

Don't block the server and Netty! Make database queries right during packet processing:

manager.registerSuspendListener(object : SuspendablePacketListener {
    override fun interestsInbound(packet: Any): Boolean = packet.wrapAs<WrapperServerboundChatPacket>() != null

    override suspend fun onPacketInSuspend(player: Player, packet: Any): Boolean {
        // The coroutine can suspend, the order of following packets is strictly preserved!
        val isMuted = database.checkPlayerMute(player.uniqueId)
        return !isMuted // false = cancel packet
    }
})

3. Packet Awaiter

Linear, non-blocking packet awaiting (e.g., waiting for client transactions):

// Send a transaction to the client
player.sendPacket(TransactionPacket(id = 1337))

// The coroutine suspends until the client sends a response with the target ID
val response = manager.awaitPacket<WrapperServerboundPongPacket>(player) { 
    it.packet.id == 1337 
}

4. Modifying Packets (Setters & Records)

packet.wrapAs<WrapperClientboundSetEntityDataPacket>()?.let { dataPacket ->
    // Modifying a mutable packet using generated MethodHandle setters
    dataPacket.id = 999 
}

packet.wrapAs<WrapperServerboundSwingPacket>()?.let { swingPacket ->
    // For immutable Java Records, a copy() method is generated (just like Kotlin data classes)
    val modified = swingPacket.copy(hand = InteractionHand.OFF_HAND)
}

πŸ“„ License

MIT License.

No gallery available for this project.

Version Minecraft Loader Download

Slipstream v2.0.0

2.0.0

1.21, 1.21.1, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6, 1.21.7, 1.21.8, 1.21.9, 1.21.10, 1.21.11
paper
Download

Slipstream v1.1.0

1.1.0

1.21, 1.21.1, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6, 1.21.7, 1.21.8, 1.21.9, 1.21.10, 1.21.11
paper
Download

Slipstream v1.0.0

1.0.0

1.21, 1.21.1, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6, 1.21.7, 1.21.8, 1.21.9, 1.21.10, 1.21.11
paper
Download