Chisel icon indicating copy to clipboard operation
Chisel copied to clipboard

Change file names to match [a-z0-9/._-], to prevent ResourceLocationExceptions

Open aaronhowser1 opened this issue 4 years ago • 4 comments

FTB Quests gets this error, stopping me from loading a list of textures:

[03:47:42] [Render thread/ERROR] [FTB Quests/]: A mod has broken resource preventing this list from loading: net.minecraft.util.ResourceLocationException: Non [a-z0-9/._-] character in path of location: chisel:textures/block/redstoneLamp/redstone_lamp_on.png

The mod dev has said that this is more stopping Minecraft from crashing than an arbitrary limitation on the mod's end.

aaronhowser1 avatar Jul 07 '21 08:07 aaronhowser1

That texture is never used, just exclude it from whatever list you're creating.

tterrag1098 avatar Jul 11 '21 02:07 tterrag1098

Minecraft still picks it up and crashes internally, even with validation. The code im using is

images.addAll(Minecraft.getInstance().getResourceManager().listResources("textures", t -> t.endsWith(".png") && ResourceLocation.isValidResourceLocation(t)));

Renaming it from redstoneLamp to redstone_lamp is all that needs to be done

LatvianModder avatar Jul 11 '21 08:07 LatvianModder

But why are you doing that at all? I don't see the purpose of gathering all textures. It doesn't crash with only chisel. I'll fix the names when I implement those blocks.

tterrag1098 avatar Jul 11 '21 14:07 tterrag1098

It's to let quest devs use images without having to type in the entire name of the resource location.

That lets us add images via KubeJS etc, and then insert them into quests with a GUI image

This GUI usually has a list of all textures, but breaks when something doesn't follow the correct regex. image

aaronhowser1 avatar Jul 12 '21 04:07 aaronhowser1