Skip to content

Commit 3795af4

Browse files
committed
style: apply spotless codestyle.
1 parent d260237 commit 3795af4

File tree

9 files changed

+36
-27
lines changed

9 files changed

+36
-27
lines changed

src/main/kotlin/dev/wanderia/netlib/WanderiaNetLib.kt

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,25 @@ public object WanderiaNetLib : ModInitializer {
3535
PayloadTypeRegistry.configurationC2S()
3636
.register(
3737
configuration.payloadId,
38-
configuration.payloadCodec as StreamCodec<in FriendlyByteBuf, T>
38+
configuration.payloadCodec as StreamCodec<in FriendlyByteBuf, T>,
3939
)
4040
PayloadChannel.ServerboundPlay ->
4141
PayloadTypeRegistry.playC2S()
4242
.register(
4343
configuration.payloadId,
44-
configuration.payloadCodec as StreamCodec<in FriendlyByteBuf, T>
44+
configuration.payloadCodec as StreamCodec<in FriendlyByteBuf, T>,
4545
)
4646
PayloadChannel.ClientboundConfiguration ->
4747
PayloadTypeRegistry.configurationS2C()
4848
.register(
4949
configuration.payloadId,
50-
configuration.payloadCodec as StreamCodec<in FriendlyByteBuf, T>
50+
configuration.payloadCodec as StreamCodec<in FriendlyByteBuf, T>,
5151
)
5252
PayloadChannel.ClientboundPlay ->
5353
PayloadTypeRegistry.playS2C()
5454
.register(
5555
configuration.payloadId,
56-
configuration.payloadCodec as StreamCodec<in FriendlyByteBuf, T>
56+
configuration.payloadCodec as StreamCodec<in FriendlyByteBuf, T>,
5757
)
5858
}
5959
}
@@ -62,21 +62,23 @@ public object WanderiaNetLib : ModInitializer {
6262
override fun onInitialize() {
6363
logger.info("[netlib] trans rights are human rights!")
6464
val debug = System.getProperty("dev.wanderia.netlib.debug", "false") == "true"
65-
val entrypoints = FabricLoader.getInstance()
66-
.getEntrypoints(ENTRYPOINT_NAME, NetLibEntrypoint::class.java)
65+
val entrypoints =
66+
FabricLoader.getInstance().getEntrypoints(ENTRYPOINT_NAME, NetLibEntrypoint::class.java)
6767
if (debug) {
6868
logger.info("[netlib] Found ${entrypoints.size} entrypoints.")
6969
}
7070

7171
entrypoints.forEach { entry ->
72-
entry.register { payloads: List<SerializedPayloadConfiguration<*>> ->
73-
payloads.forEach { payload ->
74-
if (debug) {
75-
logger.info("[netlib] Registering ${payload::class.qualifiedName} on ${payload.channels}.")
76-
}
77-
register(payload)
72+
entry.register { payloads: List<SerializedPayloadConfiguration<*>> ->
73+
payloads.forEach { payload ->
74+
if (debug) {
75+
logger.info(
76+
"[netlib] Registering ${payload::class.qualifiedName} on ${payload.channels}."
77+
)
7878
}
79+
register(payload)
7980
}
8081
}
82+
}
8183
}
8284
}

src/main/kotlin/dev/wanderia/netlib/format/PacketByteBufDecoder.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import net.minecraft.network.FriendlyByteBuf
1919
@ExperimentalSerializationApi
2020
public class PacketByteBufDecoder(
2121
private val buf: FriendlyByteBuf,
22-
private var elementsCount: Int = 0
22+
private var elementsCount: Int = 0,
2323
) : AbstractDecoder() {
2424
private var elementIndex: Int = 0
2525
override val serializersModule: SerializersModule = WanderiaSerializersModule()

src/main/kotlin/dev/wanderia/netlib/format/PacketByteBufEncoder.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public class PacketByteBufEncoder(private val buf: FriendlyByteBuf) : AbstractEn
6666

6767
override fun beginCollection(
6868
descriptor: SerialDescriptor,
69-
collectionSize: Int
69+
collectionSize: Int,
7070
): CompositeEncoder {
7171
encodeInt(collectionSize)
7272
return this

src/main/kotlin/dev/wanderia/netlib/payload/api/PayloadChannel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ public enum class PayloadChannel {
1818
ClientboundConfiguration,
1919

2020
/** S2C during the play phase. */
21-
ClientboundPlay
21+
ClientboundPlay,
2222
}

src/main/kotlin/dev/wanderia/netlib/payload/api/SerializedPayload.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public abstract class SerializedPayload<T : SerializedPayload<T>> : CustomPacket
2525
StreamCodec<RegistryFriendlyByteBuf, T> =
2626
CustomPacketPayload.codec(
2727
{ value, buffer -> encodeTo<T>(buffer, value) },
28-
{ buffer -> decodeFrom<T>(buffer) }
28+
{ buffer -> decodeFrom<T>(buffer) },
2929
)
3030
}
3131
}

src/test/kotlin/EncodeDecodeTests.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class EncodeDecodeTests {
3434
val long: Long?,
3535
val short: Short?,
3636
val string: String?,
37-
val enum: PayloadChannel?
37+
val enum: PayloadChannel?,
3838
)
3939

4040
@Serializable
@@ -48,7 +48,7 @@ class EncodeDecodeTests {
4848
val longCollection: List<Long>,
4949
val shortCollection: List<Short>,
5050
val stringCollection: List<String>,
51-
val enumCollection: List<PayloadChannel>
51+
val enumCollection: List<PayloadChannel>,
5252
)
5353

5454
@Serializable
@@ -149,7 +149,7 @@ class EncodeDecodeTests {
149149
0.toShort(),
150150
(-1).toShort(),
151151
1.toShort(),
152-
(Short.MIN_VALUE..Short.MAX_VALUE).random().toShort()
152+
(Short.MIN_VALUE..Short.MAX_VALUE).random().toShort(),
153153
)[index.coerceIn(0, 4)],
154154
string = listOf(null, "", UUID.randomUUID().toString())[index.coerceIn(0, 2)],
155155
enum =
@@ -158,7 +158,7 @@ class EncodeDecodeTests {
158158
PayloadChannel.ClientboundPlay,
159159
PayloadChannel.ServerboundPlay,
160160
PayloadChannel.ClientboundConfiguration,
161-
PayloadChannel.ServerboundConfiguration
161+
PayloadChannel.ServerboundConfiguration,
162162
)[index.coerceIn(0, 4)],
163163
)
164164

@@ -179,15 +179,15 @@ class EncodeDecodeTests {
179179
0.toShort(),
180180
(-1).toShort(),
181181
1.toShort(),
182-
(Short.MIN_VALUE..Short.MAX_VALUE).random().toShort()
182+
(Short.MIN_VALUE..Short.MAX_VALUE).random().toShort(),
183183
),
184184
stringCollection = listOf("", UUID.randomUUID().toString()),
185185
enumCollection =
186186
listOf(
187187
PayloadChannel.ClientboundPlay,
188188
PayloadChannel.ServerboundPlay,
189189
PayloadChannel.ClientboundConfiguration,
190-
PayloadChannel.ServerboundConfiguration
190+
PayloadChannel.ServerboundConfiguration,
191191
),
192192
)
193193

