diff --git a/src/client/kotlin/com/liamxsage/shaderapi/client/ShaderReceivePayloadHandler.kt b/src/client/kotlin/com/liamxsage/shaderapi/client/ShaderReceivePayloadHandler.kt index e0e0202..f49c952 100644 --- a/src/client/kotlin/com/liamxsage/shaderapi/client/ShaderReceivePayloadHandler.kt +++ b/src/client/kotlin/com/liamxsage/shaderapi/client/ShaderReceivePayloadHandler.kt @@ -4,6 +4,7 @@ import com.liamxsage.shaderapi.Constants.logger import com.liamxsage.shaderapi.ShaderReceivePayload import com.liamxsage.shaderapi.client.config.ConfigManager import com.liamxsage.shaderapi.client.config.ShaderPackAcceptState +import com.liamxsage.shaderapi.client.functions.sendShaderStatusResponse import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking import net.irisshaders.iris.Iris import net.minecraft.client.MinecraftClient @@ -13,6 +14,7 @@ import java.io.File import java.net.HttpURLConnection import java.net.URI import java.util.* +import kotlin.reflect.jvm.jvmName class ShaderReceivePayloadHandler : ClientPlayNetworking.PlayPayloadHandler { override fun receive(payload: ShaderReceivePayload, context: ClientPlayNetworking.Context) { @@ -36,8 +38,9 @@ class ShaderReceivePayloadHandler : ClientPlayNetworking.PlayPayloadHandler ID = new Id<>(Constants.getSTATUS_RESPONSE_PACKET_ID()); + public static final PacketCodec CODEC = PacketCodec.tuple( + PacketCodecs.STRING, ShaderStatusResponsePayload::statusResponse, + ShaderStatusResponsePayload::new); + + @Override + public Id getId() { + return ID; + } +} diff --git a/src/main/kotlin/com/liamxsage/shaderapi/Shaderapi.kt b/src/main/kotlin/com/liamxsage/shaderapi/Shaderapi.kt index 23f81f0..899e7f1 100644 --- a/src/main/kotlin/com/liamxsage/shaderapi/Shaderapi.kt +++ b/src/main/kotlin/com/liamxsage/shaderapi/Shaderapi.kt @@ -10,7 +10,11 @@ class Shaderapi : ModInitializer { override fun onInitialize() { logger.info("Initializing ShaderAPI") + // Client 2 Server PayloadTypeRegistry.playC2S().register(ShaderRequestPayload.ID, ShaderRequestPayload.CODEC) + PayloadTypeRegistry.playC2S().register(ShaderStatusResponsePayload.ID, ShaderStatusResponsePayload.CODEC) + + // Server 2 Client PayloadTypeRegistry.playS2C().register(ShaderReceivePayload.ID, ShaderReceivePayload.CODEC) logger.info("ShaderAPI initialized")