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_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.0.7 mod_version=1.20.1-0.0.7-hotfix
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

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

View File

@ -37,17 +37,20 @@ public abstract class MixinEntity {
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;
float camYModifier = 0.0f; Float camYModifier = null;
for (ResourceLocation value : data.getAnimations().values()) { for (ResourceLocation value : data.getAnimations().values()) {
Animation animation = AnimationUtils.getAnimation(value); Animation animation = AnimationUtils.getAnimation(value);
if(animation == null) continue; if(animation == null) continue;
float animationCamY = animation.getCamY(); float animationCamY = animation.getCamY();
if(camYModifier == null) camYModifier = animationCamY;
camYModifier = Math.min(camYModifier, animationCamY); camYModifier = Math.min(camYModifier, animationCamY);
} }
if(camYModifier != null){
this.eyeHeight = this.getEyeHeight(Pose.STANDING) + camYModifier; this.eyeHeight = this.getEyeHeight(Pose.STANDING) + camYModifier;
cir.setReturnValue(this.eyeHeight); cir.setReturnValue(this.eyeHeight);
} }
} }
}
@Inject( @Inject(
method = "getBoundingBox", method = "getBoundingBox",