Move dismount version of EntityMountEvent to Entity class. Should fix canceling dismounting. Closes #3226

This commit is contained in:
LexManos 2016-08-29 15:49:59 -07:00
parent a05d4234f0
commit f9c7caaf0c
2 changed files with 21 additions and 21 deletions

View file

@ -101,7 +101,15 @@
if (p_184205_2_ || this.func_184228_n(p_184205_1_) && p_184205_1_.func_184219_q(this)) if (p_184205_2_ || this.func_184228_n(p_184205_1_) && p_184205_1_.func_184219_q(this))
{ {
if (this.func_184218_aH()) if (this.func_184218_aH())
@@ -2336,6 +2354,7 @@ @@ -1902,6 +1920,7 @@
if (this.field_184239_as != null)
{
Entity entity = this.field_184239_as;
+ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entity, false)) return;
this.field_184239_as = null;
entity.func_184225_p(this);
}
@@ -2336,6 +2355,7 @@
{ {
if (!this.field_70170_p.field_72995_K && !this.field_70128_L) if (!this.field_70170_p.field_72995_K && !this.field_70128_L)
{ {
@ -109,7 +117,7 @@
this.field_70170_p.field_72984_F.func_76320_a("changeDimension"); this.field_70170_p.field_72984_F.func_76320_a("changeDimension");
MinecraftServer minecraftserver = this.func_184102_h(); MinecraftServer minecraftserver = this.func_184102_h();
int i = this.field_71093_bK; int i = this.field_71093_bK;
@@ -2429,7 +2448,7 @@ @@ -2429,7 +2449,7 @@
public float func_180428_a(Explosion p_180428_1_, World p_180428_2_, BlockPos p_180428_3_, IBlockState p_180428_4_) public float func_180428_a(Explosion p_180428_1_, World p_180428_2_, BlockPos p_180428_3_, IBlockState p_180428_4_)
{ {
@ -118,7 +126,7 @@
} }
public boolean func_174816_a(Explosion p_174816_1_, World p_174816_2_, BlockPos p_174816_3_, IBlockState p_174816_4_, float p_174816_5_) public boolean func_174816_a(Explosion p_174816_1_, World p_174816_2_, BlockPos p_174816_3_, IBlockState p_174816_4_, float p_174816_5_)
@@ -2726,6 +2745,164 @@ @@ -2726,6 +2746,164 @@
EnchantmentHelper.func_151385_b(p_174815_1_, p_174815_2_); EnchantmentHelper.func_151385_b(p_174815_1_, p_174815_2_);
} }

View file

@ -152,15 +152,7 @@
if (!this.field_82175_bq || this.field_110158_av >= this.func_82166_i() / 2 || this.field_110158_av < 0) if (!this.field_82175_bq || this.field_110158_av >= this.func_82166_i() / 2 || this.field_110158_av < 0)
{ {
this.field_110158_av = -1; this.field_110158_av = -1;
@@ -1521,6 +1551,7 @@ @@ -1545,7 +1575,7 @@
public void func_110145_l(Entity p_110145_1_)
{
+ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_110145_1_, false)) return;
if (!(p_110145_1_ instanceof EntityBoat) && !(p_110145_1_ instanceof EntityHorse))
{
double d1 = p_110145_1_.field_70165_t;
@@ -1545,7 +1576,7 @@
if (!this.field_70170_p.func_184143_b(axisalignedbb1)) if (!this.field_70170_p.func_184143_b(axisalignedbb1))
{ {
@ -169,7 +161,7 @@
{ {
this.func_70634_a(d11, this.field_70163_u + 1.0D, d12); this.func_70634_a(d11, this.field_70163_u + 1.0D, d12);
return; return;
@@ -1553,14 +1584,14 @@ @@ -1553,14 +1583,14 @@
BlockPos blockpos = new BlockPos(d11, this.field_70163_u - 1.0D, d12); BlockPos blockpos = new BlockPos(d11, this.field_70163_u - 1.0D, d12);
@ -186,7 +178,7 @@
{ {
d1 = d11; d1 = d11;
d13 = this.field_70163_u + 2.0D; d13 = this.field_70163_u + 2.0D;
@@ -1631,6 +1662,7 @@ @@ -1631,6 +1661,7 @@
} }
this.field_70160_al = true; this.field_70160_al = true;
@ -194,7 +186,7 @@
} }
protected void func_70629_bd() protected void func_70629_bd()
@@ -1903,6 +1935,7 @@ @@ -1903,6 +1934,7 @@
public void func_70071_h_() public void func_70071_h_()
{ {
@ -202,7 +194,7 @@
super.func_70071_h_(); super.func_70071_h_();
this.func_184608_ct(); this.func_184608_ct();
@@ -2409,6 +2442,40 @@ @@ -2409,6 +2441,40 @@
this.field_70752_e = true; this.field_70752_e = true;
} }
@ -243,7 +235,7 @@
public abstract EnumHandSide func_184591_cq(); public abstract EnumHandSide func_184591_cq();
public boolean func_184587_cr() public boolean func_184587_cr()
@@ -2429,12 +2496,19 @@ @@ -2429,12 +2495,19 @@
if (itemstack == this.field_184627_bm) if (itemstack == this.field_184627_bm)
{ {
@ -264,7 +256,7 @@
{ {
this.func_71036_o(); this.func_71036_o();
} }
@@ -2452,8 +2526,10 @@ @@ -2452,8 +2525,10 @@
if (itemstack != null && !this.func_184587_cr()) if (itemstack != null && !this.func_184587_cr())
{ {
@ -276,7 +268,7 @@
if (!this.field_70170_p.field_72995_K) if (!this.field_70170_p.field_72995_K)
{ {
@@ -2536,6 +2612,8 @@ @@ -2536,6 +2611,8 @@
this.func_184584_a(this.field_184627_bm, 16); this.func_184584_a(this.field_184627_bm, 16);
ItemStack itemstack = this.field_184627_bm.func_77950_b(this.field_70170_p, this); ItemStack itemstack = this.field_184627_bm.func_77950_b(this.field_70170_p, this);
@ -285,7 +277,7 @@
if (itemstack != null && itemstack.field_77994_a == 0) if (itemstack != null && itemstack.field_77994_a == 0)
{ {
itemstack = null; itemstack = null;
@@ -2566,7 +2644,8 @@ @@ -2566,7 +2643,8 @@
{ {
if (this.field_184627_bm != null) if (this.field_184627_bm != null)
{ {
@ -295,7 +287,7 @@
} }
this.func_184602_cy(); this.func_184602_cy();
@@ -2685,4 +2764,28 @@ @@ -2685,4 +2763,28 @@
{ {
return true; return true;
} }