fix: dedicated server

This commit is contained in:
xtex 2023-07-27 10:32:33 +08:00
parent e70697fa6a
commit 5beb4d977f
Signed by: xtex
GPG Key ID: B918086ED8045B91

View File

@ -1,7 +1,9 @@
package quaedam.config
import dev.architectury.networking.NetworkManager
import dev.architectury.platform.Platform
import io.netty.buffer.Unpooled
import net.fabricmc.api.EnvType
import net.minecraft.nbt.CompoundTag
import net.minecraft.network.FriendlyByteBuf
import net.minecraft.server.level.ServerPlayer
@ -12,7 +14,9 @@ object SimpleQuaedamConfigPush {
val id = Quaedam.resource("simple_config_push")
init {
NetworkManager.registerReceiver(NetworkManager.Side.S2C, id, ::handle)
if (Platform.getEnv() == EnvType.CLIENT) {
NetworkManager.registerReceiver(NetworkManager.Side.S2C, id, ::handle)
}
}
private fun handle(buf: FriendlyByteBuf, ctx: NetworkManager.PacketContext) {