Skip to content

Commit 998b65b

Browse files
committed
Meteor changes
1 parent 612a8a6 commit 998b65b

File tree

9 files changed

+110
-13
lines changed

9 files changed

+110
-13
lines changed

build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ allprojects {
2222

2323
archivesBaseName = rootProject.archives_base_name
2424

25-
def vers = ""
25+
/*def vers = ""
2626
try {
2727
vers = 'git describe --always --tags --first-parent --dirty'.execute().text.trim()
2828
} catch (Exception e) {
@@ -34,7 +34,9 @@ allprojects {
3434
} else {
3535
version = vers.substring(1)
3636
println "Detected version " + version
37-
}
37+
}*/
38+
39+
version = rootProject.mod_version
3840
group = rootProject.maven_group
3941

4042
sourceCompatibility = targetCompatibility = JavaVersion.toVersion(project.java_version)

fabric/build.gradle

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,36 @@ task createDist(type: CreateDistTask, dependsOn: proguard) {
8686
compType "fabric"
8787
}
8888

89+
task sourcesJar(type: Jar, dependsOn: classes) {
90+
from rootProject.sourceSets.main.allJava
91+
from rootProject.sourceSets.api.allJava
92+
archiveClassifier.set("sources")
93+
}
94+
8995
build.finalizedBy(createDist)
9096

9197
publishing {
9298
publications {
93-
mavenFabric(MavenPublication) {
94-
artifactId = rootProject.archives_base_name + "-" + project.name
95-
from components.java
99+
maven(MavenPublication) {
100+
groupId "meteordevelopment"
101+
artifactId "baritone"
102+
artifact "../dist/baritone-api-fabric-" + version + ".jar"
103+
artifact sourcesJar
96104
}
97105
}
98106

99107
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
100108
repositories {
101-
// Add repositories to publish to here.
109+
maven {
110+
name = "meteor-maven"
111+
url = "https://maven.meteordev.org/snapshots"
112+
credentials {
113+
username = System.getenv("MAVEN_METEOR_ALIAS")
114+
password = System.getenv("MAVEN_METEOR_TOKEN")
115+
}
116+
authentication {
117+
basic(BasicAuthentication)
118+
}
119+
}
102120
}
103121
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* This file is part of Baritone.
3+
*
4+
* Baritone is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* Baritone is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Lesser General Public License
15+
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
package baritone.launch;
19+
20+
import net.fabricmc.loader.api.FabricLoader;
21+
import org.objectweb.asm.tree.ClassNode;
22+
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
23+
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
24+
25+
import java.util.List;
26+
import java.util.Set;
27+
28+
public class FabricMixinPlugin implements IMixinConfigPlugin {
29+
private static final String mixinPackage = "baritone.launch.mixins";
30+
31+
private static boolean loaded;
32+
33+
private static boolean isBaritonePresent;
34+
35+
@Override
36+
public void onLoad(String mixinPackage) {
37+
if (loaded) return;
38+
39+
isBaritonePresent = FabricLoader.getInstance().isModLoaded("baritone");
40+
41+
loaded = true;
42+
}
43+
44+
@Override
45+
public String getRefMapperConfig() {
46+
return null;
47+
}
48+
49+
@Override
50+
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
51+
if (!mixinClassName.startsWith(mixinPackage)) {
52+
throw new RuntimeException("Mixin " + mixinClassName + " is not in the mixin package");
53+
} else {
54+
return !isBaritonePresent;
55+
}
56+
}
57+
58+
@Override
59+
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {}
60+
61+
@Override
62+
public List<String> getMixins() {
63+
return null;
64+
}
65+
66+
@Override
67+
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {}
68+
69+
@Override
70+
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {}
71+
}

fabric/src/main/resources/fabric.mod.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"schemaVersion": 1,
3-
"id": "baritone",
3+
"id": "baritone-meteor",
44
"version": "${version}",
55

66
"name": "Baritone",
@@ -21,7 +21,7 @@
2121
"entrypoints": {
2222
},
2323
"mixins": [
24-
"mixins.baritone.json"
24+
"mixins.baritone-meteor.json"
2525
],
2626
"depends": {
2727
"fabricloader": ">=0.14.22",

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
org.gradle.jvmargs=-Xmx4G
22

3-
available_loaders=fabric,neoforge,forge,tweaker
3+
available_loaders=fabric
44

5-
mod_version=1.15.0
5+
mod_version=1.21.8-SNAPSHOT
66
maven_group=baritone
77
archives_base_name=baritone
88

scripts/proguard.pro

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Meteor
2+
-keep class *
3+
4+
5+
16
-keepattributes Signature
27
-keepattributes *Annotation*
38
-keepattributes InnerClasses

src/api/java/baritone/api/Settings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ public final class Settings {
682682
* Allow chat based control of Baritone. Most likely should be disabled when Baritone is imported for use in
683683
* something else
684684
*/
685-
public final Setting<Boolean> chatControl = new Setting<>(true);
685+
public final Setting<Boolean> chatControl = new Setting<>(false);
686686

687687
/**
688688
* Some clients like Impact try to force chatControl to off, so here's a second setting to do it anyway

src/launch/resources/mixins.baritone.json renamed to src/launch/resources/mixins.baritone-meteor.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@
3030
"MixinWorldRenderer"
3131
],
3232
"mixins": [
33-
]
33+
],
34+
"plugin": "baritone.launch.FabricMixinPlugin"
3435
}

tweaker/src/main/java/baritone/launch/tweaker/BaritoneTweaker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ public void injectIntoClassLoader(LaunchClassLoader classLoader) {
5050
MixinEnvironment.getDefaultEnvironment().setSide(MixinEnvironment.Side.CLIENT);
5151
MixinEnvironment.getDefaultEnvironment().setObfuscationContext(obfuscation);
5252

53-
Mixins.addConfiguration("mixins.baritone.json");
53+
Mixins.addConfiguration("mixins.baritone-meteor.json");
5454
}
5555
}

0 commit comments

Comments
 (0)