Closed Nusiq closed 1 month ago
I also noticed that currently Snowstorm searches for particles
folder using the path_arr.indexOf('particles')
. This might cause unexpected issues, when there is multiple 'particles'
in the path.
I think it's not that improbable that someone would create a project called 'particles'
and have a resource pack in that project. In that case the path to a particle file could look like:
C:/particles/RP/particles/my_particle.json
In that case Snowstorm would incorrectly, expect the texture file to be in C:/particless/some/path/some_texture.png
.I didn't implement that change in my PR but I suggest to switching to lastIndexOf
.
This also applies to saving textures, which I think is a new feature of Snowstorm (?).
This PR adds additional potential paths to check when looking for textures.
Current Situation
In the current version of Snowstorm, the textures can be located in two places, in relation to the path of the particle file. The selection of the path to check depends on the existence of the folder called "particles" in the path of the particle file.
A) If the path contains the "particles" folder, then Snowstorm looks for the texture in the subdirectory of that path's parent (using the path specified in the particle file).
This is the best solution if someone is working in a resource pack.
B) If the path doesn't contain "particles" folder, then Snowstorm looks in the same directory as the particle file.
Snowstorm never checks both of the paths.
Changes Implemented in this PR
I suggest 2 changes: A) Always check all potential texture path candidates when searching for the texture (with some candidates having priority over others). B) Add a new texture file candidate - the texture file, with the name that matches the name of the texture specified in the particle file, and in the same directory as that particle file.
This enables working in a simplified project structure where the particle files are kept in the same location as the texture they use. For example: