Skip to content

Commit cd5dd87

Browse files
committed
Update to mc1.21.3
1 parent 6037598 commit cd5dd87

File tree

9 files changed

+127
-76
lines changed

9 files changed

+127
-76
lines changed

common/build.gradle

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,24 @@ plugins {
33
id("net.neoforged.moddev")
44
}
55

6+
// Vanilla depends on ASM 9.3, MDG makes that a 'strict' version constraint,
7+
// but Mixin and MixinExtras needs newer ASM so we override that here.
8+
configurations.configureEach {
9+
resolutionStrategy.eachDependency { details ->
10+
if (details.requested.group == "org.ow2.asm") {
11+
details.useVersion(asm_version)
12+
details.because("Mixin requires new ASM")
13+
}
14+
}
15+
}
16+
617
dependencies {
18+
compileOnly "org.ow2.asm:asm:${asm_version}"
19+
compileOnly "org.ow2.asm:asm-analysis:${asm_version}"
20+
compileOnly "org.ow2.asm:asm-commons:${asm_version}"
21+
compileOnly "org.ow2.asm:asm-tree:${asm_version}"
22+
compileOnly "org.ow2.asm:asm-util:${asm_version}"
23+
724
// Mixin and MixinExtras
825
compileOnly("org.spongepowered:mixin:${mixin_version}")
926
compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:${mixinextras_version}"))

common/src/main/java/dev/terminalmc/nocapes/NoCapes.java

Lines changed: 14 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@
1616

1717
package dev.terminalmc.nocapes;
1818

19-
import com.mojang.authlib.GameProfile;
20-
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
2119
import dev.terminalmc.nocapes.config.Config;
2220
import dev.terminalmc.nocapes.util.ModLogger;
2321
import net.minecraft.ChatFormatting;
24-
import net.minecraft.client.Minecraft;
2522
import net.minecraft.network.chat.Component;
23+
import net.minecraft.resources.ResourceLocation;
2624
import org.jetbrains.annotations.Nullable;
2725

2826
import java.util.*;
@@ -80,7 +78,7 @@ with open(<texture_file_path>, 'rb') as file:
8078
"2e002d5e1758e79ba51d08d92a0f3a95119f2f435ae7704916507b6c565a7da8",
8179
"ca29f5dd9e94fb1748203b92e36b66fda80750c87ebc18d6eafdb0e28cc1d05f",
8280
};
83-
public static final Map<UUID, @Nullable String> CAPE_CACHE = new HashMap<>();
81+
public static final Map<ResourceLocation, String> CAPE_CACHE = new HashMap<>();
8482

