planetguy Posted August 30, 2013 Share Posted August 30, 2013 Some background: Since my mod, Gizmos, can be horribly destructive to servers but also quite useful, I wanted to make a system whereby any component can be turned off as desired by admins. At first I set up a "loader node" class for each component of the mod, but that system requires so much boilerplate that some times, I just don't want to bother adding a feature because of it. Recently I decided that the present system has to go. To make a new system, I figured I'd make something based on annotations: plop a @GizmosModule("name") onto a block/item/tile entity class and it will automatically create the necessary config properties for its ID and register the thing, if it's not on the ban list. The issue is that Java doesn't have an easy way to get all the loaded classes, so I have to use the filesystem API to find my classes. So far I've tried stealing a reference to the file from ForgeModLoader, but it isn't allowed to reflect over those classes. Ideas anyone? Link to comment Share on other sites More sharing options...
CrafterOfMines57 Posted September 2, 2013 Share Posted September 2, 2013 Is Minecraft.getMinecraftDir() close to what you want? Link to comment Share on other sites More sharing options...
planetguy Posted September 3, 2013 Author Share Posted September 3, 2013 Thank you for the help, it works fine. Link to comment Share on other sites More sharing options...
planetguy Posted November 12, 2013 Author Share Posted November 12, 2013 Update: Minecraft.getMinecraft().getMinecraftDir() works beautifully on the client. Just today, I tried running the same code on a server and it crashes, since Minecraft.class is apparently client-side-only. I tried using the path from MinecraftServer, but it seems to not be fully initialized at load time. Any other ideas? Link to comment Share on other sites More sharing options...
planetguy Posted November 12, 2013 Author Share Posted November 12, 2013 Never mind. Now I get the directory by stealing the file from the config and going up 2 levels. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now