Unicopia/src/main/java/com/minelittlepony/unicopia/util/LimbAnimationUtil.java
2023-06-02 20:20:30 +01:00

23 lines
600 B
Java

package com.minelittlepony.unicopia.util;
import net.minecraft.entity.LimbAnimator;
public interface LimbAnimationUtil {
static void resetToZero(LimbAnimator animator) {
animator.setSpeed(0);
animator.updateLimbs(-animator.getPos(), 1);
animator.setSpeed(0);
}
static void copy(LimbAnimator from, LimbAnimator to) {
float prevSpeed = from.getSpeed(0);
float speed = from.getSpeed();
float pos = from.getPos();
resetToZero(to);
to.setSpeed(prevSpeed);
to.updateLimbs(pos, 1);
to.setSpeed(speed);
}
}