Simulate block breaking for use with events.
ChiefLogan3010 opened this issue ยท 1 comments
Describe the feature you'd like
I'd like for there to be a way of simulating block breaking with CT so that the breaking animation and particles are used. I imagine this would fall under Level looking something like:
level.breakBlock(pos as BlockPos, miningSpeed as Int, toolAction as String, doDrops as boolean);
//the below will break the block at blockPos with an axe of mining speed 8 (diamond tier)
level.breakBlock(blockPos, 8, "axe", true);
I'm unsure if this would suit better as an expansion of .destroyBlock since that works instantly, and would likely cause issues for any scripts already using it.
Describe alternatives you've considered
Can use sequences to somewhat simulate this, letting the world tick for x ticks before using .destroyBlock or .setBlockAndUpdate, but this does not indicate anything to the player while the breaking is happening, such as the block particles or breaking animation.
Additional context
Requested version is 1.19.2, but that's not shown in the list below.
Minecraft version
1.19
Modloader
Forge
Unfortunately I am not going to be backporting this to 1.19.2, I understand that may be frustrating and I'm sorry it took me so long to get to this.
What I've added is ```
level.destroyBlockProgress(id, pos, progress);
`id` is the id of the breaking progress, there can only be one "progress" per `id`, vanilla uses the entity id that is breaking the block, so I would recommend using a negative number to ensure that there are no overlaps with ids.
You will still need to use sequences to actually simulate the block breaking, and combine the new method with spawning the particles yourself.