Skip to content

Add data fields to particles - #4

Closed
neeleshpoli wants to merge 2 commits into
Pumpkin-MC:masterfrom
neeleshpoli:master
Closed

Add data fields to particles#4
neeleshpoli wants to merge 2 commits into
Pumpkin-MC:masterfrom
neeleshpoli:master

Conversation

@neeleshpoli

Copy link
Copy Markdown

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.

- Create spawn functions for each of the particles
- For particles with data, create a resource for that particle
- Remove general spawn particles function
@neeleshpoli

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant