Add ChunkStatusChangeEvent#9921
Conversation
Chunk Statuses are a wily thing, but it is nice to know when the state of one changes for concept like lazy-loading, etc. I'm not sure this event should ever be anything other than read-only but this basic version has worked well for me for awhile.
| + public enum ChunkStatus { | ||
| + INACCESSIBLE, | ||
| + FULL, | ||
| + BLOCK_TICKING, | ||
| + ENTITY_TICKING; | ||
| + } |
There was a problem hiding this comment.
Cant we use Chunk$LoadLevel?
There was a problem hiding this comment.
kinda, but they messed up the order of them so it breaks the nice ordinal thing
There was a problem hiding this comment.
Yeah, was nice for the isUpgrade() method
| new file mode 100644 | ||
| index 0000000000000000000000000000000000000000..7d446b6219f425aabdb6a7fbb587f89e8a0f23d8 | ||
| --- /dev/null | ||
| +++ b/src/main/java/io/papermc/paper/chunk/ChunkStatusChangeEvent.java |
There was a problem hiding this comment.
wrong package. you are missing a /event. i think this could go into io.papermc.paper.event.world or a sub-package of that
|
The event is fired incorrectly. The chunk system changes the chunk status incrementally, and carefully handles concurrent requests to lower it. It is possible that the overall result of the operation is to lower the status, even if initially it was requested to be higher. You can see this by how the function You should look more carefully at the operations done in each status change to determine where to place the event. In general this area of code is the worst part of the chunk system and needs to be refactored, so it may not be possible to actually place an event in there without causing issues. |
I do see lower in |
…ting, potentially changed nextState
|
Hello, does any change are needed for this before being merged ? If yes, i can take time to do it. |
Chunk Statuses are a wily thing, but it is nice to know when the state of one changes for concept like lazy-loading, etc.
I'm not sure this event should ever be anything other than read-only but this basic version has worked well for me for awhile.