Use Entity.isPassenger

This commit is contained in:
Sollace 2019-03-26 16:42:14 +02:00
parent db48187b6e
commit b4a52ac69a
6 changed files with 10 additions and 10 deletions

View file

@ -137,7 +137,7 @@ public class Pony extends Touchable<Pony> implements IPony {
@Override
public boolean isFlying(EntityLivingBase entity) {
return !(entity.onGround
|| entity.getRidingEntity() != null
|| entity.isPassenger()
|| (entity.isOnLadder() && !(entity instanceof EntityPlayer && ((EntityPlayer)entity).abilities.isFlying))
|| entity.isInWater()
|| entity.isPlayerSleeping());

View file

@ -62,7 +62,7 @@ public class RenderPony<T extends EntityLivingBase> {
}
public float getRenderYaw(T entity, float rotationYaw, float partialTicks) {
if (entity.getRidingEntity() != null) {
if (entity.isPassenger()) {
Entity mount = entity.getRidingEntity();
if (mount instanceof EntityLivingBase) {
return MathUtil.interpolateDegress(((EntityLivingBase)mount).prevRenderYawOffset, ((EntityLivingBase)mount).renderYawOffset, partialTicks);
@ -73,7 +73,7 @@ public class RenderPony<T extends EntityLivingBase> {
}
protected void translateRider(EntityLivingBase entity, float ticks) {
if (entity.getRidingEntity() != null) {
if (entity.isPassenger()) {
Entity ridingEntity = entity.getRidingEntity();
if (ridingEntity instanceof EntityLivingBase) {
@ -173,7 +173,7 @@ public class RenderPony<T extends EntityLivingBase> {
y -= 0.25F;
}
if (entity.getRidingEntity() != null) {
if (entity.isPassenger()) {
y += entity.getRidingEntity().getEyeHeight();
}

View file

@ -80,7 +80,7 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
shadowSize *= 3; // undo vanilla shadow scaling
}
if (entity.getRidingEntity() == null) {
if (!entity.isPassenger()) {
GlStateManager.translatef(0, 0, -entity.width / 2); // move us to the center of the shadow
} else {
GlStateManager.translated(0, entity.getYOffset(), 0);

View file

@ -56,7 +56,7 @@ public class RenderPonyPlayer extends RenderPlayer implements IRenderPony<Abstra
@Override
public float prepareScale(AbstractClientPlayer player, float ticks) {
if (player.getRidingEntity() == null && !player.isPlayerSleeping()) {
if (!player.isPassenger() && !player.isPlayerSleeping()) {
float x = player.width/2;
float y = 0;
@ -77,7 +77,7 @@ public class RenderPonyPlayer extends RenderPlayer implements IRenderPony<Abstra
renderPony.preRenderCallback(player, ticks);
shadowSize = renderPony.getShadowScale();
if (player.getRidingEntity() != null) {
if (player.isPassenger()) {
GlStateManager.translated(0, player.getYOffset(), 0);
}
}
@ -111,7 +111,7 @@ public class RenderPonyPlayer extends RenderPlayer implements IRenderPony<Abstra
@Override
public void doRenderShadowAndFire(Entity player, double x, double y, double z, float yaw, float ticks) {
if (player.getRidingEntity() != null && ((AbstractClientPlayer)player).isPlayerSleeping()) {
if (player.isPassenger() && ((AbstractClientPlayer)player).isPlayerSleeping()) {
super.doRenderShadowAndFire(player, x, y, z, yaw, ticks);
}
}

View file

@ -62,7 +62,7 @@ public class LayerHeldPonyItem<T extends EntityLivingBase> extends AbstractPonyL
float left = hand == EnumHandSide.LEFT ? 1 : -1;
if (entity.getRidingEntity() != null) {
if (entity.isPassenger()) {
GlStateManager.translatef(left / 10, -0.2F, -0.5F);
}

View file

@ -338,6 +338,6 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
@Override
public void onResourceManagerReload(IResourceManager resourceManager) {
this.resources.onResourceManagerReload(resourceManager);
resources.onResourceManagerReload(resourceManager);
}
}