Fix Fishing and Mineshaft Minecarts loot tables erroring. #5785

Fix Client block breaking speed not matching the server. #5790
Fix Village Siege event location, and MC-154328 preventing Sieges starting. #5800
Fix EntityJoinWorldEvent not firing on client, or some server code paths. #5786
This commit is contained in:
LexManos 2019-06-10 13:24:19 -07:00
parent da22fd40bf
commit 5dc944c1c3
9 changed files with 81 additions and 30 deletions

View File

@ -157,9 +157,8 @@
BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.field_71476_x;
BlockPos blockpos = blockraytraceresult.func_216350_a();
- if (!this.field_71441_e.func_180495_p(blockpos).func_196958_f()) {
- Direction direction = blockraytraceresult.func_216354_b();
+ Direction direction = blockraytraceresult.func_216354_b();
+ if (!this.field_71441_e.func_175623_d(blockpos) && this.field_71442_b.func_180512_c(blockpos, direction)) {
+ if (!this.field_71441_e.func_175623_d(blockpos)) {
Direction direction = blockraytraceresult.func_216354_b();
if (this.field_71442_b.func_180512_c(blockpos, direction)) {
- this.field_71452_i.func_180532_a(blockpos, direction);
+ this.field_71452_i.addBlockHitEffects(blockpos, blockraytraceresult);

View File

@ -25,7 +25,11 @@
p_217418_1_.func_70071_h_();
this.func_217381_Z().func_76319_b();
}
@@ -267,6 +271,7 @@
@@ -264,9 +268,11 @@
}
private void func_217424_b(int p_217424_1_, Entity p_217424_2_) {
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_217424_2_, this))) return;
this.func_217413_d(p_217424_1_);
this.field_217429_b.put(p_217424_1_, p_217424_2_);
this.func_72863_F().func_212849_a_(MathHelper.func_76128_c(p_217424_2_.field_70165_t / 16.0D), MathHelper.func_76128_c(p_217424_2_.field_70161_v / 16.0D), ChunkStatus.field_222617_m, true).func_76612_a(p_217424_2_);
@ -33,7 +37,7 @@
}
public void func_217413_d(int p_217413_1_) {
@@ -285,6 +290,7 @@
@@ -285,6 +291,7 @@
}
this.field_217431_w.remove(p_217414_1_);
@ -41,7 +45,7 @@
}
public void func_217417_b(Chunk p_217417_1_) {
@@ -410,6 +416,11 @@
@@ -410,6 +417,11 @@
}
public void func_184148_a(@Nullable PlayerEntity p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_, SoundEvent p_184148_8_, SoundCategory p_184148_9_, float p_184148_10_, float p_184148_11_) {
@ -53,7 +57,7 @@
if (p_184148_1_ == this.field_73037_M.field_71439_g) {
this.func_184134_a(p_184148_2_, p_184148_4_, p_184148_6_, p_184148_8_, p_184148_9_, p_184148_10_, p_184148_11_, false);
}
@@ -417,6 +428,11 @@
@@ -417,6 +429,11 @@
}
public void func_217384_a(@Nullable PlayerEntity p_217384_1_, Entity p_217384_2_, SoundEvent p_217384_3_, SoundCategory p_217384_4_, float p_217384_5_, float p_217384_6_) {

View File

@ -27,15 +27,16 @@
p_184230_1_.func_213829_a(this);
return true;
}
@@ -167,6 +174,7 @@
@@ -167,6 +174,8 @@
LootTable loottable = this.field_70170_p.func_73046_m().func_200249_aQ().func_186521_a(this.field_184290_c);
this.field_184290_c = null;
LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.field_70170_p)).func_216015_a(LootParameters.field_216286_f, new BlockPos(this)).func_216016_a(this.field_184291_d);
+ lootcontext$builder.func_216015_a(LootParameters.field_216281_a, this); // Forge: add looted entity to LootContext
+ // Forge: add this entity to loot context, however, currently Vanilla uses 'this' for the player creating the chests. So we take over 'killer_entity' for this.
+ lootcontext$builder.func_216015_a(LootParameters.field_216284_d, this);
if (p_184288_1_ != null) {
lootcontext$builder.func_186469_a(p_184288_1_.func_184817_da()).func_216015_a(LootParameters.field_216281_a, p_184288_1_);
}
@@ -197,4 +205,17 @@
@@ -197,4 +206,17 @@
}
protected abstract Container func_213968_a(int p_213968_1_, PlayerInventory p_213968_2_);

