Skip to content

Commit

Permalink
Spacing, use check instead
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverAndro committed Apr 11, 2023
1 parent b0fc6d8 commit 09dda43
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import org.quiltmc.qsl.networking.api.ServerPlayNetworking
import org.quiltmc.qsl.networking.api.client.ClientPlayNetworking

public typealias OnSerializedPacketClient<T> =
T.(MinecraftClient, ClientPlayNetworkHandler, PacketSender)->Unit
T.(MinecraftClient, ClientPlayNetworkHandler, PacketSender) -> Unit
public typealias OnSerializedPacketServer<T> =
T.(MinecraftServer, ServerPlayerEntity, ServerPlayNetworkHandler, PacketSender)->Unit
T.(MinecraftServer, ServerPlayerEntity, ServerPlayNetworkHandler, PacketSender) -> Unit

/**
* A utility class for serialized packet registration.
Expand Down Expand Up @@ -73,10 +73,8 @@ public class SerializedPacketRegistration<P>(
*/
public inline fun <reified T> finalize() {
if (direction == Direction.ClientToServer || direction == Direction.BiDirectional) {
if (onServerReceiveAction == null) {
throw IllegalStateException(
"No action set for receiving on the server with packet direction ${direction.name}"
)
check(onServerReceiveAction != null) {
"No action set for receiving on the server with packet direction ${direction.name}"
}

ServerPlayNetworking
Expand All @@ -90,10 +88,8 @@ public class SerializedPacketRegistration<P>(
}

if (direction == Direction.ServerToClient || direction == Direction.BiDirectional) {
if (onClientReceiveAction == null) {
throw IllegalStateException(
"No action set for receiving on the client with packet direction ${direction.name}"
)
check(onClientReceiveAction == null) {

This comment has been minimized.

Copy link
@Cypher121

Cypher121 Apr 12, 2023

Contributor

seems like this got switched

"No action set for receiving on the client with packet direction ${direction.name}"
}

ClientPlayNetworking.registerGlobalReceiver(id) { client, playNetworking, packetByteBuf, sender ->
Expand Down

0 comments on commit 09dda43

Please sign in to comment.