Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChunkListener::onBlockChanged() to accept 3 integers instead of Vector3 #6164

Open
dktapps opened this issue Nov 17, 2023 · 1 comment
Open
Labels
BC break Breaks API compatibility Category: API Related to the plugin API Performance Type: Enhancement Contributes features or other improvements to PocketMine-MP

Comments

@dktapps
Copy link
Member

dktapps commented Nov 17, 2023

Description

Vector3 is both slower and more inconvenient for this purpose.

setBlockAt() currently has to allocate a Vector3 for this purpose alone (well, there's also createBlockUpdatePackets(), but that could be avoided too). Vector3 is inconvenient since it might contain float components, forcing the use of getFloorX() and friends.

Since we already use integers for this internally, it probably makes sense to do the same for onBlockChanged() too.

Alternative methods

@dktapps dktapps added Category: API Related to the plugin API BC break Breaks API compatibility Type: Enhancement Contributes features or other improvements to PocketMine-MP labels Nov 17, 2023
@dktapps
Copy link
Member Author

dktapps commented Nov 17, 2023

It might also be beneficial to add a way for ChunkListeners to hear about multiple block updates at once, which would permit things like this to be moved into the network system where they belong.

BajanVlogs added a commit to BajanVlogs/PocketMine-MP that referenced this issue Jan 30, 2024
This modified code groups block updates based on the chunk they belong to before processing them. It aims to improve efficiency by minimizing redundant operations and sending fewer packets when updating multiple blocks within the same chunk. Keep in mind that the effectiveness of this optimization may vary based on the specific characteristics of your server and its usage patterns.
BajanVlogs added a commit to BajanVlogs/PocketMine-MP that referenced this issue Jan 30, 2024
This modified code groups block updates based on the chunk they belong to before processing them. It aims to improve efficiency by minimizing redundant operations and sending fewer packets when updating multiple blocks within the same chunk. Keep in mind that the effectiveness of this optimization may vary based on the specific characteristics of your server and its usage patterns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BC break Breaks API compatibility Category: API Related to the plugin API Performance Type: Enhancement Contributes features or other improvements to PocketMine-MP
Projects
None yet
Development

No branches or pull requests

1 participant