View File

@ -23,7 +23,7 @@
+ if (event.getResult() == net.minecraftforge.eventbus.api.Event.Result.DENY) return true;
+ if (event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW ||
+ livingentity != null && this.field_70170_p.func_175659_aa() == Difficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e() && this.field_70170_p.func_82736_K().func_82766_b("doMobSpawning")) {
+ ZombieEntity zombieentity = event.getCustomSummonedAid() != null && event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW ? event.getCustomSummonedAid() : new ZombieEntity(this.field_70170_p);
+ ZombieEntity zombieentity = event.getCustomSummonedAid() != null && event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW ? event.getCustomSummonedAid() : EntityType.field_200725_aD.func_200721_a(this.field_70170_p);
+
for(int l = 0; l < 50; ++l) {
int i1 = i + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1);

View File

@ -29,7 +29,7 @@
serverworld.func_195598_a(ParticleTypes.field_218422_X, d4, d5, d6, 2 + this.field_70146_Z.nextInt(2), (double)0.1F, 0.0D, (double)0.1F, 0.0D);
}
}
@@ -357,15 +357,26 @@
@@ -357,6 +357,7 @@
public int func_146034_e(ItemStack p_146034_1_) {
if (!this.field_70170_p.field_72995_K && this.field_146042_b != null) {
int i = 0;
@ -37,15 +37,11 @@
if (this.field_146043_c != null) {
this.func_184527_k();
CriteriaTriggers.field_204811_D.func_204820_a((ServerPlayerEntity)this.field_146042_b, p_146034_1_, this, Collections.emptyList());
this.field_70170_p.func_72960_a(this, (byte)31);
@@ -364,8 +365,15 @@
i = this.field_146043_c instanceof ItemEntity ? 3 : 5;
} else if (this.field_146045_ax > 0) {
- LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.field_70170_p)).func_216015_a(LootParameters.field_216286_f, new BlockPos(this)).func_216015_a(LootParameters.field_216289_i, p_146034_1_).func_216023_a(this.field_70146_Z).func_186469_a((float)this.field_191518_aw + this.field_146042_b.func_184817_da());
+ LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.field_70170_p)).func_216015_a(LootParameters.field_216286_f, new BlockPos(this)).
+ func_216015_a(LootParameters.field_216289_i, p_146034_1_).
+ func_216023_a(this.field_70146_Z).func_186469_a((float)this.field_191518_aw + this.field_146042_b.func_184817_da());
+ lootcontext$builder.func_216015_a(LootParameters.field_216284_d, this.field_146042_b).
+ func_216015_a(LootParameters.field_216281_a,this);
LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.field_70170_p)).func_216015_a(LootParameters.field_216286_f, new BlockPos(this)).func_216015_a(LootParameters.field_216289_i, p_146034_1_).func_216023_a(this.field_70146_Z).func_186469_a((float)this.field_191518_aw + this.field_146042_b.func_184817_da());
+ lootcontext$builder.func_216015_a(LootParameters.field_216284_d, this.field_146042_b).func_216015_a(LootParameters.field_216281_a, this);
LootTable loottable = this.field_70170_p.func_73046_m().func_200249_aQ().func_186521_a(LootTables.field_186387_al);
List<ItemStack> list = loottable.func_216113_a(lootcontext$builder.func_216022_a(LootParameterSets.field_216262_c));
+ event = new net.minecraftforge.event.entity.player.ItemFishedEvent(list, this.field_146051_au ? 2 : 1, this);
@ -57,7 +53,7 @@
CriteriaTriggers.field_204811_D.func_204820_a((ServerPlayerEntity)this.field_146042_b, p_146034_1_, this, list);
for(ItemStack itemstack : list) {
@@ -390,7 +401,7 @@
@@ -390,7 +398,7 @@
}
this.func_70106_y();

View File

