Jump to content

Does Forge have an api manual?


zenglintao

Recommended Posts

39 minutes ago, zenglintao said:

How do you know how many methods Forge has and what they are used for?

There's no manual, but you can look at the code of both forge stuff and vanilla MC stuff within your IDE. It is also searchable. Also, if you are unaware, definitely learn features of your IDE like looking up call hierarchy (will show places where the method/field is called from) and looking up type hierarchy (will show the tree of super/subclasses for the selected class). Things like this are invaluable.

Link to comment
Share on other sites

32 minutes ago, Ugdhar said:

没有手册,但是您可以在IDE中查看伪造和香草MC的代码。也可以搜索。另外,如果您不了解,则一定要学习IDE的功能,例如查找调用层次结构(将显示调用方法/字段的位置)和查找类型层次结构(将显示所选类的父级/子类的树) 。这样的事情是无价的。

I have learned Java, but there are too few official examples

Link to comment
Share on other sites

2 hours ago, zenglintao said:

too few official examples

What would an official example look like? I mean, we can read the sourcecode. . .I don't think it gets more official than that. I've found tons and tons of examples searching the forums and google for what I was looking for, sometimes even finding stuff I didn't know about. And as long as it's a supported version, we are free to ask questions here and on the forge discord.

The forge docs give all the information needed to get a workspace setup, and as far as the basics, everyone that's ever made (or tried making) a tutorial at least makes it to blocks and items

 

I guess what I should ask is, what exactly are you looking for? And of course, the forge documentation is on github, so if you'd like something added/changed, you can make contributions/pull requests.

Link to comment
Share on other sites

Hi

The short answer is - Forge isn't really an API at all in the sense that you might expect.  It does have some API-like aspects but if you're looking for documentation similar to the Guava library or the java util library, then you're not going to find it.  Some of the Forge code is documented well, and some of it is not documented at all.

Sometimes you can tell how the methods are intended to be used by reading the code, other times that is almost impossible to figure out.

 

The best way I have found to learn it is to google for tutorials and to look at good existing mods.  That can be difficult because there are a lot of not-very-good tutorials around.

 

-TGG

 

 

 

Link to comment
Share on other sites

4 hours ago, zenglintao said:

How do you know how many methods Forge has

Thousands.

 

4 hours ago, zenglintao said:

and what they are used for?

Whatever they need to be for.

 

It is easier to ask us how to do something.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

4 hours ago, Ugdhar said:

What would an official example look like? I mean, we can read the sourcecode. . .I don't think it gets more official than that. I've found tons and tons of examples searching the forums and google for what I was looking for, sometimes even finding stuff I didn't know about. And as long as it's a supported version, we are free to ask questions here and on the forge discord.

The forge docs give all the information needed to get a workspace setup, and as far as the basics, everyone that's ever made (or tried making) a tutorial at least makes it to blocks and items

 

I guess what I should ask is, what exactly are you looking for? And of course, the forge documentation is on github, so if you'd like something added/changed, you can make contributions/pull requests.

https://wiki.mcjty.eu/modding/index.php?title=Main_Page

This tutorial is more detailed than the official one, but it's video format, I prefer to read the documentation

Link to comment
Share on other sites

4 hours ago, TheGreyGhost said:

Hi

The short answer is - Forge isn't really an API at all in the sense that you might expect.  It does have some API-like aspects but if you're looking for documentation similar to the Guava library or the java util library, then you're not going to find it.  Some of the Forge code is documented well, and some of it is not documented at all.

Sometimes you can tell how the methods are intended to be used by reading the code, other times that is almost impossible to figure out.

 

The best way I have found to learn it is to google for tutorials and to look at good existing mods.  That can be difficult because there are a lot of not-very-good tutorials around.

 

-TGG

 

 

 

Why do many method names change after forge upgrade, do I have to remember those method names again?

Link to comment
Share on other sites

44 minutes ago, zenglintao said:

https://wiki.mcjty.eu/modding/index.php?title=Main_Page

This tutorial is more detailed than the official one, but it's video format, I prefer to read the documentation

The official documentation is not meant to be a tutorial. It's more of a getting started and concepts guide.

 

If you click the "Youtube tutorial step by step" link on that page you linked to, you'll get the txt version of the tutorials.

Link to comment
Share on other sites

6 hours ago, Ugdhar said:

The official documentation is not meant to be a tutorial. It's more of a getting started and concepts guide.

 

If you click the "Youtube tutorial step by step" link on that page you linked to, you'll get the txt version of the tutorials.

Um, i got it. Thanks

Link to comment
Share on other sites

Hi

20 hours ago, zenglintao said:

Why do many method names change after forge upgrade, do I have to remember those method names again?

The names change a lot because they're not the official mojang names.

Each version of minecraft has the names of all its methods, variables, classes scrambled (obfuscated).

The Forge guys (well, MCP actually) decompile the minecraft code, and then the community assign names for the scrambled methods, variables, and classes.  If the method signature hasn't changed, the name usually stays the same, but if it has changed then it relies upon someone in the community assigning a reasonable new name.  Quite often the names are misleading.  Sometimes the names change because different people have different opinions about what good names should look like.

 

In my experience, the changing of the names is usually not a big problem- the thing which causes you many hours of frustrating rework is the refactoring of the game features and classes, because your code breaks in fundamental ways and large parts of it need to be rewritten almost from scratch.

 

