diff --git a/INSTALL.md b/INSTALL.md index cb66440f..e66054b6 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,7 +1,9 @@ # Integration between Baritone and Impact Impact 4.4 has Baritone included. -These instructions apply to Impact 4.3 (and potentially other "hacked clients"). +These instructions apply to Impact 4.3. + +For Forge follow the instructions in [Setup](SETUP.md). To run Baritone on Vanilla, just follow the instructions in the README (it's `./gradlew runClient`). @@ -18,11 +20,11 @@ There are two methods of acquiring a build of Baritone ### Official Release (Not always up to date) https://github.com/cabaletta/baritone/releases -For Impact 4.3, there is no Baritone integration yet, so you will want `baritone-standalone-X.Y.Z.jar`. +For Impact 4.3, there is no Baritone integration yet, so you will want `baritone-standalone-X.Y.Z.jar`. **For the rest of this guide, replace `X.Y.Z` with the actual numeric version you are using.** Any official release will be GPG signed by leijurv (44A3EA646EADAC6A) and ZeroMemes (73A788379A197567). Please verify that the hash of the file you download is in `checksums.txt` and that `checksums_signed.asc` is a valid signature by those two public keys of `checksums.txt`. -The build is fully deterministic and reproducible, and you can verify Travis did it properly by running `docker build --no-cache -t cabaletta/baritone . && docker run --rm cabaletta/baritone cat /code/dist/checksums.txt` yourself and comparing the shasum. This works identically on Travis, Mac, and Linux (if you have docker on Windows, I'd be grateful if you could let me know if it works there too). +The build is fully deterministic and reproducible, and you can verify Travis did it properly by running `docker build --no-cache -t cabaletta/baritone .` yourself and comparing the shasum. This works identically on Travis, Mac, and Linux (if you have docker on Windows, I'd be grateful if you could let me know if it works there too). ### Building Baritone yourself You can either build Baritone through a command line or through IntelliJ's UI, information on that can be found [here](SETUP.md#building). @@ -36,7 +38,7 @@ putting baritone. - ``cabaletta`` - ``baritone`` - ``X.Y.Z`` - - Copy the build of Baritone that was acquired earlier, and place it into the ``X.Y.Z`` folder + - Copy the build of Baritone that was acquired earlier, and place it into the ``X.Y.Z`` folder, renamed like so: - The full path should look like ``/libraries/cabaletta/baritone/X.Y.Z/baritone-X.Y.Z.jar`` ## Modifying the Impact Profile JSON to run baritone @@ -79,7 +81,7 @@ The final step is "registering" the Baritone library with Impact, so that it loa ``` - Now find the ``"minecraftArguments": "..."`` text near the top. - At the very end of the quotes where it says ``--tweakClass clientapi.load.ClientTweaker"``, add on the following so it looks like: - - ``--tweakClass clientapi.load.ClientTweaker --tweakClass baritone.launch.BaritoneTweakerOptifine"`` + - ``--tweakClass clientapi.load.ClientTweaker --tweakClass baritone.launch.BaritoneTweaker"`` - If you didn't close your launcher for this step, restart it now. - You can now launch Impact 4.3 as normal, and Baritone should start up diff --git a/SETUP.md b/SETUP.md index fbb6b22c..6d50a85b 100644 --- a/SETUP.md +++ b/SETUP.md @@ -1,14 +1,31 @@ # Setup ## Prebuilt +(not always completely up to date with latest features) + Download from the [Releases](https://github.com/cabaletta/baritone/releases) -Not always completely up to date with latest features. +The Forge releases can simply be added as a Forge mod. -The forge release (currently `baritone-forge-1.1.3.jar`) can simply be added as a Forge mod. +If another one of your Forge mods has a Baritone integration, you want `baritone-api-forge-VERSION.jar`. Otherwise, you want `baritone-standalone-forge-VERSION.jar` Previously (Baritone v1.1.2 and below), it was not fully compatible with the latest version of Forge. `freeLook` was broken in Forge 14.23.4.2744. Forge 14.23.4.2743 or **older** worked with Baritone v1.1.2 and lower. Newer versions of Forge "worked", sort of, but Baritone's movement became unreliable and `freeLook` must be off. +## Artifacts + +Building Baritone will result in 5 artifacts created in the ``dist`` directory. These are the same as the artifacts created in the [releases](https://github.com/cabaletta/baritone/releases). + +- **API**: Only the non-api packages are obfuscated. This should be used in environments where other mods would like to use Baritone's features. +- **Forge API**: Same as API, but packaged for Forge. This should be used where another mod has a Baritone integration. +- **Standalone**: Everything is obfuscated. This should be used in environments where there are no other mods present that would like to use Baritone's features. +- **Forge Standalone**: Same as Standalone, but packaged for Forge. This should be used when Baritone is your only Forge mod, or none of your other Forge mods integrate with Baritone. +- **Unoptimized**: Nothing is obfuscated. This shouldn't be used ever in production. + +## More Info +To replace out Impact 4.4's Baritone build with a customized one, switch to the `impact4.4-compat` branch, build Baritone as above then copy `dist/baritone-api-$VERSION$.jar` into `minecraft/libraries/cabaletta/baritone-api/1.0.0/baritone-api-1.0.0.jar`, replacing the jar that was previously there. You also need to edit `minecraft/versions/1.12.2-Impact_4.4/1.12.2-Impact_4.4.json`, find the line `"name": "cabaletta:baritone-api:1.0.0"`, remove the comma from the end, and entirely remove the line that's immediately after (starts with `"url"`). + +Impact 4.4 **only** works with builds from the quite outdated `impact4.4-compat` branch. If you must have the latest Baritone features with Impact, and can't wait for 4.5, consider creating a standalone (non forge) build then adding it to Impact 4.**3** via the instructions in [Install](INSTALL.md). + ## Build it yourself - Clone or download Baritone @@ -75,16 +92,4 @@ $ gradlew build ![Image](https://i.imgur.com/PE6r9iN.png) -- Double click on **build** to run it - -## Artifacts - -Building Baritone will result in 4 artifacts created in the ``dist`` directory. - -- **Forge**: Forge mod -- **API**: Only the non-api packages are obfuscated. This should be used in environments where other mods would like to use Baritone's features. -- **Standalone**: Everything is obfuscated. This should be used in environments where there are no other mods present that would like to use Baritone's features. -- **Unoptimized**: Nothing is obfuscated. This shouldn't be used ever in production. - -## More Info -To replace out Impact 4.4's Baritone build with a customized one, switch to the `impact4.4-compat` branch, build Baritone as above then copy `dist/baritone-api-$VERSION$.jar` into `minecraft/libraries/cabaletta/baritone-api/1.0.0/baritone-api-1.0.0.jar`, replacing the jar that was previously there. You also need to edit `minecraft/versions/1.12.2-Impact_4.4/1.12.2-Impact_4.4.json`, find the line `"name": "cabaletta:baritone-api:1.0.0"`, remove the comma from the end, and entirely remove the line that's immediately after (starts with `"url"`). +- Double click on **build** to run it \ No newline at end of file diff --git a/buildSrc/src/main/java/baritone/gradle/task/BaritoneGradleTask.java b/buildSrc/src/main/java/baritone/gradle/task/BaritoneGradleTask.java index 384e99fe..4f7674f6 100644 --- a/buildSrc/src/main/java/baritone/gradle/task/BaritoneGradleTask.java +++ b/buildSrc/src/main/java/baritone/gradle/task/BaritoneGradleTask.java @@ -34,8 +34,6 @@ import java.util.List; */ class BaritoneGradleTask extends DefaultTask { - protected static final JsonParser PARSER = new JsonParser(); - protected static final String PROGUARD_ZIP = "proguard.zip", PROGUARD_JAR = "proguard.jar", @@ -45,28 +43,28 @@ class BaritoneGradleTask extends DefaultTask { PROGUARD_STANDALONE_CONFIG = "standalone.pro", PROGUARD_EXPORT_PATH = "proguard_out.jar", - VERSION_MANIFEST = "version_manifest.json", - TEMP_LIBRARY_DIR = "tempLibraries/", - ARTIFACT_STANDARD = "%s-%s.jar", - ARTIFACT_UNOPTIMIZED = "%s-unoptimized-%s.jar", - ARTIFACT_API = "%s-api-%s.jar", - ARTIFACT_STANDALONE = "%s-standalone-%s.jar", - ARTIFACT_FORGE = "%s-forge-%s.jar"; + ARTIFACT_STANDARD = "%s-%s.jar", + ARTIFACT_UNOPTIMIZED = "%s-unoptimized-%s.jar", + ARTIFACT_API = "%s-api-%s.jar", + ARTIFACT_STANDALONE = "%s-standalone-%s.jar", + ARTIFACT_FORGE_API = "%s-api-forge-%s.jar", + ARTIFACT_FORGE_STANDALONE = "%s-standalone-forge-%s.jar"; protected String artifactName, artifactVersion; - protected Path artifactPath, artifactUnoptimizedPath, artifactApiPath, artifactStandalonePath, artifactForgePath, proguardOut; + protected Path artifactPath, artifactUnoptimizedPath, artifactApiPath, artifactStandalonePath, artifactForgeApiPath, artifactForgeStandalonePath, proguardOut; protected void verifyArtifacts() throws IllegalStateException { this.artifactName = getProject().getName(); this.artifactVersion = getProject().getVersion().toString(); - this.artifactPath = this.getBuildFile(formatVersion(ARTIFACT_STANDARD)); - this.artifactUnoptimizedPath = this.getBuildFile(formatVersion(ARTIFACT_UNOPTIMIZED)); - this.artifactApiPath = this.getBuildFile(formatVersion(ARTIFACT_API)); - this.artifactStandalonePath = this.getBuildFile(formatVersion(ARTIFACT_STANDALONE)); - this.artifactForgePath = this.getBuildFile(formatVersion(ARTIFACT_FORGE)); + this.artifactPath = this.getBuildFile(formatVersion(ARTIFACT_STANDARD)); + this.artifactUnoptimizedPath = this.getBuildFile(formatVersion(ARTIFACT_UNOPTIMIZED)); + this.artifactApiPath = this.getBuildFile(formatVersion(ARTIFACT_API)); + this.artifactStandalonePath = this.getBuildFile(formatVersion(ARTIFACT_STANDALONE)); + this.artifactForgeApiPath = this.getBuildFile(formatVersion(ARTIFACT_FORGE_API)); + this.artifactForgeStandalonePath = this.getBuildFile(formatVersion(ARTIFACT_FORGE_STANDALONE)); this.proguardOut = this.getTemporaryFile(PROGUARD_EXPORT_PATH); @@ -97,8 +95,4 @@ class BaritoneGradleTask extends DefaultTask { protected Path getBuildFile(String file) { return getRelativeFile("build/libs/" + file); } - - protected JsonElement readJson(List lines) { - return PARSER.parse(String.join("\n", lines)); - } } diff --git a/buildSrc/src/main/java/baritone/gradle/task/CreateDistTask.java b/buildSrc/src/main/java/baritone/gradle/task/CreateDistTask.java index 5090a2ea..3ca935d1 100644 --- a/buildSrc/src/main/java/baritone/gradle/task/CreateDistTask.java +++ b/buildSrc/src/main/java/baritone/gradle/task/CreateDistTask.java @@ -42,10 +42,11 @@ public class CreateDistTask extends BaritoneGradleTask { super.verifyArtifacts(); // Define the distribution file paths - Path api = getRelativeFile("dist/" + formatVersion(ARTIFACT_API)); - Path standalone = getRelativeFile("dist/" + formatVersion(ARTIFACT_STANDALONE)); - Path unoptimized = getRelativeFile("dist/" + formatVersion(ARTIFACT_UNOPTIMIZED)); - Path forge = getRelativeFile("dist/" + formatVersion(ARTIFACT_FORGE)); + Path api = getRelativeFile("dist/" + formatVersion(ARTIFACT_API)); + Path standalone = getRelativeFile("dist/" + formatVersion(ARTIFACT_STANDALONE)); + Path unoptimized = getRelativeFile("dist/" + formatVersion(ARTIFACT_UNOPTIMIZED)); + Path forgeApi = getRelativeFile("dist/" + formatVersion(ARTIFACT_FORGE_API)); + Path forgeStandalone = getRelativeFile("dist/" + formatVersion(ARTIFACT_FORGE_STANDALONE)); // NIO will not automatically create directories Path dir = getRelativeFile("dist/"); @@ -54,13 +55,14 @@ public class CreateDistTask extends BaritoneGradleTask { } // Copy build jars to dist/ - Files.copy(this.artifactApiPath, api, REPLACE_EXISTING); - Files.copy(this.artifactStandalonePath, standalone, REPLACE_EXISTING); - Files.copy(this.artifactUnoptimizedPath, unoptimized, REPLACE_EXISTING); - Files.copy(this.artifactForgePath, forge, REPLACE_EXISTING); + Files.copy(this.artifactApiPath, api, REPLACE_EXISTING); + Files.copy(this.artifactStandalonePath, standalone, REPLACE_EXISTING); + Files.copy(this.artifactUnoptimizedPath, unoptimized, REPLACE_EXISTING); + Files.copy(this.artifactForgeApiPath, forgeApi, REPLACE_EXISTING); + Files.copy(this.artifactForgeStandalonePath, forgeStandalone, REPLACE_EXISTING); // Calculate all checksums and format them like "shasum" - List shasum = Stream.of(api, standalone, unoptimized, forge) + List shasum = Stream.of(api, forgeApi, standalone, forgeStandalone, unoptimized) .map(path -> sha1(path) + " " + path.getFileName().toString()) .collect(Collectors.toList()); diff --git a/buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java b/buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java index 590211d5..30ffddfb 100644 --- a/buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java +++ b/buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java @@ -73,7 +73,6 @@ public class ProguardTask extends BaritoneGradleTask { acquireDependencies(); proguardApi(); proguardStandalone(); - createForge(); cleanup(); } @@ -274,15 +273,13 @@ public class ProguardTask extends BaritoneGradleTask { private void proguardApi() throws Exception { runProguard(getTemporaryFile(PROGUARD_API_CONFIG)); Determinizer.determinize(this.proguardOut.toString(), this.artifactApiPath.toString(), Optional.empty()); + Determinizer.determinize(this.proguardOut.toString(), this.artifactForgeApiPath.toString(), Optional.of(mixin)); } private void proguardStandalone() throws Exception { runProguard(getTemporaryFile(PROGUARD_STANDALONE_CONFIG)); Determinizer.determinize(this.proguardOut.toString(), this.artifactStandalonePath.toString(), Optional.empty()); - } - - private void createForge() throws Exception { - Determinizer.determinize(this.proguardOut.toString(), this.artifactForgePath.toString(), Optional.of(mixin)); + Determinizer.determinize(this.proguardOut.toString(), this.artifactForgeStandalonePath.toString(), Optional.of(mixin)); } private void cleanup() {