Skip to content

Commit

Permalink
Merge pull request #4214 from wagyourtail/1.20/1.20.4
Browse files Browse the repository at this point in the history
1.20.4
  • Loading branch information
leijurv authored Jan 6, 2024
2 parents a945cfa + c146440 commit 3e7eb87
Show file tree
Hide file tree
Showing 27 changed files with 408 additions and 105 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew build -Pmod_version="$(git describe --always --tags | cut -c2-)"
run: ./gradlew build -Pmod_version="$(git describe --always --tags --first-parent | cut -c2-)"

- name: Archive Artifacts
uses: actions/upload-artifact@v3
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ RUN apt update -y

RUN apt install \
openjdk-17-jdk \
git \
--assume-yes

COPY . /code
Expand Down
37 changes: 23 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,19 @@ allprojects {
apply plugin: "maven-publish"

archivesBaseName = rootProject.archives_base_name
def vers = 'git describe --always --tags --dirty'.execute().text.trim()

def vers = ""
try {
vers = 'git describe --always --tags --first-parent --dirty'.execute().text.trim()
} catch (Exception e) {
println "Version detection failed: " + e
}
if (!vers.startsWith("v")) {
println "git doesn't appear to be installed!"
println "using version number: " + rootProject.mod_version
version = rootProject.mod_version
} else {
version = vers.substring(1)
println "Detected version " + version
}
group = rootProject.maven_group

Expand Down Expand Up @@ -66,18 +72,24 @@ allprojects {
}

dependencies {
minecraft "net.minecraft:minecraft:${rootProject.minecraft_version}"
// The following line declares the mojmap mappings, you may use other mappings as well
mappings "net.fabricmc:intermediary:${rootProject.minecraft_version}:v2"
mappings "net.minecraft:minecraft:${rootProject.minecraft_version}:client-mappings"
mappings "org.parchmentmc.data:parchment-1.19.2:2022.11.27@zip"

implementation "org.spongepowered:mixin:0.8.5"
implementation "org.ow2.asm:asm:9.3"
// The following line declares the yarn mappings you may select this one as well.
// mappings "net.fabricmc:yarn:1.17.1+build.32:v2"
//launchImplementation('dev.babbaj:nether-pathfinder:1.3.0')
implementation 'dev.babbaj:nether-pathfinder:1.4.1'
implementation "dev.babbaj:nether-pathfinder:${nether_pathfinder_version}"

implementation 'com.google.code.findbugs:jsr305:3.0.2'
}

unimined.minecraft(sourceSets.main, true) {
version rootProject.minecraft_version

mappings {
intermediary()
mojmap()
parchment("1.20.2", "2023.10.22")
}
}

tasks.withType(JavaCompile).configureEach {
Expand All @@ -90,8 +102,9 @@ allprojects {
}
}

minecraft {
unimined.minecraft {
runs.off = true
defaultRemapJar = false
}

archivesBaseName = archivesBaseName + "-common"
Expand Down Expand Up @@ -131,10 +144,6 @@ jar {
from sourceSets.main.output, sourceSets.launch.output, sourceSets.api.output
}

remapJar {
target = "mojmap"
}

javadoc {
options.addStringOption('Xwerror', '-quiet') // makes the build fail on travis when there is a javadoc error
options.linkSource true
Expand Down
8 changes: 6 additions & 2 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,16 @@ repositories {
name = 'FabricMaven'
url = 'https://maven.fabricmc.net/'
}
maven {
name = 'NeoForgedMaven'
url = 'https://maven.neoforged.net/'
}
mavenCentral()
}

dependencies {
implementation group: 'com.google.code.gson', name: 'gson', version: '2.9.0'
implementation group: 'commons-io', name: 'commons-io', version: '2.6'
implementation group: 'commons-io', name: 'commons-io', version: '2.7'

implementation group: 'xyz.wagyourtail.unimined', name: 'xyz.wagyourtail.unimined.gradle.plugin', version: '0.4.10'
implementation group: 'xyz.wagyourtail.unimined', name: 'xyz.wagyourtail.unimined.gradle.plugin', version: '1.1.0'
}
25 changes: 12 additions & 13 deletions buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,21 @@
import baritone.gradle.util.Determinizer;
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.SourceSetContainer;
import org.gradle.api.tasks.TaskAction;
import org.gradle.api.tasks.TaskCollection;
import org.gradle.api.tasks.compile.ForkOptions;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.internal.jvm.Jvm;
import xyz.wagyourtail.unimined.api.Constants;
import xyz.wagyourtail.unimined.api.minecraft.EnvType;
import xyz.wagyourtail.unimined.api.minecraft.MinecraftProvider;
import xyz.wagyourtail.unimined.api.UniminedExtension;
import xyz.wagyourtail.unimined.api.minecraft.MinecraftConfig;

import java.io.*;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
Expand Down Expand Up @@ -63,8 +62,6 @@ public String getExtract() {

private List<String> requiredLibraries;

private File pathfinder;

@TaskAction
protected void exec() throws Exception {
super.doFirst();
Expand All @@ -74,29 +71,31 @@ protected void exec() throws Exception {
downloadProguard();
extractProguard();
generateConfigs();
pathfinder = acquireDependencies().filter(file -> file.getName().contains("nether-pathfinder")).findAny().get();
processArtifact();
proguardApi();
proguardStandalone();
cleanup();
}

MinecraftProvider<?, ?> provider = this.getProject().getExtensions().getByType(MinecraftProvider.class);
UniminedExtension ext = getProject().getExtensions().getByType(UniminedExtension.class);
SourceSetContainer sourceSets = getProject().getExtensions().getByType(SourceSetContainer.class);

private File getMcJar() {
return provider.getMinecraftWithMapping(EnvType.COMBINED, provider.getMcPatcher().getProdNamespace(), provider.getMcPatcher().getProdNamespace()).toFile();
MinecraftConfig mcc = ext.getMinecrafts().get(sourceSets.getByName("main"));
return mcc.getMinecraft(mcc.getMcPatcher().getProdNamespace(), mcc.getMcPatcher().getProdNamespace()).toFile();
}

private boolean isMcJar(File f) {
return this.getProject().getConfigurations().getByName(Constants.MINECRAFT_COMBINED_PROVIDER).getFiles().contains(f);
MinecraftConfig mcc = ext.getMinecrafts().get(sourceSets.getByName("main"));
return mcc.isMinecraftJar(f.toPath());
}

private void processArtifact() throws Exception {
if (Files.exists(this.artifactUnoptimizedPath)) {
Files.delete(this.artifactUnoptimizedPath);
}

Determinizer.determinize(this.artifactPath.toString(), this.artifactUnoptimizedPath.toString(), Arrays.asList(pathfinder), false);
Determinizer.determinize(this.artifactPath.toString(), this.artifactUnoptimizedPath.toString(), List.of(), false);
}

private void downloadProguard() throws Exception {
Expand Down Expand Up @@ -252,12 +251,12 @@ private Stream<File> acquireDependencies() {

private void proguardApi() throws Exception {
runProguard(getTemporaryFile(compType + PROGUARD_API_CONFIG));
Determinizer.determinize(this.proguardOut.toString(), this.artifactApiPath.toString(), Arrays.asList(pathfinder), false);
Determinizer.determinize(this.proguardOut.toString(), this.artifactApiPath.toString(), List.of(), false);
}

private void proguardStandalone() throws Exception {
runProguard(getTemporaryFile(compType + PROGUARD_STANDALONE_CONFIG));
Determinizer.determinize(this.proguardOut.toString(), this.artifactStandalonePath.toString(), Arrays.asList(pathfinder), false);
Determinizer.determinize(this.proguardOut.toString(), this.artifactStandalonePath.toString(), List.of(), false);
}

private static final class Pair<A, B> {
Expand Down
20 changes: 9 additions & 11 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ import baritone.gradle.task.CreateDistTask
import baritone.gradle.task.ProguardTask

plugins {
id "com.github.johnrengelman.shadow" version "7.0.0"
id "com.github.johnrengelman.shadow" version "8.0.0"
}

archivesBaseName = archivesBaseName + "-fabric"

minecraft {
fabric()
runs.client = {
jvmArgs.add("-XstartOnFirstThread")
unimined.minecraft {
fabric {
loader project.fabric_version
}
}

Expand All @@ -39,15 +38,14 @@ configurations {
}

dependencies {
fabric "net.fabricmc:fabric-loader:${project.fabric_version}"

// because of multiple sourcesets `common project(":")` doesn't work
for (sourceSet in rootProject.sourceSets) {
if (sourceSet == rootProject.sourceSets.test) continue
if (sourceSet == rootProject.sourceSets.schematica_api) continue
common sourceSet.output
shadowCommon sourceSet.output
}
include "dev.babbaj:nether-pathfinder:${nether_pathfinder_version}"
}

processResources {
Expand All @@ -60,17 +58,17 @@ processResources {

shadowJar {
configurations = [project.configurations.shadowCommon]
classifier "dev-shadow"
archiveClassifier.set "dev-shadow"
}

remapJar {
inputFile.set shadowJar.archiveFile
dependsOn shadowJar
classifier null
archiveClassifier.set null
}

jar {
classifier "dev"
archiveClassifier.set "dev"
}

components.java {
Expand Down Expand Up @@ -103,4 +101,4 @@ publishing {
repositories {
// Add repositories to publish to here.
}
}
}
3 changes: 1 addition & 2 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

{
"schemaVersion": 1,
"id": "baritone",
Expand Down Expand Up @@ -26,6 +25,6 @@

"depends": {
"fabricloader": ">=0.14.22",
"minecraft": "1.20.2"
"minecraft": ["1.20.3", "1.20.4"]
}
}
21 changes: 12 additions & 9 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,19 @@ import baritone.gradle.task.CreateDistTask
import baritone.gradle.task.ProguardTask

plugins {
id "com.github.johnrengelman.shadow" version "7.0.0"
id "com.github.johnrengelman.shadow" version "8.0.0"
}

archivesBaseName = archivesBaseName + "-forge"

minecraft {
unimined.minecraft {
mappings {
devFallbackNamespace "intermediary"
}

forge {
devFallbackNamespace = "intermediary"
mixinConfig = ["mixins.baritone.json"]
loader project.forge_version
mixinConfig ["mixins.baritone.json"]
}
}

Expand All @@ -45,15 +49,14 @@ configurations {
}

dependencies {
forge "net.minecraftforge:forge:${rootProject.forge_version}"

// because of multiple sourcesets `common project(":")` doesn't work
for (sourceSet in rootProject.sourceSets) {
if (sourceSet == rootProject.sourceSets.test) continue
if (sourceSet == rootProject.sourceSets.schematica_api) continue
common sourceSet.output
shadowCommon sourceSet.output
}
shadowCommon "dev.babbaj:nether-pathfinder:${nether_pathfinder_version}"
}

processResources {
Expand All @@ -66,17 +69,17 @@ processResources {

shadowJar {
configurations = [project.configurations.shadowCommon]
classifier "dev-shadow"
archiveClassifier.set "dev-shadow"
}

remapJar {
inputFile.set shadowJar.archiveFile
dependsOn shadowJar
classifier null
archiveClassifier.set null
}

jar {
classifier "dev"
archiveClassifier.set "dev"

manifest {
attributes(
Expand Down
2 changes: 1 addition & 1 deletion forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ A Minecraft pathfinder bot.
modId="minecraft"
mandatory=true
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange="[1.20.2]"
versionRange="[1.20.3, 1.20.4]"
ordering="NONE"
side="BOTH"
11 changes: 8 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
org.gradle.jvmargs=-Xmx4G

available_loaders=fabric,forge,tweaker
available_loaders=fabric,forge,neoforge,tweaker

mod_version=1.10.2
maven_group=baritone
archives_base_name=baritone

minecraft_version=1.20.2
forge_version=1.20.2-48.0.1
minecraft_version=1.20.4

forge_version=49.0.3
neoforge_version=0-beta

fabric_version=0.14.22

nether_pathfinder_version=1.4.1
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 3e7eb87

Please sign in to comment.