8583
public static void init() {
8684
Config config = Config.getAndSave();
@@ -95,36 +93,21 @@ public static void onConfigSaved(Config config) {
9593
// Cache update method
9694
}
9795

98-
private static @Nullable String getPlayerCapeId(GameProfile profile) {
99-
UUID uuid = profile.getId();
100-
if (CAPE_CACHE.containsKey(uuid)) {
101-
return CAPE_CACHE.get(uuid);
102-
} else {
103-
MinecraftProfileTexture texture = Minecraft.getInstance()
104-
.getMinecraftSessionService().getTextures(profile).cape();
105-
// Texture is null is when checking the local player's GameProfile
106-
// on Hypixel, for some reason. Not sure about other cases.
107-
@Nullable String capeId = null;
108-
if (texture != null) {
109-
String url = texture.getUrl();
110-
if (url != null && url.contains("textures.minecraft.net/texture/")) {
111-
capeId = url.split("/texture/")[1];
112-
}
113-
}
114-
CAPE_CACHE.put(uuid, capeId);
115-
return capeId;
116-
}
117-
}
118-
119-
public static boolean blockCape(GameProfile profile) {
96+
public static boolean blockCape(ResourceLocation location) {
12097
if (options().hideEverything) return true;
121-
@Nullable Config.ShowMode mode = Config.get().options.capes.get(getPlayerCapeId(profile));
122-
return mode != null && !mode.showCape();
98+
if (CAPE_CACHE.containsKey(location)) {
99+
@Nullable Config.ShowMode mode = Config.get().options.capes.get(CAPE_CACHE.get(location));
100+
return mode != null && !mode.showCape();
101+
}
102+
return false;
123103
}
124104

125-
public static boolean blockElytra(GameProfile profile) {
105+
public static boolean blockElytra(ResourceLocation location) {
126106
if (options().hideEverything) return true;
127-
@Nullable Config.ShowMode mode = Config.get().options.capes.get(getPlayerCapeId(profile));
128-
return mode != null && !mode.showElytra();
107+
if (CAPE_CACHE.containsKey(location)) {
108+
@Nullable Config.ShowMode mode = Config.get().options.capes.get(CAPE_CACHE.get(location));
109+
return mode != null && !mode.showElytra();
110+
}
111+
return false;
129112
}
130113
}

common/src/main/java/dev/terminalmc/nocapes/mixin/MixinCapeLayer.java

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,28 @@
1616

1717
package dev.terminalmc.nocapes.mixin;
1818

19-
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
2019
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
21-
import com.mojang.blaze3d.vertex.PoseStack;
20+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
2221
import dev.terminalmc.nocapes.NoCapes;
23-
import net.minecraft.client.player.AbstractClientPlayer;
24-
import net.minecraft.client.renderer.MultiBufferSource;
2522
import net.minecraft.client.renderer.entity.layers.CapeLayer;
26-
import net.minecraft.world.entity.player.PlayerModelPart;
23+
import net.minecraft.client.resources.PlayerSkin;
24+
import net.minecraft.resources.ResourceLocation;
25+
import org.jetbrains.annotations.Nullable;
2726
import org.spongepowered.asm.mixin.Mixin;
27+
import org.spongepowered.asm.mixin.injection.At;
2828

2929
@Mixin(CapeLayer.class)
30-
public class MixinCapeLayer {
31-
@WrapMethod(
32-
method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/client/player/AbstractClientPlayer;FFFFFF)V"
30+
public abstract class MixinCapeLayer {
31+
@WrapOperation(
32+
method = "render",
33+
at = @At(
34+
value = "INVOKE",
35+
target = "Lnet/minecraft/client/resources/PlayerSkin;capeTexture()Lnet/minecraft/resources/ResourceLocation;"
36+
)
3337
)
34-
private void wrapRender(PoseStack poseStack, MultiBufferSource buffer, int packedLight,
35-
AbstractClientPlayer player, float limbSwing, float limbSwingAmount,
36-
float partialTicks, float ageInTicks, float netHeadYaw, float headPitch,
37-
Operation<Void> original) {
38-
if (!player.isInvisible() && player.isModelPartShown(PlayerModelPart.CAPE)
39-
&& !NoCapes.blockCape(player.getGameProfile())) {
40-
original.call(poseStack, buffer, packedLight, player, limbSwing, limbSwingAmount,
41-
partialTicks, ageInTicks, netHeadYaw, headPitch);
42-
}
38+
private static @Nullable ResourceLocation wrapCapeTexture(PlayerSkin instance, Operation<ResourceLocation> original) {
39+
ResourceLocation texture = original.call(instance);
40+
if (NoCapes.blockCape(texture)) return null;
41+
return texture;
4342
}
4443
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright 2025 TerminalMC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package dev.terminalmc.nocapes.mixin;
18+
19+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
20+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
21+
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
22+
import dev.terminalmc.nocapes.NoCapes;
23+
import net.minecraft.client.resources.SkinManager;
24+
import net.minecraft.resources.ResourceLocation;
25+
import org.spongepowered.asm.mixin.Mixin;
26+
import org.spongepowered.asm.mixin.injection.At;
27+
28+
import java.util.Arrays;
29+
import java.util.concurrent.CompletableFuture;
30+
31+
@Mixin(SkinManager.class)
32+
public class MixinSkinManager {
33+
@WrapOperation(
34+
method = "registerTextures",
35+
at = @At(
36+
value = "INVOKE",
37+
target = "Lnet/minecraft/client/resources/SkinManager$TextureCache;getOrLoad(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture;)Ljava/util/concurrent/CompletableFuture;"
38+
)
39+
)
40+
private CompletableFuture<ResourceLocation> wrapPlayerSkinInit(
41+
SkinManager.TextureCache instance, MinecraftProfileTexture texture,
42+
Operation<CompletableFuture<ResourceLocation>> original) {
43+
return original.call(instance, texture).thenApply((location) -> {
44+
String hash = texture.getHash();
45+
if (!NoCapes.CAPE_CACHE.containsKey(location)
46+
&& Arrays.asList(NoCapes.CAPES).contains(hash)) {
47+
NoCapes.CAPE_CACHE.put(location, hash);
48+
}
49+
return location;
50+
});
51+
}
52+
}

common/src/main/java/dev/terminalmc/nocapes/mixin/MixinElytraLayer.java renamed to common/src/main/java/dev/terminalmc/nocapes/mixin/MixinWingsLayer.java

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,26 @@
1818

1919
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
2020
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
21-
import com.llamalad7.mixinextras.sugar.Local;
2221
import dev.terminalmc.nocapes.NoCapes;
23-
import net.minecraft.client.player.AbstractClientPlayer;
24-
import net.minecraft.client.renderer.entity.layers.ElytraLayer;
22+
import net.minecraft.client.renderer.entity.layers.WingsLayer;
2523
import net.minecraft.client.resources.PlayerSkin;
2624
import net.minecraft.resources.ResourceLocation;
2725
import org.jetbrains.annotations.Nullable;
2826
import org.spongepowered.asm.mixin.Mixin;
2927
import org.spongepowered.asm.mixin.injection.At;
3028

31-
@Mixin(ElytraLayer.class)
32-
public class MixinElytraLayer {
29+
@Mixin(WingsLayer.class)
30+
public class MixinWingsLayer {
3331
@WrapOperation(
34-
method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/world/entity/LivingEntity;FFFFFF)V",
32+
method = "getPlayerElytraTexture",
3533
at = @At(
3634
value = "INVOKE",
3735
target = "Lnet/minecraft/client/resources/PlayerSkin;capeTexture()Lnet/minecraft/resources/ResourceLocation;"
3836
)
3937
)
40-
private @Nullable ResourceLocation nullIfBlocked(PlayerSkin instance,
41-
Operation<ResourceLocation> original,
42-
@Local AbstractClientPlayer player) {
43-
if (instance.capeTexture() != null && !NoCapes.blockElytra(player.getGameProfile())) {
44-
return original.call(instance);
45-
}
46-
return null;
38+
private static @Nullable ResourceLocation wrapCapeTexture(PlayerSkin instance, Operation<ResourceLocation> original) {
39+
ResourceLocation texture = original.call(instance);
40+
if (NoCapes.blockElytra(texture)) return null;
41+
return texture;
4742
}
4843
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
# https://docs.neoforged.net/docs/advanced/accesstransformers
2+
public net.minecraft.client.resources.SkinManager$TextureCache
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
accessWidener v2 named
22
# https://fabricmc.net/wiki/tutorial:accesswideners
3+
accessible class net/minecraft/client/resources/SkinManager$TextureCache

common/src/main/resources/nocapes.mixins.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"client": [
1010
"MixinCapeLayer",
1111
"MixinClientPacketListener",
12-
"MixinElytraLayer"
12+
"MixinSkinManager",
13+
"MixinWingsLayer"
1314
],
1415
"server": [
1516
],

gradle.properties

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ java_versions_fabric=>=21
2727
java_versions_neoforge=[21,)
2828

2929
# Minecraft
30-
minecraft_version=1.21
31-
minecraft_versions_fabric=>1.20.6 <1.21.2
32-
minecraft_versions_neoforge=(1.20.6, 1.21.2)
30+
minecraft_version=1.21.3
31+
minecraft_versions_fabric=>1.21.1 <1.22
32+
minecraft_versions_neoforge=(1.21.1, 1.22)
3333

3434
# Parchment https://parchmentmc.org/docs/getting-started#choose-a-version
3535
parchment_minecraft_version=1.21
@@ -38,24 +38,24 @@ parchment_version=2024.11.10
3838
# Fabric https://fabricmc.net/develop
3939
fabric_loader_version=0.16.9
4040
fabric_loader_versions=>=0.15.0
41-
fabric_api_version=0.102.0+1.21
41+
fabric_api_version=0.110.0+1.21.3
4242
fabric_api_versions=*
4343

4444
# NeoForge https://projects.neoforged.net/neoforged/neoforge
4545
neoforge_loader_versions=[1,)
46-
neoforge_version=21.0.167
47-
neoforge_versions=[21.0.143, 22)
46+
neoforge_version=21.3.57
47+
neoforge_versions=[21.2.0, 22)
4848
# NeoForm https://projects.neoforged.net/neoforged/neoform
49-
neoform_version=1.21-20240613.152323
49+
neoform_version=1.21.3-20241023.131943
5050

5151
# Cloth Config https://modrinth.com/mod/9s6osm5g/versions
52-
clothconfig_version=15.0.140
53-
clothconfig_versions_fabric=>=15
54-
clothconfig_versions_neoforge=[15,)
52+
clothconfig_version=16.0.141
53+
clothconfig_versions_fabric=>=16
54+
clothconfig_versions_neoforge=[16,)
5555

5656
# ModMenu https://modrinth.com/mod/mOgUt4GM/versions
57-
modmenu_version=11.0.3
58-
modmenu_versions_fabric=>=11.0.0-beta.1
57+
modmenu_version=12.0.0
58+
modmenu_versions_fabric=>=12.0.0-beta.1
5959

6060
# GitHub, Modrinth, CurseForge releases
6161
# Plural properties expect CSV lists
@@ -67,19 +67,21 @@ curseforge_slug=nocapes
6767
release_type=STABLE
6868
# Fabric
6969
release_mod_loaders_fabric=fabric
70-
release_game_versions_fabric=1.21,1.21.1
70+
release_game_versions_fabric=1.21.2,1.21.3,1.21.4
7171
release_required_dep_ids_fabric_mr=P7dR8mSH,mOgUt4GM,9s6osm5g
7272
release_required_dep_ids_fabric_cf=fabric-api,modmenu,cloth-config
7373
# NeoForge
7474
release_mod_loaders_neoforge=neoforge
75-
release_game_versions_neoforge=1.21,1.21.1
75+
release_game_versions_neoforge=1.21.2,1.21.3,1.21.4
7676
release_required_dep_ids_neoforge_mr=9s6osm5g
7777
release_required_dep_ids_neoforge_cf=cloth-config
7878

7979
# Mixin https://mvnrepository.com/artifact/org.spongepowered/mixin
8080
mixin_version=0.8.7
8181
# MixinExtras https://github.com/LlamaLad7/MixinExtras/releases
8282
mixinextras_version=0.4.1
83+
# ASM https://mvnrepository.com/artifact/org.ow2.asm/asm
84+
asm_version=9.7
8385

8486
# Plugins
8587
# Fabric Loom https://mvnrepository.com/artifact/net.fabricmc/fabric-loom

0 commit comments

Comments
 (0)