Skip to content

Commit 4da5836

Browse files
authored
Merge pull request #212 from litetex-oss/dev
Release
2 parents c3206f7 + e71c20b commit 4da5836

File tree

9 files changed

+56
-140
lines changed

9 files changed

+56
-140
lines changed

.github/workflows/check-build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
java-version: ${{ matrix.java }}
4141

4242
- name: Cache Gradle
43-
uses: actions/cache@v4
43+
uses: actions/cache@v5
4444
with:
4545
path: |
4646
~/.gradle/caches
@@ -71,7 +71,7 @@ jobs:
7171
fi
7272
7373
- name: Upload mod files
74-
uses: actions/upload-artifact@v5
74+
uses: actions/upload-artifact@v6
7575
with:
7676
name: mod-files-java-${{ matrix.java }}
7777
path: |
@@ -100,7 +100,7 @@ jobs:
100100
java-version: ${{ matrix.java }}
101101

102102
- name: Cache Gradle
103-
uses: actions/cache@v4
103+
uses: actions/cache@v5
104104
with:
105105
path: |
106106
~/.gradle/caches
@@ -131,7 +131,7 @@ jobs:
131131
java-version: ${{ matrix.java }}
132132

133133
- name: Cache Gradle
134-
uses: actions/cache@v4
134+
uses: actions/cache@v5
135135
with:
136136
path: |
137137
~/.gradle/caches
@@ -145,7 +145,7 @@ jobs:
145145

146146
- name: Upload report
147147
if: always()
148-
uses: actions/upload-artifact@v5
148+
uses: actions/upload-artifact@v6
149149
with:
150150
name: pmd-report
151151
if-no-files-found: ignore

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
distribution: 'temurin'
2323

2424
- name: Try restore Gradle Cache
25-
uses: actions/cache/restore@v4
25+
uses: actions/cache/restore@v5
2626
with:
2727
path: |
2828
~/.gradle/caches
@@ -133,7 +133,7 @@ jobs:
133133
java-version: 21
134134

135135
- name: Try restore Gradle Cache
136-
uses: actions/cache/restore@v4
136+
uses: actions/cache/restore@v5
137137
with:
138138
path: |
139139
~/.gradle/caches

.github/workflows/test-deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
java-version: '21'
1818

1919
- name: Try restore Gradle Cache
20-
uses: actions/cache/restore@v4
20+
uses: actions/cache/restore@v5
2121
with:
2222
path: |
2323
~/.gradle/caches
@@ -34,7 +34,7 @@ jobs:
3434
MODRINTH_CHANGELOG_TEXT: 'Available at https://github.com/litetex-oss/mcm-cape-provider/blob/dev/CHANGELOG.md<br/><i>Please note that this is a SNAPSHOT which might be unstable</i>'
3535

3636
- name: Upload mod files
37-
uses: actions/upload-artifact@v5
37+
uses: actions/upload-artifact@v6
3838
with:
3939
name: mod-files
4040
path: |

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 4.2.1
2+
* Fix MinecraftCapes Provider no longer working due to breaking API changes #206
3+
* Removed Wynntils #204
4+
15
# 4.2.0
26
* Updated to 1.21.11
37

build.gradle

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'fabric-loom' version '1.14.5'
2+
id 'fabric-loom' version '1.14.6'
33
id 'maven-publish'
44
id 'signing'
55
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
@@ -9,7 +9,7 @@ plugins {
99
}
1010

1111
ext {
12-
checkstyleVersion = '12.2.0'
12+
checkstyleVersion = '12.3.0'
1313

1414
pmdVersion = '7.19.0'
1515
}
@@ -93,8 +93,7 @@ dependencies {
9393
// Only needed during development
9494
modLocalRuntime "com.terraformersmc:modmenu:${project.modmenu_version}"
9595
modLocalRuntime "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
96-
// https://github.com/DJtheRedstoner/DevAuth/issues/24
97-
// modLocalRuntime "me.djtheredstoner:DevAuth-fabric:1.2.1"
96+
modLocalRuntime "net.litetex.mcm:dev-auth-neo:1.0.1"
9897
// modLocalRuntime "maven.modrinth:no-chat-reports:Fabric-1.21.10-v2.16.0"
9998
}
10099

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ mod_desc=Use capes from various providers
1212
mod_license_spdx_id=LGPL-2.1-or-later
1313
mod_license_url=https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
1414
# Additional
15-
fabric_api_version=0.139.4+1.21.11
15+
fabric_api_version=0.139.5+1.21.11
1616
modmenu_version=17.0.0-alpha.1
17-
skinshuffle_version=2.10.0+1.21.10
17+
skinshuffle_version=2.10.1+1.21.11-fabric
1818
minecraftcapes_version=fabric-1.21.11-1.0.0

