diff --git a/gradle.properties b/gradle.properties index 331514d..a255263 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ mapping_version=2023.09.03-1.20.1 mod_id=sccore mod_name=SnowyCrescentCore 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_authors=LostInLinearPast mod_description=A lib about capability and player animator. diff --git a/src/main/java/com/linearpast/sccore/animation/register/AnimationRegistry.java b/src/main/java/com/linearpast/sccore/animation/register/AnimationRegistry.java index 1d7eb87..eb3b6b4 100644 --- a/src/main/java/com/linearpast/sccore/animation/register/AnimationRegistry.java +++ b/src/main/java/com/linearpast/sccore/animation/register/AnimationRegistry.java @@ -224,7 +224,7 @@ public class AnimationRegistry { public static boolean isAnimationRegistered = false; private static final Map animationsCache = new HashMap<>(); private static final Map layersCache = new HashMap<>(); - private static final Map modifierLayers = new HashMap<>(); + private static final Map> modifierLayers = new HashMap<>(); public static void cacheAddAnimation(ResourceLocation location, GenericAnimationData animation) { animationsCache.put(location, animation); @@ -252,10 +252,12 @@ public class AnimationRegistry { registerLayers(layersCache); layersCache.forEach((key, value) -> PlayerAnimationFactory.ANIMATION_DATA_FACTORY.registerFactory( key, value, player -> { - Optional optional = modifierLayers.keySet().stream().filter(key::equals).findFirst(); - if(optional.isPresent()) return modifierLayers.get(optional.get()); + Map animationMap = modifierLayers.getOrDefault(player.getUUID(), new HashMap<>()); + Optional optional = animationMap.keySet().stream().filter(key::equals).findFirst(); + if(optional.isPresent()) return animationMap.get(optional.get()); IAnimation iAnimation = ClientCache.registerPlayerAnimation(player); - modifierLayers.put(key, iAnimation); + animationMap.put(key, iAnimation); + modifierLayers.put(player.getUUID(), animationMap); return iAnimation; }) );