mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-04-01 01:05:27 +02:00
Use the entity's height to inform a correct position for the nameplate
This commit is contained in:
parent
54451d142b
commit
75f6d6d154
7 changed files with 8 additions and 5 deletions
|
@ -21,7 +21,6 @@ public class EnderStallionModel extends SkeleponyModel<EndermanEntity> {
|
||||||
|
|
||||||
public EnderStallionModel() {
|
public EnderStallionModel() {
|
||||||
super();
|
super();
|
||||||
attributes.visualHeight = 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -32,7 +32,6 @@ public class SkeleponyModel<T extends HostileEntity> extends AlicornModel<T> imp
|
||||||
public void animateModel(T entity, float move, float swing, float ticks) {
|
public void animateModel(T entity, float move, float swing, float ticks) {
|
||||||
isUnicorn = entity.getUuid().getLeastSignificantBits() % 3 != 0;
|
isUnicorn = entity.getUuid().getLeastSignificantBits() % 3 != 0;
|
||||||
isWithered = entity instanceof WitherSkeletonEntity;
|
isWithered = entity instanceof WitherSkeletonEntity;
|
||||||
attributes.visualHeight = isWithered ? 2.5F : 2;
|
|
||||||
|
|
||||||
rightArmPose = ArmPose.EMPTY;
|
rightArmPose = ArmPose.EMPTY;
|
||||||
leftArmPose = ArmPose.EMPTY;
|
leftArmPose = ArmPose.EMPTY;
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class VillagerPonyModel<T extends LivingEntity & VillagerDataContainer> e
|
||||||
|
|
||||||
VillagerProfession profession = entity.getVillagerData().getProfession();
|
VillagerProfession profession = entity.getVillagerData().getProfession();
|
||||||
|
|
||||||
attributes.visualHeight = PonyTextures.isCrownPony(entity) ? 2.3F : 2;
|
attributes.visualHeight += PonyTextures.isCrownPony(entity) ? 0.3F : -0.1F;
|
||||||
apron.visible = !special && profession == VillagerProfession.BUTCHER;
|
apron.visible = !special && profession == VillagerProfession.BUTCHER;
|
||||||
trinket.visible = !special && !apron.visible && profession != VillagerProfession.NONE && profession != VillagerProfession.NITWIT;
|
trinket.visible = !special && !apron.visible && profession != VillagerProfession.NONE && profession != VillagerProfession.NITWIT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ public class WitchPonyModel extends ZebraModel<WitchEntity> {
|
||||||
|
|
||||||
public WitchPonyModel() {
|
public WitchPonyModel() {
|
||||||
super(false);
|
super(false);
|
||||||
attributes.visualHeight = 2.5F;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,6 +21,7 @@ public class WitchPonyModel extends ZebraModel<WitchEntity> {
|
||||||
if (entity.hasCustomName() && "Filly".equals(entity.getCustomName().getString())) {
|
if (entity.hasCustomName() && "Filly".equals(entity.getCustomName().getString())) {
|
||||||
child = true;
|
child = true;
|
||||||
}
|
}
|
||||||
|
attributes.visualHeight += 0.5F;
|
||||||
leftArmPose = ArmPose.EMPTY;
|
leftArmPose = ArmPose.EMPTY;
|
||||||
rightArmPose = entity.getMainHandStack().isEmpty() ? ArmPose.EMPTY : ArmPose.ITEM;
|
rightArmPose = entity.getMainHandStack().isEmpty() ? ArmPose.EMPTY : ArmPose.ITEM;
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,7 @@ public class EquineRenderManager<T extends LivingEntity, M extends EntityModel<T
|
||||||
public double getNamePlateYOffset(T entity) {
|
public double getNamePlateYOffset(T entity) {
|
||||||
|
|
||||||
// We start by negating the height calculation done by mahjong.
|
// We start by negating the height calculation done by mahjong.
|
||||||
float y = -(entity.getHeight() + 0.5F - (entity.isInSneakingPose() ? 0.25F : 0));
|
float y = -(entity.getHeight() + 0.5F);
|
||||||
|
|
||||||
// Then we add our own offsets.
|
// Then we add our own offsets.
|
||||||
y += getModel().getAttributes().visualHeight * getScaleFactor() + 0.25F;
|
y += getModel().getAttributes().visualHeight * getScaleFactor() + 0.25F;
|
||||||
|
|
|
@ -99,6 +99,10 @@ public class PlayerPonyRenderer extends PlayerEntityRenderer implements IPonyRen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean hasLabel(AbstractClientPlayerEntity entity) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setupTransforms(AbstractClientPlayerEntity entity, MatrixStack stack, float ageInTicks, float rotationYaw, float partialTicks) {
|
protected void setupTransforms(AbstractClientPlayerEntity entity, MatrixStack stack, float ageInTicks, float rotationYaw, float partialTicks) {
|
||||||
manager.preRenderCallback(entity, stack, partialTicks);
|
manager.preRenderCallback(entity, stack, partialTicks);
|
||||||
|
|
|
@ -118,6 +118,7 @@ public class ModelAttributes<T extends LivingEntity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateLivingState(T entity, IPony pony, EquineRenderManager.Mode mode) {
|
public void updateLivingState(T entity, IPony pony, EquineRenderManager.Mode mode) {
|
||||||
|
visualHeight = entity.getHeight() + 0.125F;
|
||||||
isSitting = pony.isSitting(entity);
|
isSitting = pony.isSitting(entity);
|
||||||
isCrouching = !isSitting && mode == Mode.THIRD_PERSON && pony.isCrouching(entity);
|
isCrouching = !isSitting && mode == Mode.THIRD_PERSON && pony.isCrouching(entity);
|
||||||
isSleeping = entity.isSleeping();
|
isSleeping = entity.isSleeping();
|
||||||
|
|
Loading…
Add table
Reference in a new issue