# Development and Contribution ## Building 1. Run `./gradlew setupDecompWorkspace clean build` command. 1. The built jars are all in `${rootprojectDir}/build/libs` folder. *NOTICE: The jar file with specific Minecraft version is for the vanilla edition without Forge and Fabric. The json files are launcher profiles which only work when building with our CI server.* ## Running and Testing For now, CustomSkinLoader is unable to run under self development environment, so it needs to add to another development environment as a library. There are the available versions in different environments below: | | Forge | Fabric | |:-----------------------:|:-----------------------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------:| | Runtime Environment | forge-1.8-11.14.0.1237 ~ 1.13.2-25.0.22
forge-1.13.2-25.0.42 ~ latest | fabric-loader-0.4.3+build.134 ~ latest
Minecraft 18w43b ~ latest
*fabric-api is not required* | | Development Environment | ForgeGradle-2.1-SNAPSHOT ~ latest
forge-1.8-11.14.3.1503 ~ 1.12.2-14.23.5.2860
forge-1.13.2-25.0.198 ~ latest | fabric-loom-(?) ~ latest
fabric-loader-0.12.0 ~ latest
Minecraft 18w49a ~ latest
*fabric-api is not required* | ### Preliminary steps for testing local builds 1. Create a new empty minecraft development environment. 1. Add below contents to `build.gradle`: ```gradle repositories { maven { url = "file:/${projectDir}/local-repo" } } ``` 1. Create these folders in the new project directory, then copy the built jar and source jar into it: ``` Forge 1.8 ~ 1.16.5: ./local-repo/mods/CustomSkinLoader_ForgeLegacy/${version} Forge 1.17.1 ~ latest: ./local-repo/mods/CustomSkinLoader_ForgeActive/${version} Fabric: ./local-repo/mods/CustomSkinLoader_Fabric/${version} ``` *`${version}` should be repalced with something like `14.15-SNAPSHOT-00` manually* 1. Create a pom file in the same folder: - Forge 1.8 ~ 1.16.5: `CustomSkinLoader_ForgeLegacy-${version}.pom` ```xml 4.0.0 mods CustomSkinLoader_ForgeLegacy ${version} ``` - Forge 1.17.1 ~ latest: `CustomSkinLoader_ForgeActive-${version}.pom` ```xml 4.0.0 mods CustomSkinLoader_ForgeActive ${version} ``` - Fabric: `CustomSkinLoader_Fabric-${version}.pom` ```xml 4.0.0 mods CustomSkinLoader_Fabric ${version} ``` ### For ForgeGradle 2.x ( forge-1.8-11.14.3.1503 ~ forge-1.12.2-14.23.5.2847 ) 1. Add below contents to `build.gradle`: ```gradle dependencies { deobfCompile "mods:CustomSkinLoader_ForgeLegacy:14.15-SNAPSHOT-00" } minecraft { clientRunArgs += ["--tweakClass", "customskinloader.forge.ForgeDevTweaker", "--username", ""] } ``` 1. Run `./gradlew setupDecompWorkspace` command. 1. Then you can debug the mod in IDE or through `./gradlew runClient` command. ### For ForgeGradle 3.x ~ 5.x ( forge-1.12.2-14.23.5.2851 ~ latest ) 1. Add below contents to `build.gradle`: ```gradle dependencies { implementation fg.deobf("mods:CustomSkinLoader_ForgeLegacy:14.15-SNAPSHOT-00") // Only required for MinecraftForge 1.8 ~ 1.16.5 implementation fg.deobf("mods:CustomSkinLoader_ForgeActive:14.15-SNAPSHOT-00") // Only required for MinecraftForge 1.17.1 ~ latest } minecraft { runs { client { args += ["--username", ""] args += ["--tweakClass", "customskinloader.forge.ForgeDevTweaker"] // Only required for MinecraftForge 1.12.2 } } } ``` 1. Setup the development environment and run the game as usual. ### For fabric-loom ( fabric-loader-0.12.0 ~ latest ) 1. Add below contents to `build.gradle`: ```gradle dependencies { modImplementation "mods:CustomSkinLoader_Fabric:14.15-SNAPSHOT-00" } tasks.runClient { args += ["--username", ""] } ``` 1. Add `--username ` to CLI arguments in `Run/Debug Configurations` dialog. 1. Run the game in IDE or through `./gradlew runClient` command.. ## Depend on release builds 1. Check the latest version in https://littlesk.in/csl-latest . 1. Add below contents to `build.gradle`: ```gradle // Before Gradle 5.x repositories { ivy { url = "https://csl.littleservice.cn/" layout "pattern", { artifact "[organisation]/[artifact]-[revision](-[classifier])(.[ext])" } } } // After Gradle 6.x repositories { ivy { url = "https://csl.littleservice.cn/" metadataSources { artifact() } patternLayout { artifact "[organisation]/[artifact]-[revision](-[classifier])(.[ext])" } } } ``` 1. Follow the same steps in **Running and Testing**. ## Developing - CustomSkinLoader is based on forge-1.12.2-14.23.5.2768 currently, including Fabric edition. We use custom reobfuscation mappings such as [Fabric.tsrg](Fabric/Fabric.tsrg) and [mixin.tsrg](Fabric/mixin.tsrg) to generate different editions jar and Mixin reference jsons. - The source codes are all in `${projectDir}/sources` and resource files are in `${projectDir}/resources` instead of `src/main/java` and `src/main/resources`. - Do not add other required mods.