Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

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.

  • 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?

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.