Block breaking procedure with particles but no drop

Submitted by _chuchu_ on Sun, 04/07/2019 - 09:01
Upvotes: 4
Issue description

I remember before the procedures existed, there was an event to break a block with showing particles of it, but no drops.

Unfortunately, I don't see it anywhere in the procedures.

Could be nice to add back this procedure since it was kinda nice to make block breaking a little less "disappear out of nowhere" feeling when using a procedure to remove a block.

Issue comments

Submitted by Klemen on Sun, 04/07/2019 - 10:05

We will add new procedure block called spawn break particles of the block at x,y,z, so one can call this first and then call block removal procedure.

For the ones who use code, a sample way how to do this is here:

IBlockState blockstate = this.world.getBlockState(new BlockPos(i, j, k));
if (blockstate.getMaterial() != Material.AIR) {
    this.world.spawnParticle(EnumParticleTypes.BLOCK_CRACK, this.posX + ((double)world.rand.nextFloat() - 0.5D) * (double)this.width, this.getEntityBoundingBox().minY + 0.1D, this.posZ + ((double)world.rand.nextFloat() - 0.5D) * (double)this.width, 4.0D * ((double)world.rand.nextFloat() - 0.5D), 0.5D, ((double)world.rand.nextFloat() - 0.5D) * 4.0D, Block.getStateId(blockstate));
}