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

Rework ChunkEvent #2497

Merged
merged 2 commits into from
Apr 29, 2024
Merged

Rework ChunkEvent #2497

merged 2 commits into from
Apr 29, 2024

Conversation

aromaa
Copy link
Member

@aromaa aromaa commented Apr 25, 2024

Sponge | SpongeAPI

Reworks the ChunkEvent events to take in account that vanilla has split the block and entity storage. I kept the BlockChunk as read-only because it needs more work to implement to be able to mutate it at that state, likely not something we are going to address anytime soon.


import org.spongepowered.api.world.volume.block.BlockVolume;

public interface BlockChunk extends BlockVolume {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the significance of this? Why not just a BlockVolume?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to align with the EntityChunk and it allows us to easily change it to be BlockVolume.Modifiable in the future without it being binary breaking change.

/**
* An entity chunk is a portion of a {@link WorldChunk}.
*/
public interface EntityChunk extends EntityVolume.Modifiable<EntityChunk> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may as well split modifiable if it means it's not spawnable, or am I missing something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entities are modifiable, thats implemented. Blocks are special case due to all of your pipeline tracking and its not obvious how we would want to alter that to make it possible.

Comment on lines +127 to +131
* It is NOT safe to perform modifications to the {@link World} or via
* {@link org.spongepowered.api.world.server.ServerLocation} as this could
* result in a deadlock.
*/
interface Load extends Entities {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the rammification of calling spawnEntity on the EntityChunk?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That works and is safe. The entity is appended to be part of the list of entities to be loaded.

@aromaa aromaa merged commit d5a46ad into api-11 Apr 29, 2024
9 checks passed
@aromaa aromaa deleted the api11/chunk-events branch April 29, 2024 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants