mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 22:07:59 +01:00
Adjust nameplate positioning on ponies.
This commit is contained in:
parent
ac3a7c7668
commit
c74f05873e
3 changed files with 29 additions and 0 deletions
|
@ -96,4 +96,23 @@ public class RenderPony<T extends EntityLivingBase> {
|
||||||
public float getScaleFactor() {
|
public float getScaleFactor() {
|
||||||
return ponyModel.getSize().getScaleFactor();
|
return ponyModel.getSize().getScaleFactor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getNamePlateYOffset(T entity, double initial) {
|
||||||
|
|
||||||
|
// We start by negating the height calculation done by mohjong.
|
||||||
|
float y = -(entity.height + 0.5F - (entity.isSneaking() ? 0.25F : 0));
|
||||||
|
|
||||||
|
if (entity.isChild()) {
|
||||||
|
y += 0.5F;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Then we add our own offsets.
|
||||||
|
y += entity.height * getScaleFactor() + 0.25F;
|
||||||
|
|
||||||
|
if (entity.isSneaking()) {
|
||||||
|
y -= 0.125F;
|
||||||
|
}
|
||||||
|
|
||||||
|
return initial + y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,6 +79,11 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
|
||||||
return MineLittlePony.getInstance().getManager().getPony(getEntityTexture(entity));
|
return MineLittlePony.getInstance().getManager().getPony(getEntityTexture(entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void renderLivingLabel(T entity, String name, double x, double y, double z, int maxDistance) {
|
||||||
|
super.renderLivingLabel(entity, name, x, renderPony.getNamePlateYOffset(entity, y), z, maxDistance);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nonnull
|
@Nonnull
|
||||||
protected final ResourceLocation getEntityTexture(T entity) {
|
protected final ResourceLocation getEntityTexture(T entity) {
|
||||||
|
|
|
@ -75,6 +75,11 @@ public class RenderPonyPlayer extends RenderPlayer implements IRenderPony<Abstra
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void renderLivingLabel(AbstractClientPlayer entity, String name, double x, double y, double z, int maxDistance) {
|
||||||
|
super.renderLivingLabel(entity, name, x, renderPony.getNamePlateYOffset(entity, y), z, maxDistance);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doRenderShadowAndFire(Entity player, double x, double y, double z, float yaw, float ticks) {
|
public void doRenderShadowAndFire(Entity player, double x, double y, double z, float yaw, float ticks) {
|
||||||
if (player.isRiding() && ((AbstractClientPlayer)player).isPlayerSleeping()) {
|
if (player.isRiding() && ((AbstractClientPlayer)player).isPlayerSleeping()) {
|
||||||
|
|
Loading…
Reference in a new issue