fix: dedicated server
This commit is contained in:
parent
e70697fa6a
commit
5beb4d977f
@ -1,7 +1,9 @@
|
|||||||
package quaedam.config
|
package quaedam.config
|
||||||
|
|
||||||
import dev.architectury.networking.NetworkManager
|
import dev.architectury.networking.NetworkManager
|
||||||
|
import dev.architectury.platform.Platform
|
||||||
import io.netty.buffer.Unpooled
|
import io.netty.buffer.Unpooled
|
||||||
|
import net.fabricmc.api.EnvType
|
||||||
import net.minecraft.nbt.CompoundTag
|
import net.minecraft.nbt.CompoundTag
|
||||||
import net.minecraft.network.FriendlyByteBuf
|
import net.minecraft.network.FriendlyByteBuf
|
||||||
import net.minecraft.server.level.ServerPlayer
|
import net.minecraft.server.level.ServerPlayer
|
||||||
@ -12,8 +14,10 @@ object SimpleQuaedamConfigPush {
|
|||||||
val id = Quaedam.resource("simple_config_push")
|
val id = Quaedam.resource("simple_config_push")
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
if (Platform.getEnv() == EnvType.CLIENT) {
|
||||||
NetworkManager.registerReceiver(NetworkManager.Side.S2C, id, ::handle)
|
NetworkManager.registerReceiver(NetworkManager.Side.S2C, id, ::handle)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun handle(buf: FriendlyByteBuf, ctx: NetworkManager.PacketContext) {
|
private fun handle(buf: FriendlyByteBuf, ctx: NetworkManager.PacketContext) {
|
||||||
val data = buf.readNbt()!!
|
val data = buf.readNbt()!!
|
||||||
|
Loading…
Reference in New Issue
Block a user