Some parts of Forge don't change much (the events, for example).  But anything that is tightly integrated with vanilla is likely to change a lot.

 

Cheers

 TGG

 

 

Link to comment
Share on other sites

I would recommend looking at sources of other mods.

I used to learn modding via looking at Botania, which provides a pretty good example of various systems (particles, recipes, etc).

 

I personally find examples of Forge API not as necessary as code examples in other API/framework, as the vanilla code serves as a pretty good example itself. However, if you prefer examples, TGG has a tutorial consisting of examples: here.

Edited by DavidM

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

Bit late to the thread here but I’m about a month into making a mod, thought I’d share how I’m learning stuff.

 

Basically it seems to be a combination of... Reading the docs for reference, watching tutorials on the more complicated topics, I’d honestly say registry events and the order in which they are fired confused me the most. Older tutorials can still be useful especially when understanding how minecraft works, e.g. the sided approach. Although make sure that tutorial isn’t ancient.

this is quite outdated now but is still very useful: http://jabelarminecraft.blogspot.com. Also provides links to other sites. I kinda of think of the tutorial stuff as unofficial documentation sometimes. Also mcjtys stuff is in note form as well if you look for it.

 

The rest is looking at others mods, asking for help on discord or on the forums, trying stuff out and failing very often.

 

oh also, if your looking at how to do something by viewing another mods code i seem to find it’s better to go with simpler mods so your not searching for what you need for long and the larger mods/older mods tend to have there own way of doing things which works great for them but is annoying for someone trying to understand the basics.

Edited by profjb58
Link to comment
Share on other sites

7 hours ago, profjb58 said:

registry events and the order in which they are fired

Just to make sure this fact is known, the only order of registration that you can rely on is Blocks -> Items -> Everything else, in a non-specified order. The order of any other registrations besides blocks and items is subject to change, even between different runs.

Link to comment
Share on other sites

6 minutes ago, Ugdhar said:

Just to make sure this fact is known, the only order of registration that you can rely on is Blocks -> Items -> Everything else, in a non-specified order. The order of any other registrations besides blocks and items is subject to change, even between different runs.

Are you sure? I thought the order was Blocks -> Items -> Everything else in alphabetical order.

Link to comment
Share on other sites

20 minutes ago, vemerion said:

Are you sure? I thought the order was Blocks -> Items -> Everything else in alphabetical order.

Positive, any perceived order after Blocks -> Items could change at any time.

I've seen people that know what they're talking about (including Lex) say it a million times.

  • Thanks 2
Link to comment
Share on other sites

1 hour ago, diesieben07 said:

The order is intentionally not specified. Do not rely on the registry order. If you need to reference other registry entries, use RegistryObject.

Apologies. I think I got registry events confused with the FML lifecycle events. Not entirely sure how.
I've had multiple attempts at modding since 1.7.10 so in comparison the registry events and deffered registry are a massive improvement. I think deffered registry is a fairly recent thing as well.

There is a thing on Jabelars site about FML lifecycle events & events in general as well although he uses a proxy which I don't think is needed really and it's a bit outdated. Some info on changes in 1.10.2 for the modeventbussubscriber so it's not too bad though.
http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-event-handling.html
 

lol tbf I don't know enough yet to really comment on this stuff. Basically just a combo of everything available seems to work in learning MC modding. Very different to programming for Android for example but a lot more fun :P.

Edited by profjb58
Link to comment
Share on other sites

32 minutes ago, profjb58 said:

Apologies. I think I got registry events confused with the FML lifecycle events. Not entirely sure how.
I've had multiple attempts at modding since 1.7.10 so in comparison the registry events and deffered registry are a massive improvement. I think deffered registry is a fairly recent thing as well.

There is a thing on Jabelars site about FML lifecycle events & events in general as well although he uses a proxy which I don't think is needed really and it's a bit outdated. Some info on changes in 1.10.2 for the modeventbussubscriber so it's not too bad though.
http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-event-handling.html
 

lol tbf I don't know enough yet to really comment on this stuff. Basically just a combo of everything available seems to work in learning MC modding. Very different to programming for Android for example but a lot more fun :P.

If you're trying to follow a tutorial, use these: https://wiki.mcjty.eu/modding/index.php?title=YouTube-Tutorials

They're the most up to date, and best laid out, and are the ones suggested if you ask about tutorials on the forge discord.

McJty is also one of the few tutorial makers that doesn't force you to sit there and watch a video, as he has a text based version to go with them.

Link to comment
Share on other sites

Mcjtys tutorials do seem to be the best for tutorials but the Jabelar stuff I posted i think of more like extended unofficial (if a bit outdated) documentation. It explains some of the concepts of forge and MC in general in greater detail than the official forge documentation, but not everything. It's also really well split up.
If you wanted to find the closest thing to an api manual or documentation with examples this is probably the closest you can get outside official forge documentation. There are sections which are very outdated on there though so take that with a grain of salt.

To be honest though there are so many mods out there, most being free to view on Github or simular platforms and with things like MinecraftByExample it's easier to just look at there structure and interpret what you need from it. Since MinecraftByExample is commented as well that helps a lot.

Edited by profjb58
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.

Announcements



×
×
  • Create New...

Important Information

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