version 0.1.2.1

This commit is contained in:
LostInLinearPast 2025-12-05 12:28:13 +08:00
parent 6a14c7e768
commit 45288f6de8
2 changed files with 7 additions and 5 deletions

View File

@ -12,7 +12,7 @@ mapping_version=2023.09.03-1.20.1
mod_id=sccore mod_id=sccore
mod_name=SnowyCrescentCore mod_name=SnowyCrescentCore
mod_license=GNU AGPL 3.0 mod_license=GNU AGPL 3.0
mod_version=1.20.1-0.1.2 mod_version=1.20.1-0.1.2.1
mod_group_id=com.linearpast mod_group_id=com.linearpast
mod_authors=LostInLinearPast mod_authors=LostInLinearPast
mod_description=A lib about capability and player animator. mod_description=A lib about capability and player animator.

View File

@ -224,7 +224,7 @@ public class AnimationRegistry {
public static boolean isAnimationRegistered = false; public static boolean isAnimationRegistered = false;
private static final Map<ResourceLocation, GenericAnimationData> animationsCache = new HashMap<>(); private static final Map<ResourceLocation, GenericAnimationData> animationsCache = new HashMap<>();
private static final Map<ResourceLocation, Integer> layersCache = new HashMap<>(); private static final Map<ResourceLocation, Integer> layersCache = new HashMap<>();
private static final Map<ResourceLocation, IAnimation> modifierLayers = new HashMap<>(); private static final Map<UUID, Map<ResourceLocation, IAnimation>> modifierLayers = new HashMap<>();
public static void cacheAddAnimation(ResourceLocation location, GenericAnimationData animation) { public static void cacheAddAnimation(ResourceLocation location, GenericAnimationData animation) {
animationsCache.put(location, animation); animationsCache.put(location, animation);
@ -252,10 +252,12 @@ public class AnimationRegistry {
registerLayers(layersCache); registerLayers(layersCache);
layersCache.forEach((key, value) -> PlayerAnimationFactory.ANIMATION_DATA_FACTORY.registerFactory( layersCache.forEach((key, value) -> PlayerAnimationFactory.ANIMATION_DATA_FACTORY.registerFactory(
key, value, player -> { key, value, player -> {
Optional<ResourceLocation> optional = modifierLayers.keySet().stream().filter(key::equals).findFirst(); Map<ResourceLocation, IAnimation> animationMap = modifierLayers.getOrDefault(player.getUUID(), new HashMap<>());
if(optional.isPresent()) return modifierLayers.get(optional.get()); Optional<ResourceLocation> optional = animationMap.keySet().stream().filter(key::equals).findFirst();
if(optional.isPresent()) return animationMap.get(optional.get());
IAnimation iAnimation = ClientCache.registerPlayerAnimation(player); IAnimation iAnimation = ClientCache.registerPlayerAnimation(player);
modifierLayers.put(key, iAnimation); animationMap.put(key, iAnimation);
modifierLayers.put(player.getUUID(), animationMap);
return iAnimation; return iAnimation;
}) })
); );