[1.19.x] Particle Description Data Provider #9510
Merged
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 a data provider to generate
ParticleDescription
s.The provider contains two types of methods towards generating a description:
#sprite
for when the description only has one particle texture, and#spriteSet
for multiple particle textures. Each method takes in aParticleType
the textures are provided for. The#sprite
method takes in a singleResourceLocation
representing the texture within thetextures/particle
directory.The
#spriteSet
method has three overloads. The base method takes in anIterable
ofResourceLocation
s. The iterable acts as an easy way to collect textures either from a collection or a stream. The next method takes in varargs, with at least oneResourceLocation
that needs to be provided. The final method acts as a simple generator to apply a numbered suffix to a particle texture. This is in correspondence with most of Minecraft's particle texture naming scheme. All textures are validated, and the type must have been registered.A validation case was added to
DataGeneratorTest
, generating four vanilla particles and validating them against what vanilla provides. To test this, you will need to comment out theSoundDefinitionsProvider
as it currently throws an error. The fix is outside the scope of this PR, as there are additional changes that need to be applied to the provider in general.