Posted May 20, 20187 yr In my mod, I have scripts for initializing and updating the database it will be using as separate resources. They are all in the same folder and named with <number>.sql Now, I can access any of them with new ResourceLocation("modid", "sql/1.sql"); The issue is that this list of files may grow and it'd be preferable to iterate over these files. Is there a way to get how many files are in that sql folder?
May 20, 20187 yr Minecraft is using normal Java, so just Google search for information on Java file functions. All of those are available to you. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
May 20, 20187 yr You probably want a custom location in the config folder to make it dynamic. Scanner objects in Java can help you with the parsing.
May 20, 20187 yr Author I think I got it. I tossed out using Forge's resource loader for Java's. I can get the folder as a File object, and then I can get an array of files contained by the folder, which gives me a count of the schema revisions in the app. Then it's simply a matter of iterating through the files in that folder in numeric order and running the SQL scripts against the database.
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.