version 0.0.7

This commit is contained in:
LostInLinearPast 2025-10-31 23:01:15 +08:00
parent eb3cca667a
commit 1206758322
3 changed files with 10 additions and 6 deletions

View File

@ -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.0.7
mod_version=1.20.1-0.0.7-hotfix
mod_group_id=com.linearpast
mod_authors=LostInLinearPast
mod_description=A lib about capability and player animator.

View File

@ -17,6 +17,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
public class AnimationDataCapability extends SimplePlayerCapabilitySync implements IAnimationCapability {
@ -35,7 +36,7 @@ public class AnimationDataCapability extends SimplePlayerCapabilitySync implemen
animations.forEach((key, value) -> {
if (AnimationRegistry.getLayers().containsKey(key)) {
if (AnimationUtils.isAnimationPresent(value)) {
if(this.rideAnimLayer.equals(key)) {
if(Objects.equals(rideAnimLayer, key)) {
removeRiderAnimation();
}
this.animMap.put(key, value);
@ -49,7 +50,7 @@ public class AnimationDataCapability extends SimplePlayerCapabilitySync implemen
public boolean mergeAnimation(ResourceLocation layer, ResourceLocation animation) {
if (AnimationRegistry.getLayers().containsKey(layer)) {
if (AnimationUtils.isAnimationPresent(animation)) {
if(this.rideAnimLayer.equals(layer)) {
if(Objects.equals(rideAnimLayer, layer)) {
removeRiderAnimation();
}
this.animMap.put(layer, animation);

View File

@ -37,15 +37,18 @@ public abstract class MixinEntity {
if(self instanceof Player player){
IAnimationCapability data = AnimationDataCapability.getCapability(player).orElse(null);
if(data == null) return;
float camYModifier = 0.0f;
Float camYModifier = null;
for (ResourceLocation value : data.getAnimations().values()) {
Animation animation = AnimationUtils.getAnimation(value);
if(animation == null) continue;
float animationCamY = animation.getCamY();
if(camYModifier == null) camYModifier = animationCamY;
camYModifier = Math.min(camYModifier, animationCamY);
}
this.eyeHeight = this.getEyeHeight(Pose.STANDING) + camYModifier;
cir.setReturnValue(this.eyeHeight);
if(camYModifier != null){
this.eyeHeight = this.getEyeHeight(Pose.STANDING) + camYModifier;
cir.setReturnValue(this.eyeHeight);
}
}
}