Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • How to get list of filenames in directory in resources
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
hohserg

How to get list of filenames in directory in resources

By hohserg, July 28, 2020 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

hohserg    3

hohserg

hohserg    3

  • Tree Puncher
  • hohserg
  • Members
  • 3
  • 39 posts
Posted July 28, 2020

I try answer from stackoverflow: https://stackoverflow.com/questions/3923129/get-a-list-of-resources-from-classpath-directory

And it work correctly when I run game from my IDE(Intellij Idea).

But when I build mod, put jar in /mods/ and run Minecraft from launcher, it method give empty filelist. Hovewer, content of files in folder are load fine.

What is true way to get list of files in directory in resources?

Thx in advance!

  • Quote

Share this post


Link to post
Share on other sites

Novârch    31

Novârch

Novârch    31

  • Diamond Finder
  • Novârch
  • Members
  • 31
  • 422 posts
Posted July 28, 2020

Why? In the context of modding you should be using ResourceLocation and inputting the path manually.

  • Quote

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

Share this post


Link to post
Share on other sites

diesieben07    7582

diesieben07

diesieben07    7582

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7582
  • 54901 posts
Posted July 28, 2020

Use the built-in resource system. Mainly IResourceManager#getAllResourceLocations.

But yes, re-think if you actually need this.

  • Like 1
  • Quote

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • diesieben07
      [1.16] Custom Sign won't render

      By diesieben07 · Posted 5 minutes ago

      Probably. Vanilla loves hardcoding things. Would be best to see a Git repo of your mod so I can use the debugger.
    • diesieben07
      Cant Get a Config File Working 1.16.5

      By diesieben07 · Posted 5 minutes ago

      You can disable their crafting recipes and remove the from any creative tab.
    • kiou.23
      [1.16] Custom Sign won't render

      By kiou.23 · Posted 7 minutes ago

      I'll try it (Edit: nvm, no idea how to try it, and it may not even work) there seems to be another problem tho: I changed the wood type of the sign to OAK, just to see if it rendered with a vanilla wood type, and nope. it's still invisible. however, the edit screen has the oak sign texture (it still only stays up for milliseconds) this has to be related to something else, right?
    • Bailym
      Cant Get a Config File Working 1.16.5

      By Bailym · Posted 7 minutes ago

      Thanks for the info! I'll look into the CommonSetup stage.   Yes I was intending to only register items with true values.What's the alternative?  Is there some other way to make items unavailable in game other than just not registering them?   Thanks for the help!
    • diesieben07
      Cant Get a Config File Working 1.16.5

      By diesieben07 · Posted 14 minutes ago

      Config files are not loaded that early on purpose. They are only available from FMLCommonSetupEvent and later. From your config names I guess you want to conditionally register your items - this is a big reason why config files are not available that early. Do not conditionally register things. Always register all your items, blocks, etc.
  • Topics

    • kiou.23
      7
      [1.16] Custom Sign won't render

      By kiou.23
      Started 8 hours ago

    • Bailym
      3
      Cant Get a Config File Working 1.16.5

      By Bailym
      Started 22 minutes ago

    • e2rifia
      3
      (1.16.2) How do I use onPlayerTick?

      By e2rifia
      Started 2 hours ago

    • Linky132
      2
      [1.16.4] Block not rendering as transparent

      By Linky132
      Started Thursday at 04:28 PM

    • arkeN
      50
      Failure message: Missing License Information in file Mod File

      By arkeN
      Started October 11, 2020

  • Who's Online (See full list)

    • scrouthtv
    • loordgek
    • samyakforever
    • diesieben07
    • kiou.23
    • vemerion
    • Beethoven92
    • Veo
    • e2rifia
    • Bailym
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • How to get list of filenames in directory in resources
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community