Thank you for your interest in contributing! This document provides an overview of the process of contributing to Patchwork.
Patchwork is a somewhat complex project, and there's a few things you should have before you start contributing.
- Basic knowledge of Java
- Knowledge of and / or experience using Mixins
- Familiarity with Fabric and modding in general
We use A set version of Forge as our reference commit. All features should be based on this version of Forge for consistency. The version at this link has been remapped to Yarn, but you can find the original Forge commit by reading the full commit message (for example, here)
- Pick a feature to implement. There are a few ways to do this:
- Checking the
#wishlist
channel on the Discord server - Scrolling through the issue tracker
- Picking something to implement yourself
- Checking the
- Locate mods to test the feature
- It's important to make sure that you have a way to test what you're implementing. We all accidentally introduce bugs, and it's important to eliminate the more obvious ones through testing first.
- In addition, this also helps verify that the feature being implemented is actually used. Our time is limited, and it's good to make sure that we're spending it wisely.
- For larger mods, it's often better to find a smaller mod using that feature instead. One option is to make a test mod and submit a PR for it. However, please make sure that there is an existing mod using this feature, for the reason stated above.
- Determine the correct module to put the feature in, or make a new module.
- If you're not sure what to do, ask on Discord in
#api
. - In general, look at existing modules to see the naming conventions.
- If you're not sure what to do, ask on Discord in
- Implement the feature and get it running.
- If you're writing mixins, make sure to follow these guidelines:
- Avoid overwrites if at all possible. Try to write your mixin in the way that touches the least amount of code.
- All annotations besides
@Inject
must have full signatures in the method target, like this:method = "method(I)Ljava/lang/Object;"
- All
@At
annotations must include an ordinal (besides ones where it does nothing likeHEAD
andTAIL
) - If your ordinal is greater than 1, you should try to use a slice.
- Methods added by Forge must have a duck interface
- By the same token, make duck interfaces with getter/setter methods for fields
- Any added methods that are not from forge should have the prefix
patchwork$
- If you're writing mixins, make sure to follow these guidelines:
- Clean up the code so that it adheres to Patchwork's standards.
- Remove obvious lambda abuse and replace it with more readable code.
- Avoid reckless usage at runtime of Unsafe, Reflection, or ASM if possible.
- Clean up the JavaDoc to replace MCP names with Yarn names.
- Make sure your code passes checkstyle by running
./gradlew checkstyleMain
(gradlew.bat checkstyleMain
on Windows)
- Test your feature.
- Simply drop your patched mods into the
run/mods
folder.
- Simply drop your patched mods into the
- Submit a pull request to Patchwork!