-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from Liams-Services/feat/1-shader-response
feat: Shader Response
- Loading branch information
Showing
6 changed files
with
59 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/client/kotlin/com/liamxsage/shaderapi/client/ShaderStatusResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.liamxsage.shaderapi.client | ||
|
||
enum class ShaderStatusResponse { | ||
SUCCESS, DENIED, DOWNLOAD_FAILED, APPLY_FAILED, IO_EXCEPTION | ||
} |
13 changes: 13 additions & 0 deletions
13
src/client/kotlin/com/liamxsage/shaderapi/client/functions/PacketFunctions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.liamxsage.shaderapi.client.functions | ||
|
||
import com.liamxsage.shaderapi.ShaderStatusResponsePayload | ||
import com.liamxsage.shaderapi.client.ShaderStatusResponse | ||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking | ||
|
||
fun sendShaderStatusResponse(statusResponse: ShaderStatusResponse) { | ||
ClientPlayNetworking.send(ShaderStatusResponsePayload(statusResponse.name)) | ||
} | ||
|
||
fun sendShaderStatusResponse(statusResponse: String) { | ||
ClientPlayNetworking.send(ShaderStatusResponsePayload(statusResponse)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/main/kotlin/com/liamxsage/shaderapi/ShaderStatusResponsePayload.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.liamxsage.shaderapi; | ||
|
||
import net.minecraft.network.RegistryByteBuf; | ||
import net.minecraft.network.codec.PacketCodec; | ||
import net.minecraft.network.codec.PacketCodecs; | ||
import net.minecraft.network.packet.CustomPayload; | ||
|
||
|
||
public record ShaderStatusResponsePayload(String statusResponse) implements CustomPayload { | ||
|
||
public static final Id<ShaderStatusResponsePayload> ID = new Id<>(Constants.getSTATUS_RESPONSE_PACKET_ID()); | ||
public static final PacketCodec<RegistryByteBuf, ShaderStatusResponsePayload> CODEC = PacketCodec.tuple( | ||
PacketCodecs.STRING, ShaderStatusResponsePayload::statusResponse, | ||
ShaderStatusResponsePayload::new); | ||
|
||
@Override | ||
public Id<? extends CustomPayload> getId() { | ||
return ID; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters