planetguy Posted August 30, 2013 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? Quote
CrafterOfMines57 Posted September 2, 2013 Posted September 2, 2013 Is Minecraft.getMinecraftDir() close to what you want? Quote
planetguy Posted September 3, 2013 Author Posted September 3, 2013 Thank you for the help, it works fine. Quote
planetguy Posted November 12, 2013 Author 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? Quote
planetguy Posted November 12, 2013 Author Posted November 12, 2013 Never mind. Now I get the directory by stealing the file from the config and going up 2 levels. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.