Skip to content

Commit

Permalink
Add codec metadata section serializer and manually update due to acti…
Browse files Browse the repository at this point in the history
…on failure

<log>Added codec metadata section serializer</log>
  • Loading branch information
ThatGravyBoat committed Nov 8, 2023
1 parent 67c9bfb commit 4345649
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ jobs:
- name: Create Discord Embed
run: ./gradlew injectDiscordEmbed
env:
FORGE_RELEASE_URL: ${{ steps.forge_release.outputs.modrinth-url }}
FABRIC_RELEASE_URL: ${{ steps.fabric_release.outputs.modrinth-url }}
FORGE_RELEASE_URL: ${{ steps.forge_release.outputs.modrinth.url }}
FABRIC_RELEASE_URL: ${{ steps.fabric_release.outputs.modrinth.url }}

- name: Send Discord Webhook
uses: tsickert/discord-webhook@v5.3.0
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ You can then add our mod as a dependency:
```gradle
dependencies {
<--- Other dependencies here --->
implementation fg.deobf("com.teamresourceful.resourcefullib:resourcefullib-forge-1.20.1:2.1.14")
implementation fg.deobf("com.teamresourceful.resourcefullib:resourcefullib-forge-1.20.1:2.1.15")
}
```

### Fabric:
```gradle
dependencies {
<--- Other dependencies here --->
implementation "com.teamresourceful.resourcefullib:resourcefullib-fabric-1.20.1:2.1.14"
implementation "com.teamresourceful.resourcefullib:resourcefullib-fabric-1.20.1:2.1.15"
}
```

Expand All @@ -50,23 +50,23 @@ dependencies {
```gradle
dependencies {
<--- Other dependencies here --->
modImplementation "com.teamresourceful.resourcefullib:resourcefullib-common-1.20.1:2.1.14"
modImplementation "com.teamresourceful.resourcefullib:resourcefullib-common-1.20.1:2.1.15"
}
```

#### Fabric `build.gradle`
```gradle
dependencies {
<--- Other dependencies here --->
modImplementation "com.teamresourceful.resourcefullib:resourcefullib-fabric-1.20.1:2.1.14"
modImplementation "com.teamresourceful.resourcefullib:resourcefullib-fabric-1.20.1:2.1.15"
}
```

#### Forge `build.gradle`
```gradle
dependencies {
<--- Other dependencies here --->
modImplementation "com.teamresourceful.resourcefullib:resourcefullib-forge-1.20.1:2.1.14"
modImplementation "com.teamresourceful.resourcefullib:resourcefullib-forge-1.20.1:2.1.15"
}
```

Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# -----{ 2.1.15 }-----

Added context menus widget

# -----{ 2.1.14 }-----

Fixed issue where hidden widgets could have cursors shown
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.teamresourceful.resourcefullib.client.utils;

import com.google.gson.JsonObject;
import com.mojang.serialization.Codec;
import com.mojang.serialization.DataResult;
import com.mojang.serialization.JsonOps;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.metadata.MetadataSectionSerializer;
import org.jetbrains.annotations.NotNull;

public record CodecMetadataSectionSerializer<T>(Codec<T> codec, ResourceLocation id) implements MetadataSectionSerializer<T> {

@Override
public @NotNull String getMetadataSectionName() {
return id.toString();
}

@Override
public @NotNull T fromJson(JsonObject json) {
DataResult<T> result = codec.parse(JsonOps.INSTANCE, json);
if (result.error().isPresent()) {
throw new IllegalStateException("Failed to parse " + id + " metadata section: " + result.error().get());
}
if (result.result().isEmpty()) {
throw new IllegalStateException("Failed to parse " + id + " metadata section: Empty result");
}
return result.result().get();
}
}
4 changes: 2 additions & 2 deletions version.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
patch=14
patch=15
buildTime=0
build=0
releaseType=release
currentMCVersion=1.20.1
initialMCVersion=1.19.1
version=2.1.14
version=2.1.15

0 comments on commit 4345649

Please sign in to comment.