From 1c329c3a1927c0deee44512db84a64812e4e32f2 Mon Sep 17 00:00:00 2001 From: LostInLinearPast <1283411677@qq.com> Date: Tue, 2 Dec 2025 19:28:36 +0800 Subject: [PATCH] version 0.1.1.2 hotfix --- .../animation/utils/AnimationUtils.java | 21 ++++++++++++------- .../sccore/mixin/animation/MixinEntity.java | 12 +++++------ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/linearpast/sccore/animation/utils/AnimationUtils.java b/src/main/java/com/linearpast/sccore/animation/utils/AnimationUtils.java index c4b254f..5aac842 100644 --- a/src/main/java/com/linearpast/sccore/animation/utils/AnimationUtils.java +++ b/src/main/java/com/linearpast/sccore/animation/utils/AnimationUtils.java @@ -1,10 +1,10 @@ package com.linearpast.sccore.animation.utils; import com.linearpast.sccore.SnowyCrescentCore; +import com.linearpast.sccore.animation.AnimationApi; import com.linearpast.sccore.animation.capability.AnimationDataCapability; import com.linearpast.sccore.animation.capability.inter.IAnimationCapability; -import com.linearpast.sccore.animation.data.GenericAnimationData; -import com.linearpast.sccore.animation.data.RawAnimationData; +import com.linearpast.sccore.animation.data.AnimationData; import com.linearpast.sccore.animation.mixin.IMixinKeyframeAnimationPlayer; import com.linearpast.sccore.animation.register.AnimationRegistry; import com.linearpast.sccore.animation.service.AnimationService; @@ -157,19 +157,24 @@ public class AnimationUtils { return; } if(modifierLayer == null) return; - KeyframeAnimation keyframeAnimation; - GenericAnimationData anim = AnimationService.INSTANCE.getAnimation(animation); + AnimationData anim = AnimationService.INSTANCE.getAnimation(animation); if(anim == null) { - RawAnimationData rawAnim = RawAnimationService.INSTANCE.getAnimation(animation); - if(rawAnim == null) return; - keyframeAnimation = rawAnim.getAnimation(); - } else keyframeAnimation = anim.getAnimation(); + if((anim = RawAnimationService.INSTANCE.getAnimation(animation)) == null) + return; + } + KeyframeAnimation keyframeAnimation = anim.getAnimation(); if(keyframeAnimation == null) { if(localPlayer == null) return; localPlayer.sendSystemMessage(Component.translatable( ModLang.TranslatableMessage.ANIMATION_RESOURCE_NOT_FOUND.getKey(), animation.toString() ).withStyle(ChatFormatting.RED)); + modifierLayer.replaceAnimationWithFade( + AbstractFadeModifier.standardFadeIn(3, Ease.INOUTSINE), + null + ); + IAnimationService service = AnimationApi.getServiceGetterHelper(anim.getKey()).getService(); + if(service != null) service.removeAnimation(clientPlayer, layer); return; } modifierLayer.replaceAnimationWithFade( diff --git a/src/main/java/com/linearpast/sccore/mixin/animation/MixinEntity.java b/src/main/java/com/linearpast/sccore/mixin/animation/MixinEntity.java index ac10ff0..061668b 100644 --- a/src/main/java/com/linearpast/sccore/mixin/animation/MixinEntity.java +++ b/src/main/java/com/linearpast/sccore/mixin/animation/MixinEntity.java @@ -24,16 +24,15 @@ public abstract class MixinEntity { @Shadow public abstract void setPose(Pose pPose); - @Inject( + @ModifyReturnValue( method = "getEyeHeight()F", - at = @At(value = "HEAD"), - cancellable = true + at = @At("RETURN") ) - private void redefinedEyeHeight(CallbackInfoReturnable cir){ + private float redefinedEyeHeight(float original){ Entity self = Entity.class.cast(this); if(self instanceof Player player){ IAnimationCapability data = AnimationDataCapability.getCapability(player).orElse(null); - if(data == null) return; + if(data == null) return original; Float camYModifier = null; for (ResourceLocation value : data.getAnimations().values()) { GenericAnimationData animation = AnimationService.INSTANCE.getAnimation(value); @@ -43,9 +42,10 @@ public abstract class MixinEntity { camYModifier = Math.min(camYModifier, animationCamY); } if(camYModifier != null){ - cir.setReturnValue(this.getEyeHeight(Pose.STANDING) + camYModifier); + return this.getEyeHeight(Pose.STANDING) + camYModifier; } } + return original; } @Inject(