@ -1,10 +1,28 @@
--- a/net/minecraft/village/VillageSiege.java
+++ b/net/minecraft/village/VillageSiege.java
@@ -84,6 +84,7 @@
}
@@ -85,6 +85,7 @@
Vec3d vec3d = this.func_179867_a(new BlockPos(this.field_75532_g, this.field_75538_h, this.field_75539_i));
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.village.VillageSiegeEvent(this, field_75537_a, playerentity, vec3d))) return false;
if (vec3d != null) {
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.village.VillageSiegeEvent(this, field_75537_a, playerentity, vec3d))) return false;
break;
}
}
@@ -101,7 +102,7 @@
if (vec3d != null) {
ZombieEntity zombieentity;
try {
- zombieentity = new ZombieEntity(this.field_75537_a);
+ zombieentity = EntityType.field_200725_aD.func_200721_a(this.field_75537_a); //Forge: Direct Initialization is deprecated, use EntityType.
zombieentity.func_213386_a(this.field_75537_a, this.field_75537_a.func_175649_E(new BlockPos(zombieentity)), SpawnReason.EVENT, (ILivingEntityData)null, (CompoundNBT)null);
} catch (Exception exception) {
exception.printStackTrace();
@@ -117,7 +118,7 @@
private Vec3d func_179867_a(BlockPos p_179867_1_) {
for(int i = 0; i < 10; ++i) {
BlockPos blockpos = p_179867_1_.func_177982_a(this.field_75537_a.field_73012_v.nextInt(16) - 8, this.field_75537_a.field_73012_v.nextInt(6) - 3, this.field_75537_a.field_73012_v.nextInt(16) - 8);
- if (this.field_75537_a.func_217483_b_(blockpos) && WorldEntitySpawner.func_209382_a(EntitySpawnPlacementRegistry.PlacementType.ON_GROUND, this.field_75537_a, blockpos, (EntityType<?>)null)) {
+ if (this.field_75537_a.func_217483_b_(blockpos) && WorldEntitySpawner.func_209382_a(EntitySpawnPlacementRegistry.PlacementType.ON_GROUND, this.field_75537_a, blockpos, EntityType.field_200725_aD)) { //Forge: MC-154328 passing in null always returns false, so pass in ZOMBIE
return new Vec3d((double)blockpos.func_177958_n(), (double)blockpos.func_177956_o(), (double)blockpos.func_177952_p());
}
}

View File

@ -197,7 +197,15 @@
IChunk ichunk = this.func_217353_a(MathHelper.func_76128_c(p_72838_1_.field_70165_t / 16.0D), MathHelper.func_76128_c(p_72838_1_.field_70161_v / 16.0D), ChunkStatus.field_222617_m, p_72838_1_.field_98038_p);
if (!(ichunk instanceof Chunk)) {
return false;
@@ -891,11 +911,15 @@
@@ -855,6 +875,7 @@
if (this.func_217478_l(p_217440_1_)) {
return false;
} else {
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_217440_1_, this))) return false;
this.func_217465_m(p_217440_1_);
return true;
}
@@ -891,11 +912,15 @@
}
public void func_217484_g(Entity p_217484_1_) {
@ -214,7 +222,7 @@
this.field_175741_N.remove(p_217484_1_.func_110124_au());
this.func_72863_F().func_217226_b(p_217484_1_);
@@ -909,6 +933,7 @@
@@ -909,6 +934,7 @@
this.field_217495_I.remove(((MobEntity)p_217484_1_).func_70661_as());
}
@ -222,7 +230,7 @@
}
private void func_217465_m(Entity p_217465_1_) {
@@ -929,9 +954,13 @@
@@ -929,9 +955,13 @@
}
}
@ -236,7 +244,7 @@
if (this.field_217492_a) {
throw new IllegalStateException("Removing entity while ticking!");
} else {
@@ -950,7 +979,10 @@
@@ -950,7 +980,10 @@
}
public void func_217434_e(ServerPlayerEntity p_217434_1_) {
@ -248,7 +256,7 @@
this.func_217467_h(p_217434_1_);
this.func_72854_c();
}
@@ -975,10 +1007,20 @@
@@ -975,10 +1008,20 @@
}
public void func_184148_a(@Nullable PlayerEntity p_184148_1_, double p_184148_2_, double p_184148_4_, double p_184148_6_, SoundEvent p_184148_8_, SoundCategory p_184148_9_, float p_184148_10_, float p_184148_11_) {
@ -269,7 +277,7 @@
this.field_73061_a.func_184103_al().func_148543_a(p_217384_1_, p_217384_2_.field_70165_t, p_217384_2_.field_70163_u, p_217384_2_.field_70161_v, p_217384_5_ > 1.0F ? (double)(16.0F * p_217384_5_) : 16.0D, this.field_73011_w.func_186058_p(), new SSpawnMovingSoundEffectPacket(p_217384_3_, p_217384_4_, p_217384_2_, p_217384_5_, p_217384_6_));
}
@@ -1014,6 +1056,7 @@
@@ -1014,6 +1057,7 @@
public Explosion func_217401_a(@Nullable Entity p_217401_1_, DamageSource p_217401_2_, double p_217401_3_, double p_217401_5_, double p_217401_7_, float p_217401_9_, boolean p_217401_10_, Explosion.Mode p_217401_11_) {
Explosion explosion = new Explosion(this, p_217401_1_, p_217401_3_, p_217401_5_, p_217401_7_, p_217401_9_, p_217401_10_, p_217401_11_);
@ -277,7 +285,7 @@
if (p_217401_2_ != null) {
explosion.func_199592_a(p_217401_2_);
}
@@ -1264,4 +1307,15 @@
@@ -1264,4 +1308,15 @@
public void func_217489_a(IReputationType p_217489_1_, Entity p_217489_2_, IReputationTracking p_217489_3_) {
p_217489_3_.func_213739_a(p_217489_1_, p_217489_2_);
}

View File

@ -0,0 +1,11 @@
--- a/net/minecraft/world/gen/feature/structure/MineshaftPieces.java
+++ b/net/minecraft/world/gen/feature/structure/MineshaftPieces.java
@@ -206,7 +206,7 @@
protected boolean func_186167_a(IWorld p_186167_1_, MutableBoundingBox p_186167_2_, Random p_186167_3_, int p_186167_4_, int p_186167_5_, int p_186167_6_, ResourceLocation p_186167_7_) {
BlockPos blockpos = new BlockPos(this.func_74865_a(p_186167_4_, p_186167_6_), this.func_74862_a(p_186167_5_), this.func_74873_b(p_186167_4_, p_186167_6_));
- if (p_186167_2_.func_175898_b(blockpos) && p_186167_1_.func_180495_p(blockpos).func_196958_f() && !p_186167_1_.func_180495_p(blockpos.func_177977_b()).func_196958_f()) {
+ if (p_186167_2_.func_175898_b(blockpos) && p_186167_1_.func_180495_p(blockpos).isAir(p_186167_1_, blockpos) && !p_186167_1_.func_180495_p(blockpos.func_177977_b()).isAir(p_186167_1_, blockpos.func_177977_b())) {
BlockState blockstate = Blocks.field_150448_aq.func_176223_P().func_206870_a(RailBlock.field_176565_b, p_186167_3_.nextBoolean() ? RailShape.NORTH_SOUTH : RailShape.EAST_WEST);
this.func_175811_a(p_186167_1_, blockstate, p_186167_4_, p_186167_5_, p_186167_6_, p_186167_2_);
ChestMinecartEntity chestminecartentity = new ChestMinecartEntity(p_186167_1_.func_201672_e(), (double)((float)blockpos.func_177958_n() + 0.5F), (double)((float)blockpos.func_177956_o() + 0.5F), (double)((float)blockpos.func_177952_p() + 0.5F));

View File

@ -0,0 +1,14 @@
--- a/net/minecraft/world/storage/loot/LootParameterSets.java
+++ b/net/minecraft/world/storage/loot/LootParameterSets.java
@@ -12,9 +12,11 @@
});
public static final LootParameterSet field_216261_b = func_216253_a("chest", (p_216259_0_) -> {
p_216259_0_.func_216269_a(LootParameters.field_216286_f).func_216271_b(LootParameters.field_216281_a);
+ p_216259_0_.func_216271_b(LootParameters.field_216284_d); //Forge: Chest Minecarts can have killers.
});
public static final LootParameterSet field_216262_c = func_216253_a("fishing", (p_216250_0_) -> {
p_216250_0_.func_216269_a(LootParameters.field_216286_f).func_216269_a(LootParameters.field_216289_i);
+ p_216250_0_.func_216271_b(LootParameters.field_216284_d).func_216271_b(LootParameters.field_216281_a); //Forge: Allow fisher, and bobber
});
public static final LootParameterSet field_216263_d = func_216253_a("entity", (p_216254_0_) -> {
p_216254_0_.func_216269_a(LootParameters.field_216281_a).func_216269_a(LootParameters.field_216286_f).func_216269_a(LootParameters.field_216283_c).func_216271_b(LootParameters.field_216284_d).func_216271_b(LootParameters.field_216285_e).func_216271_b(LootParameters.field_216282_b);