Fix TickEvent.PlayerTickEvent firing twice for tick end (fixes #5878) (#5885)

This commit is contained in:
Take Weiland 2019-07-02 21:57:06 +02:00 committed by LexManos
parent 358211ca66
commit 0574db134c
1 changed files with 26 additions and 34 deletions

View File

@ -54,15 +54,7 @@
}
protected boolean func_204229_de() {
@@ -261,6 +271,7 @@
}
private void func_203041_m() {
+ net.minecraftforge.fml.hooks.BasicEventHooks.onPlayerPostTick(this);
ItemStack itemstack = this.func_184582_a(EquipmentSlotType.HEAD);
if (itemstack.func_77973_b() == Items.field_203179_ao && !this.func_208600_a(FluidTags.field_206959_a)) {
this.func_195064_c(new EffectInstance(Effects.field_76427_o, 200, 0, false, false, true));
@@ -427,10 +438,10 @@
@@ -427,10 +437,10 @@
this.field_71107_bF = this.field_71109_bG;
this.field_71109_bG = 0.0F;
this.func_71015_k(this.field_70165_t - d0, this.field_70163_u - d1, this.field_70161_v - d2);
@ -75,7 +67,7 @@
}
}
@@ -543,6 +554,7 @@
@@ -543,6 +553,7 @@
}
public void func_70645_a(DamageSource p_70645_1_) {
@ -83,7 +75,7 @@
super.func_70645_a(p_70645_1_);
this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v);
if (!this.func_175149_v()) {
@@ -597,12 +609,14 @@
@@ -597,12 +608,14 @@
@Nullable
public ItemEntity func_71040_bB(boolean p_71040_1_) {
@ -100,7 +92,7 @@
}
@Nullable
@@ -636,7 +650,12 @@
@@ -636,7 +649,12 @@
}
}
@ -113,7 +105,7 @@
float f = this.field_71071_by.func_184438_a(p_184813_1_);
if (f > 1.0F) {
int i = EnchantmentHelper.func_185293_e(this);
@@ -678,11 +697,12 @@
@@ -678,11 +696,12 @@
f /= 5.0F;
}
@ -127,7 +119,7 @@
}
public void func_70037_a(CompoundNBT p_70037_1_) {
@@ -706,6 +726,17 @@
@@ -706,6 +725,17 @@
this.field_82248_d = p_70037_1_.func_74767_n("SpawnForced");
}
@ -145,7 +137,7 @@
this.field_71100_bB.func_75112_a(p_70037_1_);
this.field_71075_bZ.func_75095_b(p_70037_1_);
if (p_70037_1_.func_150297_b("EnderItems", 9)) {
@@ -751,9 +782,26 @@
@@ -751,9 +781,26 @@
p_213281_1_.func_218657_a("ShoulderEntityRight", this.func_192025_dl());
}
@ -172,7 +164,7 @@
if (this.func_180431_b(p_70097_1_)) {
return false;
} else if (this.field_71075_bZ.field_75102_a && !p_70097_1_.func_76357_e()) {
@@ -785,7 +833,7 @@
@@ -785,7 +832,7 @@
protected void func_190629_c(LivingEntity p_190629_1_) {
super.func_190629_c(p_190629_1_);
@ -181,7 +173,7 @@
this.func_190777_m(true);
}
@@ -806,13 +854,15 @@
@@ -806,13 +853,15 @@
}
protected void func_184590_k(float p_184590_1_) {
@ -198,7 +190,7 @@
if (hand == Hand.MAIN_HAND) {
this.func_184201_a(EquipmentSlotType.MAINHAND, ItemStack.field_190927_a);
} else {
@@ -828,11 +878,14 @@
@@ -828,11 +877,14 @@
protected void func_70665_d(DamageSource p_70665_1_, float p_70665_2_) {
if (!this.func_180431_b(p_70665_1_)) {
@ -213,7 +205,7 @@
float f1 = f - p_70665_2_;
if (f1 > 0.0F && f1 < 3.4028235E37F) {
this.func_195067_a(Stats.field_212738_J, Math.round(f1 * 10.0F));
@@ -887,6 +940,8 @@
@@ -887,6 +939,8 @@
return ActionResultType.PASS;
} else {
@ -222,7 +214,7 @@
ItemStack itemstack = this.func_184586_b(p_190775_2_);
ItemStack itemstack1 = itemstack.func_190926_b() ? ItemStack.field_190927_a : itemstack.func_77946_l();
if (p_190775_1_.func_184230_a(this, p_190775_2_)) {
@@ -894,6 +949,9 @@
@@ -894,6 +948,9 @@
itemstack.func_190920_e(itemstack1.func_190916_E());
}
@ -232,7 +224,7 @@
return ActionResultType.SUCCESS;
} else {
if (!itemstack.func_190926_b() && p_190775_1_ instanceof LivingEntity) {
@@ -903,6 +961,7 @@
@@ -903,6 +960,7 @@
if (itemstack.func_111282_a(this, (LivingEntity)p_190775_1_, p_190775_2_)) {
if (itemstack.func_190926_b() && !this.field_71075_bZ.field_75098_d) {
@ -240,7 +232,7 @@
this.func_184611_a(p_190775_2_, ItemStack.field_190927_a);
}
@@ -929,6 +988,7 @@
@@ -929,6 +987,7 @@
}
public void func_71059_n(Entity p_71059_1_) {
@ -248,7 +240,7 @@
if (p_71059_1_.func_70075_an()) {
if (!p_71059_1_.func_85031_j(this)) {
float f = (float)this.func_110148_a(SharedMonsterAttributes.field_111264_e).func_111126_e();
@@ -956,8 +1016,10 @@
@@ -956,8 +1015,10 @@
boolean flag2 = flag && this.field_70143_R > 0.0F && !this.field_70122_E && !this.func_70617_f_() && !this.func_70090_H() && !this.func_70644_a(Effects.field_76440_q) && !this.func_184218_aH() && p_71059_1_ instanceof LivingEntity;
flag2 = flag2 && !this.func_70051_ag();
@ -260,7 +252,7 @@
}
f = f + f1;
@@ -1045,8 +1107,10 @@
@@ -1045,8 +1106,10 @@
}
if (!this.field_70170_p.field_72995_K && !itemstack1.func_190926_b() && entity instanceof LivingEntity) {
@ -271,7 +263,7 @@
this.func_184611_a(Hand.MAIN_HAND, ItemStack.field_190927_a);
}
}
@@ -1088,7 +1152,7 @@
@@ -1088,7 +1151,7 @@
}
if (this.field_70146_Z.nextFloat() < f) {
@ -280,7 +272,7 @@
this.func_184602_cy();
this.field_70170_p.func_72960_a(this, (byte)30);
}
@@ -1132,6 +1196,8 @@
@@ -1132,6 +1195,8 @@
}
public Either<PlayerEntity.SleepResult, Unit> func_213819_a(BlockPos p_213819_1_) {
@ -289,7 +281,7 @@
Direction direction = this.field_70170_p.func_180495_p(p_213819_1_).func_177229_b(HorizontalBlock.field_185512_D);
if (!this.field_70170_p.field_72995_K) {
if (this.func_70608_bn() || !this.func_70089_S()) {
@@ -1142,7 +1208,7 @@
@@ -1142,7 +1207,7 @@
return Either.left(PlayerEntity.SleepResult.NOT_POSSIBLE_HERE);
}
@ -298,7 +290,7 @@
return Either.left(PlayerEntity.SleepResult.NOT_POSSIBLE_NOW);
}
@@ -1184,6 +1250,8 @@
@@ -1184,6 +1249,8 @@
private boolean func_190774_a(BlockPos p_190774_1_, Direction p_190774_2_) {
if (Math.abs(this.field_70165_t - (double)p_190774_1_.func_177958_n()) <= 3.0D && Math.abs(this.field_70163_u - (double)p_190774_1_.func_177956_o()) <= 2.0D && Math.abs(this.field_70161_v - (double)p_190774_1_.func_177952_p()) <= 3.0D) {
return true;
@ -307,7 +299,7 @@
} else {
BlockPos blockpos = p_190774_1_.func_177972_a(p_190774_2_.func_176734_d());
return Math.abs(this.field_70165_t - (double)blockpos.func_177958_n()) <= 3.0D && Math.abs(this.field_70163_u - (double)blockpos.func_177956_o()) <= 2.0D && Math.abs(this.field_70161_v - (double)blockpos.func_177952_p()) <= 3.0D;
@@ -1196,6 +1264,7 @@
@@ -1196,6 +1263,7 @@
}
public void func_70999_a(boolean p_70999_1_, boolean p_70999_2_, boolean p_70999_3_) {
@ -315,7 +307,7 @@
Optional<BlockPos> optional = this.func_213374_dv();
super.func_213366_dy();
if (this.field_70170_p instanceof ServerWorld && p_70999_2_) {
@@ -1216,17 +1285,17 @@
@@ -1216,17 +1284,17 @@
}
public static Optional<Vec3d> func_213822_a(IWorldReader p_213822_0_, BlockPos p_213822_1_, boolean p_213822_2_) {
@ -337,7 +329,7 @@
}
}
@@ -1241,23 +1310,67 @@
@@ -1241,23 +1309,67 @@
public void func_146105_b(ITextComponent p_146105_1_, boolean p_146105_2_) {
}
@ -414,7 +406,7 @@
}
public void func_195066_a(ResourceLocation p_195066_1_) {
@@ -1423,6 +1536,8 @@
@@ -1423,6 +1535,8 @@
}
super.func_180430_e(p_180430_1_, p_180430_2_);
@ -423,7 +415,7 @@
}
}
@@ -1685,7 +1800,10 @@
@@ -1685,7 +1799,10 @@
}
public ITextComponent func_145748_c_() {
@ -435,7 +427,7 @@
return this.func_208016_c(itextcomponent);
}
@@ -1921,4 +2039,44 @@
@@ -1921,4 +2038,44 @@
return this.field_221260_g;
}
}