Fixed head positioning on Drowned

This commit is contained in:
Sollace 2019-08-05 10:49:14 +02:00
parent 107aedb479
commit 5066c7ad64
4 changed files with 20 additions and 11 deletions

View file

@ -86,7 +86,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
animateBreathing(ticks);
}
if (attributes.isSwimming) {
if (attributes.isSwimmingRotated) {
head.setRotationPoint(0, -2, -2);
} else {
head.setRotationPoint(0, 0, 0);
@ -213,7 +213,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
headPitch = attributes.isSleeping ? 0.1f : headPitch / 57.29578F;
if (attributes.isSwimming) {
if (attributes.isSwimming && attributes.motionPitch != 0) {
headPitch -= 0.9F;
}
@ -765,7 +765,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
}
if (part == BodyPart.HEAD) {
rotatef(attributes.motionPitch, 1, 0, 0);
rotatef(attributes.motionPitch, 1, 0, 0);
}
PonyTransformation.forSize(getSize()).transform(this, part);

View file

@ -67,6 +67,8 @@ public abstract class RenderPonyMob<T extends MobEntity, M extends EntityModel<T
protected void setupTransforms(T entity, float ageInTicks, float rotationYaw, float partialTicks) {
rotationYaw = renderPony.getRenderYaw(entity, rotationYaw, partialTicks);
super.setupTransforms(entity, ageInTicks, rotationYaw, partialTicks);
renderPony.applyPostureTransform(entity, rotationYaw, partialTicks);
}
@Override

View file

@ -26,7 +26,7 @@ public enum PonyTransformation {
break;
case HEAD:
if (model.getAttributes().isCrouching) translate(0, 0.1F, 0);
if (model.getAttributes().isSwimming) translate(0, 0.37F, 0.45F);
if (model.getAttributes().isSwimmingRotated) translate(0, 0.37F, 0.45F);
break;
case BACK:
translateVec(riderOffset);
@ -47,13 +47,13 @@ public enum PonyTransformation {
case NECK:
translate(0, -0.15F, -0.07F);
if (model.getAttributes().isCrouching) translate(-0.03F, 0.16F, 0.07F);
if (model.getAttributes().isSwimming) translate(0, 0.5F, 0.25F);
if (model.getAttributes().isSwimmingRotated) translate(0, 0.5F, 0.25F);
break;
case HEAD:
translate(0, -0.17F, -0.04F);
if (model.getAttributes().isSleeping) translate(0, 0, -0.1F);
if (model.getAttributes().isCrouching) translate(0, 0.15F, 0);
if (model.getAttributes().isSwimming) translate(0, 0.45F, 0.45F);
if (model.getAttributes().isSwimmingRotated) translate(0, 0.45F, 0.45F);
break;
case BODY:
translate(0, -0.2F, -0.04F);
@ -83,13 +83,13 @@ public enum PonyTransformation {
case NECK:
translate(0, -0.15F, -0.07F);
if (model.getAttributes().isCrouching) translate(-0.03F, 0.16F, 0.07F);
if (model.getAttributes().isSwimming) translate(0, 0.5F, 0.25F);
if (model.getAttributes().isSwimmingRotated) translate(0, 0.5F, 0.25F);
break;
case HEAD:
translate(0, -0.17F, -0.04F);
if (model.getAttributes().isSleeping) translate(0, 0, -0.1F);
if (model.getAttributes().isCrouching) translate(0, 0.15F, 0);
if (model.getAttributes().isSwimming) translate(0, 0.15F, 0.25F);
if (model.getAttributes().isSwimmingRotated) translate(0, 0.15F, 0.25F);
break;
case BODY:
translate(0, -0.2F, -0.04F);
@ -125,7 +125,7 @@ public enum PonyTransformation {
if (model.getAttributes().isCrouching) translate(0, -0.01F, 0.15F);
break;
case HEAD:
if (model.getAttributes().isSwimming) translate(0, 0.9F, 0.9F);
if (model.getAttributes().isSwimmingRotated) translate(0, 0.9F, 0.9F);
scale(1.3F, 1.3F, 1.3F);
break;
case LEGS:
@ -155,7 +155,7 @@ public enum PonyTransformation {
case HEAD:
translate(0.01F, -0.15F, 0);
if (model.getAttributes().isCrouching) translate(0, 0.04F, 0);
if (model.getAttributes().isSwimming) translate(0, 0.17F, 0.25F);
if (model.getAttributes().isSwimmingRotated) translate(0, 0.17F, 0.25F);
break;
case BODY:
case TAIL:
@ -190,7 +190,7 @@ public enum PonyTransformation {
case HEAD:
translate(0, -0.15F, 0.01F);
if (model.getAttributes().isCrouching) translate(0, 0.04F, 0);
if (model.getAttributes().isSwimming) translate(0, 0.8F, 0.85F);
if (model.getAttributes().isSwimmingRotated) translate(0, 0.8F, 0.85F);
scale(1.15F, 1.15F, 1.15F);
break;
case BODY:

View file

@ -3,6 +3,7 @@ package com.minelittlepony.model;
import com.minelittlepony.pony.IPony;
import com.minelittlepony.util.math.MathUtil;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Arm;
import net.minecraft.util.math.Vec3d;
@ -27,6 +28,11 @@ public class ModelAttributes<T extends LivingEntity> {
* True if the model is swimming under water.
*/
public boolean isSwimming;
/**
* True if the model is swimming, and rotated 90degs (players)
*/
public boolean isSwimmingRotated;
/**
* True if the pony is crouching.
*/
@ -96,6 +102,7 @@ public class ModelAttributes<T extends LivingEntity> {
isFlying = pony.isFlying(entity);
isGliding = entity.isFallFlying();
isSwimming = pony.isSwimming(entity);
isSwimmingRotated = isSwimming && entity instanceof PlayerEntity;
hasHeadGear = pony.isWearingHeadgear(entity);
isSitting = pony.isRidingInteractive(entity);
interpolatorId = entity.getUuid();