version 0.1.1.2 hotfix
This commit is contained in:
parent
89cd4ace1f
commit
1c329c3a19
|
|
@ -1,10 +1,10 @@
|
||||||
package com.linearpast.sccore.animation.utils;
|
package com.linearpast.sccore.animation.utils;
|
||||||
|
|
||||||
import com.linearpast.sccore.SnowyCrescentCore;
|
import com.linearpast.sccore.SnowyCrescentCore;
|
||||||
|
import com.linearpast.sccore.animation.AnimationApi;
|
||||||
import com.linearpast.sccore.animation.capability.AnimationDataCapability;
|
import com.linearpast.sccore.animation.capability.AnimationDataCapability;
|
||||||
import com.linearpast.sccore.animation.capability.inter.IAnimationCapability;
|
import com.linearpast.sccore.animation.capability.inter.IAnimationCapability;
|
||||||
import com.linearpast.sccore.animation.data.GenericAnimationData;
|
import com.linearpast.sccore.animation.data.AnimationData;
|
||||||
import com.linearpast.sccore.animation.data.RawAnimationData;
|
|
||||||
import com.linearpast.sccore.animation.mixin.IMixinKeyframeAnimationPlayer;
|
import com.linearpast.sccore.animation.mixin.IMixinKeyframeAnimationPlayer;
|
||||||
import com.linearpast.sccore.animation.register.AnimationRegistry;
|
import com.linearpast.sccore.animation.register.AnimationRegistry;
|
||||||
import com.linearpast.sccore.animation.service.AnimationService;
|
import com.linearpast.sccore.animation.service.AnimationService;
|
||||||
|
|
@ -157,19 +157,24 @@ public class AnimationUtils {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(modifierLayer == null) return;
|
if(modifierLayer == null) return;
|
||||||
KeyframeAnimation keyframeAnimation;
|
AnimationData anim = AnimationService.INSTANCE.getAnimation(animation);
|
||||||
GenericAnimationData anim = AnimationService.INSTANCE.getAnimation(animation);
|
|
||||||
if(anim == null) {
|
if(anim == null) {
|
||||||
RawAnimationData rawAnim = RawAnimationService.INSTANCE.getAnimation(animation);
|
if((anim = RawAnimationService.INSTANCE.getAnimation(animation)) == null)
|
||||||
if(rawAnim == null) return;
|
return;
|
||||||
keyframeAnimation = rawAnim.getAnimation();
|
}
|
||||||
} else keyframeAnimation = anim.getAnimation();
|
KeyframeAnimation keyframeAnimation = anim.getAnimation();
|
||||||
if(keyframeAnimation == null) {
|
if(keyframeAnimation == null) {
|
||||||
if(localPlayer == null) return;
|
if(localPlayer == null) return;
|
||||||
localPlayer.sendSystemMessage(Component.translatable(
|
localPlayer.sendSystemMessage(Component.translatable(
|
||||||
ModLang.TranslatableMessage.ANIMATION_RESOURCE_NOT_FOUND.getKey(),
|
ModLang.TranslatableMessage.ANIMATION_RESOURCE_NOT_FOUND.getKey(),
|
||||||
animation.toString()
|
animation.toString()
|
||||||
).withStyle(ChatFormatting.RED));
|
).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;
|
return;
|
||||||
}
|
}
|
||||||
modifierLayer.replaceAnimationWithFade(
|
modifierLayer.replaceAnimationWithFade(
|
||||||
|
|
|
||||||
|
|
@ -24,16 +24,15 @@ public abstract class MixinEntity {
|
||||||
|
|
||||||
@Shadow public abstract void setPose(Pose pPose);
|
@Shadow public abstract void setPose(Pose pPose);
|
||||||
|
|
||||||
@Inject(
|
@ModifyReturnValue(
|
||||||
method = "getEyeHeight()F",
|
method = "getEyeHeight()F",
|
||||||
at = @At(value = "HEAD"),
|
at = @At("RETURN")
|
||||||
cancellable = true
|
|
||||||
)
|
)
|
||||||
private void redefinedEyeHeight(CallbackInfoReturnable<Float> cir){
|
private float redefinedEyeHeight(float original){
|
||||||
Entity self = Entity.class.cast(this);
|
Entity self = Entity.class.cast(this);
|
||||||
if(self instanceof Player player){
|
if(self instanceof Player player){
|
||||||
IAnimationCapability data = AnimationDataCapability.getCapability(player).orElse(null);
|
IAnimationCapability data = AnimationDataCapability.getCapability(player).orElse(null);
|
||||||
if(data == null) return;
|
if(data == null) return original;
|
||||||
Float camYModifier = null;
|
Float camYModifier = null;
|
||||||
for (ResourceLocation value : data.getAnimations().values()) {
|
for (ResourceLocation value : data.getAnimations().values()) {
|
||||||
GenericAnimationData animation = AnimationService.INSTANCE.getAnimation(value);
|
GenericAnimationData animation = AnimationService.INSTANCE.getAnimation(value);
|
||||||
|
|
@ -43,9 +42,10 @@ public abstract class MixinEntity {
|
||||||
camYModifier = Math.min(camYModifier, animationCamY);
|
camYModifier = Math.min(camYModifier, animationCamY);
|
||||||
}
|
}
|
||||||
if(camYModifier != null){
|
if(camYModifier != null){
|
||||||
cir.setReturnValue(this.getEyeHeight(Pose.STANDING) + camYModifier);
|
return this.getEyeHeight(Pose.STANDING) + camYModifier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return original;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(
|
@Inject(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user