mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 04:27:59 +01:00
Use Entity.isPassenger
This commit is contained in:
parent
db48187b6e
commit
b4a52ac69a
6 changed files with 10 additions and 10 deletions
|
@ -137,7 +137,7 @@ public class Pony extends Touchable<Pony> implements IPony {
|
||||||
@Override
|
@Override
|
||||||
public boolean isFlying(EntityLivingBase entity) {
|
public boolean isFlying(EntityLivingBase entity) {
|
||||||
return !(entity.onGround
|
return !(entity.onGround
|
||||||
|| entity.getRidingEntity() != null
|
|| entity.isPassenger()
|
||||||
|| (entity.isOnLadder() && !(entity instanceof EntityPlayer && ((EntityPlayer)entity).abilities.isFlying))
|
|| (entity.isOnLadder() && !(entity instanceof EntityPlayer && ((EntityPlayer)entity).abilities.isFlying))
|
||||||
|| entity.isInWater()
|
|| entity.isInWater()
|
||||||
|| entity.isPlayerSleeping());
|
|| entity.isPlayerSleeping());
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class RenderPony<T extends EntityLivingBase> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getRenderYaw(T entity, float rotationYaw, float partialTicks) {
|
public float getRenderYaw(T entity, float rotationYaw, float partialTicks) {
|
||||||
if (entity.getRidingEntity() != null) {
|
if (entity.isPassenger()) {
|
||||||
Entity mount = entity.getRidingEntity();
|
Entity mount = entity.getRidingEntity();
|
||||||
if (mount instanceof EntityLivingBase) {
|
if (mount instanceof EntityLivingBase) {
|
||||||
return MathUtil.interpolateDegress(((EntityLivingBase)mount).prevRenderYawOffset, ((EntityLivingBase)mount).renderYawOffset, partialTicks);
|
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) {
|
protected void translateRider(EntityLivingBase entity, float ticks) {
|
||||||
if (entity.getRidingEntity() != null) {
|
if (entity.isPassenger()) {
|
||||||
Entity ridingEntity = entity.getRidingEntity();
|
Entity ridingEntity = entity.getRidingEntity();
|
||||||
|
|
||||||
if (ridingEntity instanceof EntityLivingBase) {
|
if (ridingEntity instanceof EntityLivingBase) {
|
||||||
|
@ -173,7 +173,7 @@ public class RenderPony<T extends EntityLivingBase> {
|
||||||
y -= 0.25F;
|
y -= 0.25F;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.getRidingEntity() != null) {
|
if (entity.isPassenger()) {
|
||||||
y += entity.getRidingEntity().getEyeHeight();
|
y += entity.getRidingEntity().getEyeHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
|
||||||
shadowSize *= 3; // undo vanilla shadow scaling
|
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
|
GlStateManager.translatef(0, 0, -entity.width / 2); // move us to the center of the shadow
|
||||||
} else {
|
} else {
|
||||||
GlStateManager.translated(0, entity.getYOffset(), 0);
|
GlStateManager.translated(0, entity.getYOffset(), 0);
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class RenderPonyPlayer extends RenderPlayer implements IRenderPony<Abstra
|
||||||
@Override
|
@Override
|
||||||
public float prepareScale(AbstractClientPlayer player, float ticks) {
|
public float prepareScale(AbstractClientPlayer player, float ticks) {
|
||||||
|
|
||||||
if (player.getRidingEntity() == null && !player.isPlayerSleeping()) {
|
if (!player.isPassenger() && !player.isPlayerSleeping()) {
|
||||||
float x = player.width/2;
|
float x = player.width/2;
|
||||||
float y = 0;
|
float y = 0;
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ public class RenderPonyPlayer extends RenderPlayer implements IRenderPony<Abstra
|
||||||
renderPony.preRenderCallback(player, ticks);
|
renderPony.preRenderCallback(player, ticks);
|
||||||
shadowSize = renderPony.getShadowScale();
|
shadowSize = renderPony.getShadowScale();
|
||||||
|
|
||||||
if (player.getRidingEntity() != null) {
|
if (player.isPassenger()) {
|
||||||
GlStateManager.translated(0, player.getYOffset(), 0);
|
GlStateManager.translated(0, player.getYOffset(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ public class RenderPonyPlayer extends RenderPlayer implements IRenderPony<Abstra
|
||||||
|
|
||||||
@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.getRidingEntity() != null && ((AbstractClientPlayer)player).isPlayerSleeping()) {
|
if (player.isPassenger() && ((AbstractClientPlayer)player).isPlayerSleeping()) {
|
||||||
super.doRenderShadowAndFire(player, x, y, z, yaw, ticks);
|
super.doRenderShadowAndFire(player, x, y, z, yaw, ticks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class LayerHeldPonyItem<T extends EntityLivingBase> extends AbstractPonyL
|
||||||
|
|
||||||
float left = hand == EnumHandSide.LEFT ? 1 : -1;
|
float left = hand == EnumHandSide.LEFT ? 1 : -1;
|
||||||
|
|
||||||
if (entity.getRidingEntity() != null) {
|
if (entity.isPassenger()) {
|
||||||
GlStateManager.translatef(left / 10, -0.2F, -0.5F);
|
GlStateManager.translatef(left / 10, -0.2F, -0.5F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -338,6 +338,6 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResourceManagerReload(IResourceManager resourceManager) {
|
public void onResourceManagerReload(IResourceManager resourceManager) {
|
||||||
this.resources.onResourceManagerReload(resourceManager);
|
resources.onResourceManagerReload(resourceManager);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue