Contributing - WeaveMC/weft GitHub Wiki
So, you've found some constants that need unpicking? Here's how to contribute definitions for them to Weft.
- Fork and clone Weft
- Familiarise yourself with V2 of the Unpick format.
- Determine whether the constants exist in one of Minecraft's libraries or not. Look at call hierarchies and take your best guess. If you guess wrong, it can be corrected when other contributors review your PR. If the constants exist in an MC library, proceed to 3i; otherwise proceed to 3ii.
- Look up the maven identifier for the library here. Check if it already has a constantSource tag inside the config tag in warp-config.xml. A constantSource tag looks like
<constantSource mavenStyleId = "somemavenid"/>
. If it doesn't, add one. - Add the constants to the Weft Constant Library. Look in the main sourceset (src/main/java), in the package
io.github.weavemc.weft
. If there's an appropriate class, add the constants to it, otherwise create one and name it according to the naming conventions below.
- Look up the maven identifier for the library here. Check if it already has a constantSource tag inside the config tag in warp-config.xml. A constantSource tag looks like
- If there's an appropriate unpick definition file in the unpick-definitions directory; add the new constants, constant groups, and target method definitions to it; otherwise create one and name it according to the naming conventions below.
All class and method names should be fully qualified, and use intermediary mappings. - Test your changes.
- Run
./gradlew publishToMavenLocal
from a command prompt in the weft directory. - Create a simple test project with Loom & Warp. Add
mavenLocal()
to the repositories block, and change the maven identifier for theunpickDefinitions
configuration toio.github.weavemc:weft:1.14.4+build.unknown
. - Run
./gradlew genSources
from a command prompt in the test project directory. Import it into your IDE and check the added constants and target methods are uninlined correctly.
- Run
- Open a pull request!
Borrowing names from other sources
Weft is CC0, if you choose to borrow names for constants from other projects, you must first check that the license for that project is compatible with CC0. This means, for example, that you cannot borrow names from Forge's Constants class, as Forge is licensed under LGPL 2.1.
Naming Conventions
Unpick definitions
Unpick definition files should be named in lower_snake_case, according to the constant groups they contain (e.g gl11.unpick for OpenGL 1.1 constants).
Unpick constant groups
Constant groups should use lower_snake_case.
WCL Constants
Follow java naming conventions.
WCL classes & packages
Follow java naming conventions. Classes should use the PascalCase form of the id of the constant group for the constants they define. If you have any questions, you can ask them in this Discord channel.