Add data fields to particles - #4
Closed
neeleshpoli wants to merge 2 commits into
Closed
Conversation
- Create spawn functions for each of the particles - For particles with data, create a resource for that particle - Remove general spawn particles function
Author
|
Didn't realize that I actually didn't need to open this PR. Didn't know GitHub automatically handled the submodule as well in the main PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds particle data to all the particles, except the vibration and item particles (these particles are pretty complex, so these weren't handled for now).
On the rust side, a struct is created for each particle, and they all implement a common trait. However, WIT doesn't support generics or polymorphism. To get around this, spawn functions for each type of particle are created and handle the particle spawning stuff on the rust side.
For particles with data, resources are created with a constructor to initialize fields, and the spawn functions take a reference to the resource. For field less particles, only basic spawn parameters are required.
The particle spawn functions are in the particles interface instead of the world, to keep the world interface cleaner. This is all automatically generated by
pumpkin-codegen.This PR is a part of Pumpkin-MC/Pumpkin#2279.