Skip to content

Commit

Permalink
Meteor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MineGame159 committed Jan 26, 2024
1 parent 8a0f301 commit 30921ca
Show file tree
Hide file tree
Showing 10 changed files with 107 additions and 14 deletions.
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Expand Down
22 changes: 18 additions & 4 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
}
71 changes: 71 additions & 0 deletions fabric/src/main/java/baritone/launch/FabricMixinPlugin.java
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*/

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<String> myTargets, Set<String> otherTargets) {}

@Override
public List<String> 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) {}
}
4 changes: 2 additions & 2 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"schemaVersion": 1,
"id": "baritone",
"id": "baritone-meteor",
"version": "${version}",

"name": "Baritone",
Expand All @@ -20,7 +20,7 @@
"entrypoints": {
},
"mixins": [
"mixins.baritone.json"
"mixins.baritone-meteor.json"
],

"depends": {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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

Expand Down
5 changes: 5 additions & 0 deletions scripts/proguard.pro
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Meteor
-keep class *



-keepattributes Signature
-keepattributes *Annotation*
-keepattributes InnerClasses
Expand Down
2 changes: 1 addition & 1 deletion src/api/java/baritone/api/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Boolean> chatControl = new Setting<>(true);
public final Setting<Boolean> chatControl = new Setting<>(false);

/**
* Some clients like Impact try to force chatControl to off, so here's a second setting to do it anyway
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public class BaritoneMixinConnector implements IMixinConnector {

@Override
public void connect() {
Mixins.addConfiguration("mixins.baritone.json");
Mixins.addConfiguration("mixins.baritone-meteor.json");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@
"MixinPlayerController",
"MixinScreen",
"MixinWorldRenderer"
]
],
"plugin": "baritone.launch.FabricMixinPlugin"
}
2 changes: 1 addition & 1 deletion tweaker/src/main/java/baritone/launch/BaritoneTweaker.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}

0 comments on commit 30921ca

Please sign in to comment.