1
0
mirror of https://github.com/Suiranoil/SkinRestorer.git synced 2026-01-16 04:42:12 +00:00

Merge branch '1.19.3-multiloader' into 1.19.1-multiloader

This commit is contained in:
2025-07-13 20:56:45 +03:00
4 changed files with 18 additions and 13 deletions

View File

@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.4.2] - 2025-07-13
### Fixed
- Fix crash when head profile name is null (fixes [#60](https://github.com/Suiranoil/SkinRestorer/issues/60) and [#61](https://github.com/Suiranoil/SkinRestorer/issues/61))
## [2.4.1] - 2025-07-09 ## [2.4.1] - 2025-07-09
### Changed ### Changed
- Log full exception and argument when unable to fetch/set skin - Log full exception and argument when unable to fetch/set skin

View File

@@ -1,4 +1,2 @@
### Changed
- Log full exception and argument when unable to fetch/set skin
### Fixed ### Fixed
- Fixed mojang provider using offline uuids when unable to fetch actual uuid resulting in `no profile with uuid` error - Fix crash when head profile name is null (fixes [#60](https://github.com/Suiranoil/SkinRestorer/issues/60) and [#61](https://github.com/Suiranoil/SkinRestorer/issues/61))

View File

@@ -17,32 +17,35 @@ import java.util.function.Consumer;
@Mixin(SkullBlockEntity.class) @Mixin(SkullBlockEntity.class)
public abstract class SkullBlockEntityMixin { public abstract class SkullBlockEntityMixin {
@Shadow @Shadow
private static GameProfileCache profileCache; private static GameProfileCache profileCache;
@Inject(method = "updateGameprofile", at = @At("HEAD"), @Inject(method = "updateGameprofile", at = @At("HEAD"),
cancellable = true) cancellable = true)
private static void fetchProfileByName(GameProfile profile, Consumer<GameProfile> profileConsumer, CallbackInfo ci) { private static void fetchProfileByName(GameProfile profile, Consumer<GameProfile> profileConsumer, CallbackInfo ci) {
if (profileCache == null || profile.isComplete()) if (profileCache == null)
return; return;
if (profile == null || profile.isComplete() || profile.getName() == null)
return;
var profileOpt = profileCache.get(profile.getName()); var profileOpt = profileCache.get(profile.getName());
skinrestorer$replaceSkin(profileOpt, profileConsumer, ci); skinrestorer$replaceSkin(profileOpt, profileConsumer, ci);
} }
@Unique @Unique
private static void skinrestorer$replaceSkin(Optional<GameProfile> profileOpt, Consumer<GameProfile> profileConsumer, CallbackInfo ci) { private static void skinrestorer$replaceSkin(Optional<GameProfile> profileOpt, Consumer<GameProfile> profileConsumer, CallbackInfo ci) {
if (profileOpt.isEmpty()) if (profileOpt.isEmpty())
return; return;
var profile = PlayerUtils.cloneGameProfile(profileOpt.get()); var profile = PlayerUtils.cloneGameProfile(profileOpt.get());
if (SkinRestorer.getSkinStorage().hasSavedSkin(profile.getId())) { if (SkinRestorer.getSkinStorage().hasSavedSkin(profile.getId())) {
var skin = SkinRestorer.getSkinStorage().getSkin(profile.getId(), false); var skin = SkinRestorer.getSkinStorage().getSkin(profile.getId(), false);
PlayerUtils.applyRestoredSkin(profile, skin.value()); PlayerUtils.applyRestoredSkin(profile, skin.value());
profileConsumer.accept(profile); profileConsumer.accept(profile);
ci.cancel(); ci.cancel();
} }

View File

@@ -8,7 +8,7 @@ minecraft_version_list=1.19.1,1.19.2
minecraft_version_range=[1.19.1,1.19.2] minecraft_version_range=[1.19.1,1.19.2]
mod_id=skinrestorer mod_id=skinrestorer
mod_name=SkinRestorer mod_name=SkinRestorer
mod_version=2.4.1 mod_version=2.4.2
mod_author=Lionarius mod_author=Lionarius
mod_homepage=https://modrinth.com/mod/skinrestorer mod_homepage=https://modrinth.com/mod/skinrestorer
mod_sources=https://github.com/Suiranoil/SkinRestorer mod_sources=https://github.com/Suiranoil/SkinRestorer