Skip to content

Commit 3a1f7c1

Browse files
authored
Merge pull request #53 from litetex-oss/dev
Release
2 parents 7fa3eb5 + 11cca95 commit 3a1f7c1

23 files changed

+607
-415
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 1.2.0
2+
* Updated to 1.21.6
3+
* Reworked/Fixed preview rendering
4+
* Custom providers (loaded from the config-file) can now provide animated textures
5+
16
# 1.1.1
27
* Optimized rendering in preview screen
38
* Correctly declared fabric-api

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@ This demo showcases how to apply the capes inside [``custom-cape-demo``](https:/
3636
"uriTemplate": "https://raw.githubusercontent.com/litetex-oss/mcm-cape-provider/refs/heads/dev/custom-cape-demo/uuid.png"
3737
}
3838
```
39+
<details><summary>Example for SkinMC</summary>
40+
41+
```jsonc
42+
{
43+
"id": "skinmc",
44+
"name": "SkinMC",
45+
"uriTemplate": "https://skinmc.net/api/v1/skinmcCape/$id"
46+
}
47+
```
48+
49+
</details>
3950
3. Restart the game and activate the provider
4051

4152
For more details have a look at [CustomProvider](https://github.com/litetex-oss/mcm-cape-provider/tree/dev/src/main/java/net/litetex/capes/provider/CustomProvider.java) and [CustomProviderConfig](https://github.com/litetex-oss/mcm-cape-provider/tree/dev/src/main/java/net/litetex/capes/config/CustomProviderConfig.java)

build.gradle

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ plugins {
99
}
1010

1111
ext {
12-
checkstyleVersion = '10.24.0'
12+
checkstyleVersion = '10.25.0'
1313

14-
pmdVersion = '7.13.0'
14+
pmdVersion = '7.14.0'
1515

1616
// Derive version from yarn
1717
minecraft_version = project.yarn_mappings.split("\\+")[0]
@@ -85,14 +85,15 @@ dependencies {
8585
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
8686
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
8787
// Required when translations and icons should be loaded correctly
88-
modImplementation "net.fabricmc.fabric-api:fabric-api:0.124.2+1.21.5"
88+
modImplementation "net.fabricmc.fabric-api:fabric-api:0.126.1+1.21.6"
8989

9090
modCompileOnly "com.terraformersmc:modmenu:${project.modmenu_version}"
9191

9292
// Only needed during development
93-
modLocalRuntime "com.terraformersmc:modmenu:${project.modmenu_version}"
93+
// modLocalRuntime "com.terraformersmc:modmenu:${project.modmenu_version}"
94+
modLocalRuntime "net.fabricmc.fabric-api:fabric-api:0.126.1+1.21.6"
9495
modLocalRuntime "me.djtheredstoner:DevAuth-fabric:1.2.1"
95-
modLocalRuntime "maven.modrinth:no-chat-reports:Fabric-1.21.5-v2.12.0"
96+
// modLocalRuntime "maven.modrinth:no-chat-reports:Fabric-1.21.4-v2.11.0"
9697
}
9798

9899
processResources {
@@ -117,7 +118,7 @@ checkstyle {
117118

118119
pmd {
119120
consoleOutput = true
120-
ruleSetFiles = files(".config/pmd/ruleset.xml")
121+
ruleSetFiles = files(".config/pmd/java/ruleset.xml")
121122
toolVersion = pmdVersion
122123
}
123124

custom-cape-demo/animated.png

34.4 KB
Loading

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Done to increase the memory available to gradle.
22
org.gradle.jvmargs=-Xmx2G
33
# Fabric Properties
4-
yarn_mappings=1.21.5+build.1
4+
yarn_mappings=1.21.6-rc1+build.1
55
loader_version=0.16.14
66
# Mod Properties
7-
mod_version=1.1.2-SNAPSHOT
7+
mod_version=1.2.0-SNAPSHOT
88
maven_group=net.litetex.mcm
99
archives_base_name=cape-provider
1010
mod_name=Cape Provider
1111
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-
modmenu_version=13.0.3
15+
modmenu_version=14.0.0-rc.2

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

src/main/java/net/litetex/capes/config/CustomProviderConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public record CustomProviderConfig(
88
String id,
99
String name,
1010
String uriTemplate,
11+
boolean animated,
1112
String changeCapeUrl,
1213
String homepage,
1314
List<String> antiFeatures

src/main/java/net/litetex/capes/handler/PlayerCapeHandler.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public Thread newThread(@NotNull final Runnable r)
6464
private final GameProfile profile;
6565
private int lastFrame;
6666
private int maxFrames;
67-
private long lastFrameTime;
67+
private long nextFrameTime;
6868
private boolean hasCape;
6969
private boolean hasElytraTexture = true;
7070
private boolean hasAnimatedCape;
@@ -82,11 +82,11 @@ public Identifier getCape()
8282
}
8383

8484
final long time = System.currentTimeMillis();
85-
if(time > this.lastFrameTime + 100L)
85+
if(time > this.nextFrameTime)
8686
{
8787
final int thisFrame = (this.lastFrame + 1) % this.maxFrames;
8888
this.lastFrame = thisFrame;
89-
this.lastFrameTime = time;
89+
this.nextFrameTime = time + 100L;
9090
return identifier(this.uuid() + "/" + thisFrame);
9191
}
9292
return identifier(this.uuid() + "/" + this.lastFrame);
@@ -152,6 +152,11 @@ public void connectFailed(final URI uri, final SocketAddress sa, final IOExcepti
152152
.stream()
153153
.collect(Collectors.toMap(e -> identifier(this.uuid() + "/" + e.getKey()), Map.Entry::getValue));
154154

155+
if(texturesToRegister.isEmpty())
156+
{
157+
throw new IllegalStateException("Received animated texture with no frames");
158+
}
159+
155160
// Assume that elytra texture is available
156161
this.hasElytraTexture = true;
157162

@@ -356,6 +361,11 @@ public boolean hasCape()
356361
return this.hasCape;
357362
}
358363

364+
public boolean hasAnimatedCape()
365+
{
366+
return this.hasAnimatedCape;
367+
}
368+
359369
public boolean hasElytraTexture()
360370
{
361371
return this.hasElytraTexture;

0 commit comments

Comments
 (0)