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())