To get started with PRing changes, you'll need the following software (for now, at least):
- IDE (not required but highly recommended)
- git
- JDK 17+ (If you do not have one, you can download from here: Adoptium)
- Maven (to build MagmaCube)
Blueberry-API
- APIs for Blueberry-Client (IncludesMagmaCube
)Blueberry-Client
- Modifications toMagmaCube
/Minecraft
(IncludesBlueberry-API
,MinecraftForge-API
)MinecraftForge-API
- Modifications toBlueberry-API
, but with Minecraft Forge compatibility features (IncludesBlueberry-API
)
While Blueberry-API
and MinecraftForge-API
are not based on patches, but Blueberry-Client
is based on patches and git, so a basic understanding of how to use git is required. A basic tutorial can be found here: https://git-scm.com/docs/gittutorial or, search with your preferred search engine.
Assuming you have already forked the repository:
- Clone your fork to your local machine (ignore the magmacube related errors from IDE if there is any)
- Type
gradlew patchMinecraft applyBlueberryPatches
in a terminal to apply the changes from upstream (It takes some time!)- Alternatively, you can also do
gradlew applyBlueberryPatches
to just apply patches from MagmaCube-Patches. It can be useful when there are no upstream (MagmaCube) changes, and you don't want to waste time.
- Alternatively, you can also do
- Run
mvn install
insideMagmaCube
directory to install the MagmaCube into local repository (Maven is required here) - Use
gradlew bakeInstaller
to create an installer for the client. - To test changes, you can use "Run" feature in the IDE for now.
- cd into
Blueberry-Client
for client changes.
- Every single commit in
Blueberry-Client
is a patch upstream/master
points to a directory similar toMagmaCube/Minecraft
Note You've updated the project and if you are getting an error something like shadowServerJar at step 2, try deleting the Blueberry-Client directory and try again.
- Modify
Blueberry-Client
- Type
git add .
inside that directory to add your changes - Run
git commit
with the desired patch message - Run
gradlew rebuildBlueberryPatches
in the main directory to convert commits into patches. - PR the generated patch file(s) back to this repository.
(To reset everything, simply run: gradlew applyBlueberryPatches
)
Note Please note that if you have some specific implementation detail you'd like to document, you should do so in the patch message or in comments.
You can modify patches in some ways, they are complicated though.
Editing the patch files by hand should be avoided, as they will most likely cause problems. (Great care should be taken if you do so, and make sure the patches applies without ANY problems.)
This method works by temporarily resetting your HEAD
to the desired commit to edit it using git rebase
.
Warning While in the middle of a rebase, you might not be able to compile the module (which means you may not be able to test changes in-game until rebase is completed).
- cd into
Blueberry-Client
, and rungit rebase -i upstream/master
- If your editor does not have a "menu" at the bottom, you're probably using
vim
. If you don't know how to usevim
and don't want to learn, enter:q!
and press enter. Before redoing this step, doexport EDITOR=nano
for an easier editor to use. - If you're using
nano
, you can use Ctrl+X to (save and) exit the editor.
- Replace
pick
withedit
for the commits you want to modify, and "save" the changes - Make the changes you want to make to the patch
- Type
git rebase --continue
to continue/finish the rebase - Run
gradlew rebuildBlueberryPatches
in the main directory to convert commits into patch file(s). - PR your modified patch file(s) back to this repository.
If you are simply editing a more recent commit, or your change is small, simply making the change at HEAD and then moving the commit after you have tested it may be easier.
In this method, you can compile the module to test your changes without messing with your HEADs and heads.
- Make your changes while at HEAD
- Make a temporary commit
- Type
git rebase -i upstream/master
, move (cut) your temporary commit and move it under the line of the patch you want to modify - Change the pick to one of the following actions:
f
/fixup
: Merge your changes into the previous commit, but discard commit message of the temporary commit.s
/squash
: Merge your changes into the previous commit, but discard commit message of the previous commit.
- "Save" the file
- Run
gradlew rebuildBlueberryPatches
in the main directory to convert commits into patch file(s).
- This step should modify existing patches.
- PR your modified patch file(s) back to this repository.
We'll accept changes that make sense. We have very few APIs for now, so feature requests are also welcome.
Please see the formatting guide below before making changes to the source file(s).
All modifications to non-Blueberry files should be marked.
- Multi-line changes start with
// Blueberry start
and end with// Blueberry end
; - You can put a comment with an explanation if it isn't obvious, like this:
// Blueberry start - reason
.- The comments should generally be about the reason the change was made, what it was before, or what the change is.
- Multi-line messages should start with
// Blueberry start
and use/* Multi line message here */
for the message itself.
- One-line changes should have
// Blueberry
or// Blueberry - reason
. - Watch out for accidental imports, especially when using "Refactor" feature in the IDE.
- Absolutely no wildcard imports.
Here's an example of how to mark changes by Blueberry:
- Minecraft.getInstance().destroyPC();
+ // Minecraft.getInstance().destroyPC(); // Blueberry - don't destroy PC
entity.getServer().getAdmins().forEach(Entity::explode);
int i = 0;
while (true) {
if (i == 5) {
entity.explode();
break;
}
i++;
}
entity.getWorld().explode(entity.getLocation());
+ // Blueberry start - commit and push changes
+ ((Person) entity).commitChanges(changes);
+ ((Person) entity).push().join();
+ // Blueberry end - commit and push changes