Skip to content

Instantly share code, notes, and snippets.

@radfast
Last active March 22, 2018 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radfast/7ea7577fe2c0fdae1ac90d4b26d6198c to your computer and use it in GitHub Desktop.
Save radfast/7ea7577fe2c0fdae1ac90d4b26d6198c to your computer and use it in GitHub Desktop.
Guide to successfully making your first PR in Galacticraft

A link to instructions for setting up your workspace is on the main page of the Galacticraft repository, follow the instructions carefully. Check the build.gradle to see which Forge version and mappings snapshot you should use. (If you use something different, Galacticraft code may show up in your IDE as having compile errors.)

Your Ideas

  • If you want to add a completely new feature to the mod, that could be fun - you'd need to code all parts of it of course, including any needed textures, GUIs, sounds and other assets.

  • PRs which fix a currently open issue are extremely welcome. Please state with a # which issue you are fixing.

  • Same for PRs which fix anything else which is obviously broken - an explanation of what you are fixing can help!

  • Same for PRs which improve game performance. We like performance.

Making a PR

  • If your PRs can be merged without alteration then you will get Contributor status on this project.

  • Fetch the latest version of Galacticraft's code to make your PR against. (If our code changes after your PR, don't worry about that - that's for us to deal with.)

  • If possible you should offer only one commit. (Major contributions could have multiple commits, for example one with the main code, one with the textures and one with any .lang file updates.)

  • If you have multiple unrelated changes, it's best to offer each change in a separate PR. We are happy to have multiple PRs from you.

Additional tips for ease of code maintenance

Ease of code maintenance between different Galacticraft versions is important. We regularly automerge code from master -> MC1.10 -> MC1.11 -> MC1.12. It's a nightmare, but we are fairly used to it by now!

  • Your PRs should target master branch unless the issue / fix is only relevant to a later Minecraft version, in which case target the first branch where it applies.

  • Generally it's best to minimise the number of lines of code which change, as this makes maintenance between the 4 different current branches easier.

  • Do not let your IDE apply code-style changes (or auto-management of imports) to Galacticraft's existing code - that will create an unnecessarily large diff.

  • Do not re-order existing imports. Git is very bad at auto-merging the imports section of a class if there are changes there.

  • Do not make a PR asking to restructure our workspace or gradle setup. It's how it is for a reason, including auto-building through our Jenkins. And all the existing contributors are set up to use it how it is now.

Respect our code style

You can see Galacticraft's code style from the existing code. Main elements:

  • Opening brace { should generally be on a new line - except for inlined classes etc.

  • Use 4 spaces for indents - do not use Tab characters

  • Space between all keywords, operators and values

  • Long lines are OK - do not break long lines unless there is a logical, tabular break pattern (for example initialising elements in a long array)

  • Generally you should explicitly use this.

  • Generally you should use braces { } following if () and for () statements, even if it is only one line.

General

You might want to discuss your plans for any major change with us first, before you spend a long time coding it! Do this either by opening an issue, or an example PR for discussion, or you can try contacting us in other ways (email or PM at the Galacticraft forum).

We are very open to discussing major improvements you plan to make.

We are very open to anything which improves compatibility with other mods.

We are not big fans of PRs which are purely a question of personal taste, or enforcement of some textbook Java coding style, or "tidyness" - especially if these things hurt the game's performance or might affect existing saved games or existing (released) add-ons... If you want to help the mod, we gladly need your help with the things that need fixing, and improvements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment