diff --git a/build.gradle b/build.gradle index 011f08993..18fc7ce25 100755 --- a/build.gradle +++ b/build.gradle @@ -22,7 +22,7 @@ allprojects { archivesBaseName = rootProject.archives_base_name - def vers = "" + /*def vers = "" try { vers = 'git describe --always --tags --first-parent --dirty'.execute().text.trim() } catch (Exception e) { @@ -34,7 +34,9 @@ allprojects { } else { version = vers.substring(1) println "Detected version " + version - } + }*/ + + version = rootProject.mod_version group = rootProject.maven_group sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17 diff --git a/fabric/build.gradle b/fabric/build.gradle index e6a88b352..93f7ec403 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -91,14 +91,28 @@ build.finalizedBy(createDist) publishing { publications { - mavenFabric(MavenPublication) { - artifactId = rootProject.archives_base_name + "-" + project.name - from components.java + maven(MavenPublication) { + groupId "meteordevelopment" + artifactId "baritone" + + artifact "../dist/baritone-api-fabric-" + version + ".jar" } } // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. repositories { - // Add repositories to publish to here. + maven { + name = "meteor-maven" + url = "https://maven.meteordev.org/snapshots" + + credentials { + username = System.getenv("MAVEN_METEOR_ALIAS") + password = System.getenv("MAVEN_METEOR_TOKEN") + } + + authentication { + basic(BasicAuthentication) + } + } } } diff --git a/fabric/src/main/java/baritone/launch/FabricMixinPlugin.java b/fabric/src/main/java/baritone/launch/FabricMixinPlugin.java new file mode 100644 index 000000000..655de50d4 --- /dev/null +++ b/fabric/src/main/java/baritone/launch/FabricMixinPlugin.java @@ -0,0 +1,71 @@ +/* + * This file is part of Baritone. + * + * Baritone is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Baritone is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Baritone. If not, see . + */ + +package baritone.launch; + +import net.fabricmc.loader.api.FabricLoader; +import org.objectweb.asm.tree.ClassNode; +import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; +import org.spongepowered.asm.mixin.extensibility.IMixinInfo; + +import java.util.List; +import java.util.Set; + +public class FabricMixinPlugin implements IMixinConfigPlugin { + private static final String mixinPackage = "baritone.launch.mixins"; + + private static boolean loaded; + + private static boolean isBaritonePresent; + + @Override + public void onLoad(String mixinPackage) { + if (loaded) return; + + isBaritonePresent = FabricLoader.getInstance().isModLoaded("baritone"); + + loaded = true; + } + + @Override + public String getRefMapperConfig() { + return null; + } + + @Override + public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { + if (!mixinClassName.startsWith(mixinPackage)) { + throw new RuntimeException("Mixin " + mixinClassName + " is not in the mixin package"); + } else { + return !isBaritonePresent; + } + } + + @Override + public void acceptTargets(Set myTargets, Set otherTargets) {} + + @Override + public List getMixins() { + return null; + } + + @Override + public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {} + + @Override + public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {} +} diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index c1512a6cc..39475b65b 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -1,6 +1,6 @@ { "schemaVersion": 1, - "id": "baritone", + "id": "baritone-meteor", "version": "${version}", "name": "Baritone", @@ -20,7 +20,7 @@ "entrypoints": { }, "mixins": [ - "mixins.baritone.json" + "mixins.baritone-meteor.json" ], "depends": { diff --git a/gradle.properties b/gradle.properties index 35c62e0a7..d1c608ccd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ org.gradle.jvmargs=-Xmx4G -available_loaders=fabric,forge,neoforge,tweaker +available_loaders=fabric -mod_version=1.10.2 +mod_version=1.20.4-SNAPSHOT maven_group=baritone archives_base_name=baritone diff --git a/scripts/proguard.pro b/scripts/proguard.pro index 34b76170f..13c10650c 100644 --- a/scripts/proguard.pro +++ b/scripts/proguard.pro @@ -1,3 +1,8 @@ +# Meteor +-keep class * + + + -keepattributes Signature -keepattributes *Annotation* -keepattributes InnerClasses diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 9171a3d68..be9830ae6 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -660,7 +660,7 @@ public final class Settings { * Allow chat based control of Baritone. Most likely should be disabled when Baritone is imported for use in * something else */ - public final Setting chatControl = new Setting<>(true); + public final Setting chatControl = new Setting<>(false); /** * Some clients like Impact try to force chatControl to off, so here's a second setting to do it anyway diff --git a/src/launch/java/baritone/launch/BaritoneMixinConnector.java b/src/launch/java/baritone/launch/BaritoneMixinConnector.java index 86069e14f..d32b83cbd 100644 --- a/src/launch/java/baritone/launch/BaritoneMixinConnector.java +++ b/src/launch/java/baritone/launch/BaritoneMixinConnector.java @@ -24,6 +24,6 @@ public class BaritoneMixinConnector implements IMixinConnector { @Override public void connect() { - Mixins.addConfiguration("mixins.baritone.json"); + Mixins.addConfiguration("mixins.baritone-meteor.json"); } } \ No newline at end of file diff --git a/src/launch/resources/mixins.baritone.json b/src/launch/resources/mixins.baritone-meteor.json similarity index 92% rename from src/launch/resources/mixins.baritone.json rename to src/launch/resources/mixins.baritone-meteor.json index 35d5ae0d6..f686c92e3 100644 --- a/src/launch/resources/mixins.baritone.json +++ b/src/launch/resources/mixins.baritone-meteor.json @@ -26,5 +26,6 @@ "MixinPlayerController", "MixinScreen", "MixinWorldRenderer" - ] + ], + "plugin": "baritone.launch.FabricMixinPlugin" } diff --git a/tweaker/src/main/java/baritone/launch/BaritoneTweaker.java b/tweaker/src/main/java/baritone/launch/BaritoneTweaker.java index b9db9b6a5..02e269506 100644 --- a/tweaker/src/main/java/baritone/launch/BaritoneTweaker.java +++ b/tweaker/src/main/java/baritone/launch/BaritoneTweaker.java @@ -50,6 +50,6 @@ public void injectIntoClassLoader(LaunchClassLoader classLoader) { MixinEnvironment.getDefaultEnvironment().setSide(MixinEnvironment.Side.CLIENT); MixinEnvironment.getDefaultEnvironment().setObfuscationContext(obfuscation); - Mixins.addConfiguration("mixins.baritone.json"); + Mixins.addConfiguration("mixins.baritone-meteor.json"); } }