MehVahdJukaar/polytone

Custom particles cannot parse custom colormaps

Closed this issue · 3 comments

Polytone version: v1.21-2.2.9

In my custom resource pack, I have the following files:

  • /assets/minecraft/particles/warped_nylium.json:
{
    "textures": [
        "generic_0"
    ]
}
  • /assets/minecraft/polytone/custom_particles/warped_nylium.json:
{
    "initializer": {
        "size": "rand() * 0.2 + 0.9",
        "lifetime": "10 + rand() * 20",
        "friction": "0.5",
        "has_physics": false,
        "colormap": "warped_colors"
    }
}
  • /assets/minecraft/polytone/colormaps/warped_colors.json (along with its corresponding warped_colors.png):
{
    "x_axis": "rand()",
    "y_axis": "0",
    "default_color": 276117,
    "triangular": false,
    "biome_blend": false
}

The resurce pack failed to load, however. Here are the contents of the generated polytone.log file:

[2024-07-31 13:42:09] Custom particles Reloader failed to parse some resources. Check lines below to see where the error was:
java.lang.IllegalStateException: Could not decode Custom Particle with json id minecraft:warped_nylium
 error: Failed to parse either. First: Failed to parse either. First: Not a number: "warped_colors"; Second: Invalid color format. Hex value must have up to 8 characters.; Second: Could not find any entry with key 'minecraft:warped_colors' in registry [Polytone Colormaps] 
 Known keys: [minecraft:grass_color, minecraft:foliage_color, minecraft:water_color, minecraft:biome_sample, minecraft:triangular_biome_sample, minecraft:fixed, minecraft:grid, minecraft:damage]
	at net.mehvahdjukaar.polytone.particle.CustomParticlesManager.lambda$process$2(CustomParticlesManager.java:54)
	at com.mojang.serialization.DataResult$Error.getOrThrow(DataResult.java:287)
	at net.mehvahdjukaar.polytone.particle.CustomParticlesManager.process(CustomParticlesManager.java:54)
	at net.mehvahdjukaar.polytone.particle.CustomParticlesManager.process(CustomParticlesManager.java:18)
	at net.mehvahdjukaar.polytone.utils.CompoundReloader.processTyped(CompoundReloader.java:86)
	at net.mehvahdjukaar.polytone.utils.CompoundReloader.apply(CompoundReloader.java:43)
	at net.mehvahdjukaar.polytone.utils.CompoundReloader.method_18788(CompoundReloader.java:15)
	at net.minecraft.class_4080.method_18790(class_4080.java:13)
	at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718)
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
	at net.minecraft.class_4014.method_18365(class_4014.java:69)
	at net.minecraft.class_1255.method_18859(class_1255.java:162)
	at net.minecraft.class_4093.method_18859(class_4093.java:23)
	at net.minecraft.class_1255.method_16075(class_1255.java:136)
	at net.minecraft.class_1255.method_5383(class_1255.java:121)
	at net.minecraft.class_310.method_1523(class_310.java:1240)
	at net.minecraft.class_310.method_1514(class_310.java:882)
	at net.minecraft.client.main.Main.main(Main.java:256)
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:480)
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
	at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:100)
	at org.prismlauncher.EntryPoint.listen(EntryPoint.java:129)
	at org.prismlauncher.EntryPoint.main(EntryPoint.java:70)

What I can gather from reading this log file is that the custom particle failed to parse the custom colormap for one reason or another. Interestingly, however, this colormap is also used by a particle modifier for a vanilla particle effect, and that does seem to be able to parse it correctly, meaning this might be an issue with the colormap property on custom particles.

thats odd, i see its complaining about the colormap not existing but the one at the path youwrote is exactly that. Ill do some testing, maybe its I have made these particle modifiers load before colormaps

Thank you for looking into this.

this should be solved