SPIGOT-7617: Add BlockExplodeEvent#getExplodedBlockState()
By: 2008Choco <hawkeboyz2@hotmail.com>
This commit is contained in:
@@ -116,7 +116,7 @@
|
||||
entity.setDeltaMovement(entity.getDeltaMovement().add(vec3d1));
|
||||
if (entity instanceof EntityHuman) {
|
||||
EntityHuman entityhuman = (EntityHuman) entity;
|
||||
@@ -290,9 +349,63 @@
|
||||
@@ -290,9 +349,65 @@
|
||||
|
||||
SystemUtils.shuffle(this.toBlow, this.level.random);
|
||||
ObjectListIterator objectlistiterator = this.toBlow.iterator();
|
||||
@@ -143,7 +143,9 @@
|
||||
+ bukkitBlocks = event.blockList();
|
||||
+ this.yield = event.getYield();
|
||||
+ } else {
|
||||
+ BlockExplodeEvent event = new BlockExplodeEvent(location.getBlock(), blockList, this.yield);
|
||||
+ org.bukkit.block.Block block = location.getBlock();
|
||||
+ org.bukkit.block.BlockState blockState = (damageSource.blockState != null) ? damageSource.blockState : block.getState();
|
||||
+ BlockExplodeEvent event = new BlockExplodeEvent(block, blockState, blockList, this.yield);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.wasCanceled = event.isCancelled();
|
||||
+ bukkitBlocks = event.blockList();
|
||||
@@ -180,7 +182,7 @@
|
||||
|
||||
this.level.getBlockState(blockposition).onExplosionHit(this.level, blockposition, this, (itemstack, blockposition1) -> {
|
||||
addOrAppendStack(list, itemstack, blockposition1);
|
||||
@@ -317,7 +430,11 @@
|
||||
@@ -317,7 +432,11 @@
|
||||
BlockPosition blockposition1 = (BlockPosition) objectlistiterator1.next();
|
||||
|
||||
if (this.random.nextInt(3) == 0 && this.level.getBlockState(blockposition1).isAir() && this.level.getBlockState(blockposition1.below()).isSolidRender(this.level, blockposition1.below())) {
|
||||
@@ -193,7 +195,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -325,6 +442,7 @@
|
||||
@@ -325,6 +444,7 @@
|
||||
}
|
||||
|
||||
private static void addOrAppendStack(List<Pair<ItemStack, BlockPosition>> list, ItemStack itemstack, BlockPosition blockposition) {
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
+
|
||||
+ Vec3D vec3d = blockposition.getCenter();
|
||||
+
|
||||
+ world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, World.a.BLOCK);
|
||||
+ world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, world, iblockdata, blockposition), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, World.a.BLOCK); // CraftBukkit - add state
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
@@ -26,3 +26,12 @@
|
||||
@Override
|
||||
public Optional<Float> getBlockExplosionResistance(Explosion explosion, IBlockAccess iblockaccess, BlockPosition blockposition1, IBlockData iblockdata1, Fluid fluid) {
|
||||
return blockposition1.equals(blockposition) && flag1 ? Optional.of(Blocks.WATER.getExplosionResistance()) : super.getBlockExplosionResistance(explosion, iblockaccess, blockposition1, iblockdata1, fluid);
|
||||
@@ -144,7 +144,7 @@
|
||||
};
|
||||
Vec3D vec3d = blockposition.getCenter();
|
||||
|
||||
- world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d), explosiondamagecalculator, vec3d, 5.0F, true, World.a.BLOCK);
|
||||
+ world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, world, iblockdata, blockposition), explosiondamagecalculator, vec3d, 5.0F, true, World.a.BLOCK); // CraftBukkit - add state
|
||||
}
|
||||
|
||||
public static boolean canSetSpawn(World world) {
|
||||
|
||||
Reference in New Issue
Block a user