Jump to content

How should I package these classes?


Tedstar

Recommended Posts

So I'm creating a kind of API or library to make GUI creation easier.. and I'd like some advice for my package setup.

 

The thing is, I have internal classes that relate the library classes to the basic Minecraft ones. I want them to be strongly discouraged/inaccessible to mods which use my library.

 

Right now my setup is to have a separate package with a different naming scheme that contains all internal components. The nice part about this is that it differentiates the classes when imported. I will know if an import is internal and it would also be more apparent to modders because of the package name. The problem, however, is that since they are in a separate package from the API classes, these transformation classes need to be public.

 

The other alternative, which I thought of to fix this problem, is to include the transformation classes in the same package as the API implementation. That way I could make them package private and therefore inaccessible to other mods. But I didn't want them to be mixed in with the API.

 

Any thoughts on what would be a better setup, or is there a way which I haven't considered?

 

Thanks for any input.

Link to comment
Share on other sites

So I'm creating a kind of API or library to make GUI creation easier.. and I'd like some advice for my package setup.

 

The thing is, I have internal classes that relate the library classes to the basic Minecraft ones. I want them to be strongly discouraged/inaccessible to mods which use my library.

 

Right now my setup is to have a separate package with a different naming scheme that contains all internal components. The nice part about this is that it differentiates the classes when imported. I will know if an import is internal and it would also be more apparent to modders because of the package name. The problem, however, is that since they are in a separate package from the API classes, these transformation classes need to be public.

 

The other alternative, which I thought of to fix this problem, is to include the transformation classes in the same package as the API implementation. That way I could make them package private and therefore inaccessible to other mods. But I didn't want them to be mixed in with the API.

 

Any thoughts on what would be a better setup, or is there a way which I haven't considered?

 

Thanks for any input.

Could you show a screen shot of your current package setup? And if you don't want them to extend it make the class final. And if you don't want them to use it IE

InternalClass iClass = new InternalClass();

iClass.doSomething();

Don't include the source with the file, or denote in the class/source some javadoc that says "Do not use; for internal use only." And even mark it with a @Deprecated if you want.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Could you show a screen shot of your current package setup? And if you don't want them to extend it make the class final. And if you don't want them to use it IE

InternalClass iClass = new InternalClass();

iClass.doSomething();

Don't include the source with the file, or denote in the class/source some javadoc that says "Do not use; for internal use only." And even mark it with a @Deprecated if you want.

This is like one of three mods that I've made, the other two having been spread out for the past two years (for like one day each) so I'm still really new to modding; sorry if it's terrible or follows bad tutorials.  :-\

 

The 'dev' packages are the mod I'm using to test stuff, the 'lib' packages are internal, and the 'mgt' packages are the usable library (although not usable yet because I've hardly written any of it haha).

oWZ3tzc.png

 

 

The best way currently is to put things into an internal package and tell people not to use it. Things like this will be supported by the module system in Java 9.

Alright cool, that's what I've done so far.  I'm so excited for Java 9!  :D

Link to comment
Share on other sites

Could you show a screen shot of your current package setup? And if you don't want them to extend it make the class final. And if you don't want them to use it IE

InternalClass iClass = new InternalClass();

iClass.doSomething();

Don't include the source with the file, or denote in the class/source some javadoc that says "Do not use; for internal use only." And even mark it with a @Deprecated if you want.

This is like one of three mods that I've made, the other two having been spread out for the past two years (for like one day each) so I'm still really new to modding; sorry if it's terrible or follows bad tutorials.  :-\

The 'dev' packages are the mod I'm using to test stuff, the 'lib' packages are internal, and the 'mgt' packages are the usable library (although not usable yet because I've hardly written any of it haha).

The only thing I don't really see the meaning of is the mgt package. It should be contained in your lib package, but just not under the internal packaging. And I am actually really excited to see this in action, mainly how you planned it out. After hearing that you were doing this it sparked me to try something similar. But judging from just your files we have gone in different directions.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
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.
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...

×   Pasted as rich text.   Restore formatting

  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.



×
×
  • Create New...

Important Information

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