Skip to content

Commit 11cca95

Browse files
authored
Merge pull request #48 from litetex-oss/1.21.6
1.21.6
2 parents 07dfe5c + e41f52a commit 11cca95

20 files changed

+591
-410
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

build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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 {

custom-cape-demo/animated.png

34.4 KB
Loading

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
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

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)