Allow for modders to decide whether or not players are positioned on ridingEntities similarly to pigs PR #244
This commit is contained in:
parent
369f8ce38f
commit
2087b2b44e
2 changed files with 27 additions and 1 deletions
|
@ -151,7 +151,7 @@
|
||||||
/**
|
/**
|
||||||
* Remove the speified potion effect from this entity.
|
* Remove the speified potion effect from this entity.
|
||||||
*/
|
*/
|
||||||
@@ -2861,4 +2906,30 @@
|
@@ -2861,4 +2906,42 @@
|
||||||
{
|
{
|
||||||
this.dataWatcher.updateObject(10, Byte.valueOf((byte)par1));
|
this.dataWatcher.updateObject(10, Byte.valueOf((byte)par1));
|
||||||
}
|
}
|
||||||
|
@ -180,5 +180,17 @@
|
||||||
+ onFinishedPotionEffect(effect);
|
+ onFinishedPotionEffect(effect);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Returns true if the entity's rider (EntityPlayer) should face forward when mounted.
|
||||||
|
+ * currently only used in vanilla code by pigs.
|
||||||
|
+ *
|
||||||
|
+ * @param player The player who is riding the entity.
|
||||||
|
+ * @return If the player should orient the same direction as this entity.
|
||||||
|
+ */
|
||||||
|
+ public boolean shouldRiderFaceForward(EntityPlayer player)
|
||||||
|
+ {
|
||||||
|
+ return this instanceof EntityPig;
|
||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,20 @@
|
||||||
if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0)
|
if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0)
|
||||||
{
|
{
|
||||||
this.updateItemUse(var1, 5);
|
this.updateItemUse(var1, 5);
|
||||||
|
@@ -448,11 +460,11 @@
|
||||||
|
this.cameraYaw = 0.0F;
|
||||||
|
this.addMountedMovementStat(this.posX - var1, this.posY - var3, this.posZ - var5);
|
||||||
|
|
||||||
|
- if (this.ridingEntity instanceof EntityPig)
|
||||||
|
+ if (this.ridingEntity instanceof EntityLiving && ((EntityLiving)ridingEntity).shouldRiderFaceForward(this))
|
||||||
|
{
|
||||||
|
this.rotationPitch = var8;
|
||||||
|
this.rotationYaw = var7;
|
||||||
|
- this.renderYawOffset = ((EntityPig)this.ridingEntity).renderYawOffset;
|
||||||
|
+ this.renderYawOffset = ((EntityLiving)this.ridingEntity).renderYawOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -575,6 +587,9 @@
|
@@ -575,6 +587,9 @@
|
||||||
this.setPosition(this.posX, this.posY, this.posZ);
|
this.setPosition(this.posX, this.posY, this.posZ);
|
||||||
this.motionY = 0.10000000149011612D;
|
this.motionY = 0.10000000149011612D;
|
||||||
|
|
Loading…
Reference in a new issue