ForgePatch/patches/minecraft/net/minecraft/world/Explosion.java.patch

68 lines
3.8 KiB
Diff

--- a/net/minecraft/world/Explosion.java
+++ b/net/minecraft/world/Explosion.java
@@ -57,6 +57,7 @@
private final IExplosionContext field_234893_k_;
private final List<BlockPos> field_77281_g = Lists.newArrayList();
private final Map<PlayerEntity, Vector3d> field_77288_k = Maps.newHashMap();
+ private final Vector3d position;
@OnlyIn(Dist.CLIENT)
public Explosion(World p_i45752_1_, @Nullable Entity p_i45752_2_, double p_i45752_3_, double p_i45752_5_, double p_i45752_7_, float p_i45752_9_, List<BlockPos> p_i45752_10_) {
@@ -85,6 +86,7 @@
this.field_222260_b = p_i231610_13_;
this.field_199593_j = p_i231610_3_ == null ? DamageSource.func_94539_a(this) : p_i231610_3_;
this.field_234893_k_ = p_i231610_4_ == null ? this.func_234894_a_(p_i231610_2_) : p_i231610_4_;
+ this.position = new Vector3d(this.field_77284_b, this.field_77285_c, this.field_77282_d);
}
private IExplosionContext func_234894_a_(@Nullable Entity p_234894_1_) {
@@ -175,6 +177,7 @@
int j2 = MathHelper.func_76128_c(this.field_77282_d - (double)f2 - 1.0D);
int j1 = MathHelper.func_76128_c(this.field_77282_d + (double)f2 + 1.0D);
List<Entity> list = this.field_77287_j.func_72839_b(this.field_77283_e, new AxisAlignedBB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1));
+ net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate(this.field_77287_j, this, list, f2);
Vector3d vector3d = new Vector3d(this.field_77284_b, this.field_77285_c, this.field_77282_d);
for(int k2 = 0; k2 < list.size(); ++k2) {
@@ -233,11 +236,11 @@
for(BlockPos blockpos : this.field_77281_g) {
BlockState blockstate = this.field_77287_j.func_180495_p(blockpos);
Block block = blockstate.func_177230_c();
- if (!blockstate.func_196958_f()) {
+ if (!blockstate.isAir(this.field_77287_j, blockpos)) {
BlockPos blockpos1 = blockpos.func_185334_h();
this.field_77287_j.func_217381_Z().func_76320_a("explosion_blocks");
- if (block.func_149659_a(this) && this.field_77287_j instanceof ServerWorld) {
- TileEntity tileentity = block.func_235695_q_() ? this.field_77287_j.func_175625_s(blockpos) : null;
+ if (blockstate.canDropFromExplosion(this.field_77287_j, blockpos, this) && this.field_77287_j instanceof ServerWorld) {
+ TileEntity tileentity = blockstate.hasTileEntity() ? this.field_77287_j.func_175625_s(blockpos) : null;
LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerWorld)this.field_77287_j)).func_216023_a(this.field_77287_j.field_73012_v).func_216015_a(LootParameters.field_216286_f, blockpos).func_216015_a(LootParameters.field_216289_i, ItemStack.field_190927_a).func_216021_b(LootParameters.field_216288_h, tileentity).func_216021_b(LootParameters.field_216281_a, this.field_77283_e);
if (this.field_222260_b == Explosion.Mode.DESTROY) {
lootcontext$builder.func_216015_a(LootParameters.field_216290_j, this.field_77280_f);
@@ -248,8 +251,7 @@
});
}
- this.field_77287_j.func_180501_a(blockpos, Blocks.field_150350_a.func_176223_P(), 3);
- block.func_180652_a(this.field_77287_j, blockpos, this);
+ blockstate.onBlockExploded(this.field_77287_j, blockpos, this);
this.field_77287_j.func_217381_Z().func_76319_b();
}
}
@@ -323,6 +325,15 @@
return this.field_77281_g;
}
+ public Vector3d getPosition() {
+ return this.position;
+ }
+
+ @Nullable
+ public Entity getExploder() {
+ return this.field_77283_e;
+ }
+
public static enum Mode {
NONE,
BREAK,