Ponies can now lie down by holding crouch and not moving

This commit is contained in:
Sollace 2023-10-05 20:42:31 +01:00
parent 9f77999baf
commit 060c4abfff
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
2 changed files with 11 additions and 0 deletions

View file

@ -10,6 +10,7 @@ import java.util.*;
import net.minecraft.client.render.entity.model.BipedEntityModel.ArmPose;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.*;
import net.minecraft.util.math.MathHelper;
@ -152,6 +153,11 @@ public class ModelAttributes {
isSitting = PonyPosture.isSitting(entity);
isSleeping = entity.isAlive() && entity.isSleeping();;
isLyingDown = isSleeping;
if (entity instanceof PlayerEntity) {
boolean moving = entity.getVelocity().multiply(1, 0, 1).length() == 0 && entity.isSneaking();
isLyingDown |= getMainInterpolator().interpolate("lyingDown", moving ? 10 : 0, 10) >= 9;
}
isCrouching = !isLyingDown && !isSitting && mode == Mode.THIRD_PERSON && PonyPosture.isCrouching(pony, entity);
isFlying = !isLyingDown && mode == Mode.THIRD_PERSON && PonyPosture.isFlying(entity);
isGliding = entity.isFallFlying();

View file

@ -623,8 +623,11 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
stack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180));
}
boolean crouching = attributes.isCrouching;
if (attributes.isLyingDown && !attributes.isSleeping) {
stack.translate(0, 1.35F, 0);
attributes.isCrouching = sneaking;
}
if (attributes.isHorsey) {
@ -638,5 +641,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
}
PonyTransformation.forSize(getSize()).transform(this, part, stack);
attributes.isCrouching = crouching;
}
}