mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 22:07:59 +01:00
Ponies can now lie down by holding crouch and not moving
This commit is contained in:
parent
e31ee1c53b
commit
4717c9e458
3 changed files with 11 additions and 1 deletions
|
@ -9,6 +9,7 @@ import java.util.*;
|
||||||
|
|
||||||
import net.minecraft.client.render.entity.model.BipedEntityModel.ArmPose;
|
import net.minecraft.client.render.entity.model.BipedEntityModel.ArmPose;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.*;
|
import net.minecraft.util.*;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
@ -151,6 +152,11 @@ public class ModelAttributes {
|
||||||
isSitting = PonyPosture.isSitting(entity);
|
isSitting = PonyPosture.isSitting(entity);
|
||||||
isSleeping = entity.isAlive() && entity.isSleeping();;
|
isSleeping = entity.isAlive() && entity.isSleeping();;
|
||||||
isLyingDown = 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);
|
isCrouching = !isLyingDown && !isSitting && mode == Mode.THIRD_PERSON && PonyPosture.isCrouching(pony, entity);
|
||||||
isFlying = !isLyingDown && mode == Mode.THIRD_PERSON && PonyPosture.isFlying(entity);
|
isFlying = !isLyingDown && mode == Mode.THIRD_PERSON && PonyPosture.isFlying(entity);
|
||||||
isGliding = entity.isFallFlying();
|
isGliding = entity.isFallFlying();
|
||||||
|
|
|
@ -623,8 +623,11 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
stack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180));
|
stack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean crouching = attributes.isCrouching;
|
||||||
|
|
||||||
if (attributes.isLyingDown && !attributes.isSleeping) {
|
if (attributes.isLyingDown && !attributes.isSleeping) {
|
||||||
stack.translate(0, 1.35F, 0);
|
stack.translate(0, 1.35F, 0);
|
||||||
|
attributes.isCrouching = sneaking;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attributes.isHorsey) {
|
if (attributes.isHorsey) {
|
||||||
|
@ -638,5 +641,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
}
|
}
|
||||||
|
|
||||||
PonyTransformation.forSize(getSize()).transform(this, part, stack);
|
PonyTransformation.forSize(getSize()).transform(this, part, stack);
|
||||||
|
|
||||||
|
attributes.isCrouching = crouching;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ import net.minecraft.client.render.item.ItemRenderer;
|
||||||
import net.minecraft.client.render.model.json.ModelTransformationMode;
|
import net.minecraft.client.render.model.json.ModelTransformationMode;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
|
||||||
import net.minecraft.item.CrossbowItem;
|
import net.minecraft.item.CrossbowItem;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.screen.PlayerScreenHandler;
|
import net.minecraft.screen.PlayerScreenHandler;
|
||||||
|
|
Loading…
Reference in a new issue