-
-
Notifications
You must be signed in to change notification settings - Fork 343
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
Rework ChunkEvent #2497
Conversation
src/main/java/org/spongepowered/api/event/world/chunk/ChunkEvent.java
Outdated
Show resolved
Hide resolved
|
||
import org.spongepowered.api.world.volume.block.BlockVolume; | ||
|
||
public interface BlockChunk extends BlockVolume { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
* 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 { |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
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.