src/main/java/net/litetex/capes/provider/MinecraftCapesCapeProvider.java

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package net.litetex.capes.provider;
22

33
import java.io.IOException;
4+
import java.net.URI;
45
import java.net.http.HttpClient;
56
import java.net.http.HttpRequest;
67
import java.net.http.HttpResponse;
7-
import java.util.Map;
88

99
import com.google.gson.Gson;
10+
import com.google.gson.annotations.SerializedName;
1011
import com.mojang.authlib.GameProfile;
1112

1213
import net.litetex.capes.handler.textures.AnimatedSpriteTextureResolver;
@@ -43,33 +44,53 @@ public ResolvedTextureInfo resolveTexture(
4344
final GameProfile profile) throws IOException, InterruptedException
4445
{
4546
requestBuilder
46-
.setHeader("User-Agent", "minecraftcapes-mod/" + SharedConstants.getCurrentVersion().name())
47-
.setHeader("Accept", "application/json");
47+
.setHeader("User-Agent", "minecraftcapes-mod/" + SharedConstants.getCurrentVersion().name());
4848

49+
record ResponseData(
50+
Boolean animatedCape,
51+
@SerializedName("animated_cape_url")
52+
String animatedCapeUrl,
53+
@SerializedName("cape_url")
54+
String capeUrl
55+
)
56+
{
57+
}
58+
59+
final ResponseData responseData;
4960
try(final HttpClient client = clientBuilder.build())
5061
{
5162
final HttpResponse<String> response =
52-
client.send(requestBuilder.GET().build(), HttpResponse.BodyHandlers.ofString());
63+
client.send(
64+
requestBuilder.copy()
65+
.setHeader("Accept", "application/json")
66+
.GET()
67+
.build(),
68+
HttpResponse.BodyHandlers.ofString());
5369

5470
if(response.statusCode() / 100 != 2)
5571
{
5672
return null;
5773
}
5874

59-
record ResponseData(
60-
Boolean animatedCape,
61-
Map<String, String> textures
62-
)
63-
{
64-
}
65-
66-
final ResponseData responseData = new Gson().fromJson(response.body(), ResponseData.class);
67-
68-
return new ResolvedTextureInfo.Base64TextureInfo(
69-
responseData.textures().get("cape"),
70-
responseData.animatedCape() ? AnimatedSpriteTextureResolver.ID : null
71-
);
75+
responseData = new Gson().fromJson(response.body(), ResponseData.class);
7276
}
77+
if(responseData == null)
78+
{
79+
return null;
80+
}
81+
82+
final String textureUrl = Boolean.TRUE.equals(responseData.animatedCape())
83+
? responseData.animatedCapeUrl()
84+
: responseData.capeUrl();
85+
if(textureUrl == null)
86+
{
87+
return null;
88+
}
89+
90+
return CapeProvider.resolveTextureDefault(
91+
clientBuilder,
92+
requestBuilder.copy().uri(URI.create(textureUrl)),
93+
responseData.animatedCape() ? AnimatedSpriteTextureResolver.ID : null);
7394
}
7495

7596
@Override

src/main/java/net/litetex/capes/provider/WynntilsProvider.java

Lines changed: 0 additions & 107 deletions
This file was deleted.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
net.litetex.capes.provider.MinecraftCapesCapeProvider
22
net.litetex.capes.provider.OptiFineCapeProvider
3-
net.litetex.capes.provider.WynntilsProvider
43
net.litetex.capes.provider.CosmeticaProvider
54
net.litetex.capes.provider.LabyModProvider

0 commit comments

Comments
 (0)