From 97a232944b97a2a37cd06970ce110d86d507efd7 Mon Sep 17 00:00:00 2001 From: 3944Realms Date: Sat, 3 Jan 2026 00:34:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=86=85=E5=AE=B9=201.=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=8E=A9=E5=81=B6=E5=9C=A8=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E5=AF=BC=E8=87=B4=E5=B4=A9=E6=BA=83=E7=9A=84=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../r3944realms/lib39/util/GameProfileHelper.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/top/r3944realms/lib39/util/GameProfileHelper.java b/src/main/java/top/r3944realms/lib39/util/GameProfileHelper.java index f364f10..b42a85c 100644 --- a/src/main/java/top/r3944realms/lib39/util/GameProfileHelper.java +++ b/src/main/java/top/r3944realms/lib39/util/GameProfileHelper.java @@ -13,6 +13,8 @@ import net.minecraft.nbt.NbtUtils; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import top.r3944realms.lib39.util.nbt.NBTReader; @@ -31,10 +33,6 @@ public class GameProfileHelper { public static final String TAG_BE = "BlockEntityTag"; public static final String TAG_OWN_PROFILE = "OwnerProfile"; - /** - * The constant DEFAULT. - */ - public static ResourceLocation DEFAULT = DefaultPlayerSkin.getDefaultSkin(); /** * Gets skin texture. @@ -42,9 +40,10 @@ public class GameProfileHelper { * @param gameProfile the game profile * @return the skin texture */ + @OnlyIn(Dist.CLIENT) public static ResourceLocation getSkinTexture(@Nullable GameProfile gameProfile) { if (gameProfile == null) { - return DEFAULT; + return DefaultPlayerSkin.getDefaultSkin(); } return resolveSkinTexture(gameProfile); } @@ -55,6 +54,7 @@ public class GameProfileHelper { * @param gameProfile the game profile * @return the resource location */ + @OnlyIn(Dist.CLIENT) public static @NotNull ResourceLocation resolveSkinTexture(@NotNull GameProfile gameProfile) { Minecraft minecraft = Minecraft.getInstance(); return minecraft.getSkinManager() @@ -71,6 +71,7 @@ public class GameProfileHelper { } // 客户端判断 + @OnlyIn(Dist.CLIENT) private static boolean hasSlimArmsClient(Player player) { if (player instanceof AbstractClientPlayer clientPlayer) { PlayerInfo playerInfo = Objects.requireNonNull(Minecraft.getInstance() @@ -105,6 +106,7 @@ public class GameProfileHelper { } // 获取皮肤模型名称 + @OnlyIn(Dist.CLIENT) public static @NotNull String getSkinModelName(@NotNull Player player) { if (player.level().isClientSide && player instanceof AbstractClientPlayer) { PlayerInfo info = Objects.requireNonNull(Minecraft.getInstance().getConnection())