@@ -202,15 +202,15 @@ class EncodeDecodeTests {
202202
randomDataA(Random.nextInt(5)),
203203
randomDataA(Random.nextInt(5)),
204204
randomDataA(Random.nextInt(5)),
205-
randomDataA(Random.nextInt(5))
205+
randomDataA(Random.nextInt(5)),
206206
),
207207
collectionB =
208208
listOf(
209209
randomDataB(),
210210
randomDataB(),
211211
randomDataB(),
212212
randomDataB(),
213-
randomDataB()
213+
randomDataB(),
214214
),
215215
)
216216
}

src/testmod/kotlin/TestMod.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ object TestMod : ModInitializer {
5555
testEnum = PayloadChannel.ClientboundPlay,
5656
testCollection = PayloadChannel.entries,
5757
testId = TestModPayload.payloadId.id,
58-
testUUID = UUID.randomUUID()
58+
testUUID = UUID.randomUUID(),
5959
)
6060
}

src/testmod/kotlin/TestModClient.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/*
2+
* Copyright (C) 2024 Wanderia - All Rights Reserved
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*/
18
package dev.wanderia.testmod
29

310
import dev.wanderia.testmod.TestMod.dummyPayload
@@ -30,4 +37,4 @@ object TestModClient : ClientModInitializer {
3037
}
3138
}
3239
}
33-
}
40+
}

src/testmod/kotlin/payloads/TestModPayload.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ data class TestModPayload(
3434
val testEnum: PayloadChannel,
3535
val testCollection: Collection<PayloadChannel>,
3636
@Contextual val testId: ResourceLocation,
37-
@Contextual val testUUID: UUID
37+
@Contextual val testUUID: UUID,
3838
) : SerializedPayload<TestModPayload>() {
3939
override fun codec(): StreamCodec<RegistryFriendlyByteBuf, TestModPayload> = payloadCodec
4040

0 commit comments

Comments
 (0)