Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Track block changes made with direct calls to
LevelChunk#setBlockState
.Fixes the third point in #3811.
I made some tests with worldedit-forge and a small test plugin I wrote:
The event is fired correctly and all transactions are grouped into a single event with the worldedit command being the root cause. Cancelling the event, properly cancels block changes.
To have an idea of the performance impact, I selected a 100x100x100 area (1 million blocks) and I measured the average time for command
//set 33%granite,33%stone,33%andesite
to execute on my computer.With Sponge: ~5.5s
Without Sponge: ~3.2s
It is a very imprecise benchmark but it shows the order of magnitude of the tracking overhead.
The performance impact is significant but IMO tolerable for now.