Merge pull request #702 from MrMasochism/master

Added new function for control over dismount underwater
This commit is contained in:
LexManos 2013-08-10 22:07:02 -07:00
commit 5fadba7ddc
2 changed files with 20 additions and 1 deletions

View file

@ -155,7 +155,7 @@
}
public boolean func_96091_a(Explosion par1Explosion, World par2World, int par3, int par4, int par5, int par6, float par7)
@@ -2426,4 +2496,160 @@
@@ -2426,4 +2496,170 @@
{
return this.getEntityName();
}
@ -314,5 +314,15 @@
+ public boolean canRiderInteract()
+ {
+ return false;
+ }
+
+ /**
+ * If the rider should be dismounted from the entity when the entity goes under water
+ *
+ * @param rider The entity that is riding
+ * @return if the entity should be dismounted when under water
+ */
+ public boolean shouldDismountInWater(Entity rider){
+ return this instanceof EntityLivingBase;
+ }
}

View file

@ -20,6 +20,15 @@
public abstract class EntityLivingBase extends Entity
{
@@ -299,7 +302,7 @@
this.extinguish();
- if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity instanceof EntityLivingBase)
+ if (!this.worldObj.isRemote && this.isRiding() && ridingEntity!=null && ridingEntity.shouldDismountInWater(this))
{
this.mountEntity((Entity)null);
}
@@ -446,6 +449,7 @@
{
this.entityLivingToAttack = par1EntityLivingBase;