Posted July 27, 201312 yr Before I start rolling my own code, I thought I'd ask to make sure I'm not re-inventing the wheel. Is there an easy way (aka, a pre-existing function/class/method) for checking if an icon or texture file exists before registering it? The use case I'm looking at is where my mod has a custom tool (call it cTool), and during postInit, the mod checks to see if any other mods have added custom tool materials. If so, my mod then auto-generates more cTools made with the added custom materials. These auto-generated cTools need icons; if I've heard of the mod, I may have already created an icon for custom-material cTool; if so, all well and good. However, if I haven't, I'd like the option to fall back to some generic-looking icon rather than tossing up a "Missing Texture" icon. Stuff I maintain: https://minecraft.curseforge.com/members/sinhika/projects Repositories: https://github.com/Sinhika?tab=repositories
July 27, 201312 yr If you can already check for materials, and if you know what textures you already made, why do you need another check ? Just give your generic icon to any tool left.
July 27, 201312 yr Author Actually, my mod does not "know" what textures exist; it just blithely assumes that when it synthesizes a texture name from material & tool suffix, then that texture exists. Is there a handy way to enumerate over the contents of an assets directory? Stuff I maintain: https://minecraft.curseforge.com/members/sinhika/projects Repositories: https://github.com/Sinhika?tab=repositories
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.