diff --git a/fabric/src/main/java/baritone/launch/BaritoneFabricVersionProvider.java b/fabric/src/main/java/baritone/launch/BaritoneFabricVersionProvider.java
new file mode 100644
index 000000000..142e8d969
--- /dev/null
+++ b/fabric/src/main/java/baritone/launch/BaritoneFabricVersionProvider.java
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+public class BaritoneFabricVersionProvider implements BaritoneVersionProvider {
+
+ @Override
+ public String getVersion() {
+ return FabricLoader.getInstance().getModContainer("baritone").get().getMetadata().getVersion().getFriendlyString();
+ }
+}
diff --git a/fabric/src/main/resources/META-INF/services/baritone.launch.BaritoneVersionProvider b/fabric/src/main/resources/META-INF/services/baritone.launch.BaritoneVersionProvider
new file mode 100644
index 000000000..7a95089cc
--- /dev/null
+++ b/fabric/src/main/resources/META-INF/services/baritone.launch.BaritoneVersionProvider
@@ -0,0 +1,18 @@
+#
+# 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 .
+#
+
+baritone.launch.BaritoneFabricVersionProvider
\ No newline at end of file
diff --git a/forge/src/main/java/baritone/launch/BaritoneForgeVersionProvider.java b/forge/src/main/java/baritone/launch/BaritoneForgeVersionProvider.java
new file mode 100644
index 000000000..c1c2246a5
--- /dev/null
+++ b/forge/src/main/java/baritone/launch/BaritoneForgeVersionProvider.java
@@ -0,0 +1,28 @@
+/*
+ * 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.minecraftforge.fml.ModList;
+
+public class BaritoneForgeVersionProvider implements BaritoneVersionProvider {
+
+ @Override
+ public String getVersion() {
+ return ModList.get().getModContainerById("baritoe").get().getModInfo().getVersion().toString();
+ }
+}
diff --git a/forge/src/main/resources/META-INF/services/baritone.launch.BaritoneVersionProvider b/forge/src/main/resources/META-INF/services/baritone.launch.BaritoneVersionProvider
new file mode 100644
index 000000000..d2ae36614
--- /dev/null
+++ b/forge/src/main/resources/META-INF/services/baritone.launch.BaritoneVersionProvider
@@ -0,0 +1,18 @@
+#
+# 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 .
+#
+
+baritone.launch.BaritoneForgeVersionProvider
\ No newline at end of file
diff --git a/src/main/java/baritone/command/defaults/VersionCommand.java b/src/main/java/baritone/command/defaults/VersionCommand.java
index c8e13558b..dcd2ccb5d 100644
--- a/src/main/java/baritone/command/defaults/VersionCommand.java
+++ b/src/main/java/baritone/command/defaults/VersionCommand.java
@@ -22,13 +22,17 @@
import baritone.api.command.argument.IArgConsumer;
import baritone.api.command.exception.CommandException;
import baritone.api.command.exception.CommandInvalidStateException;
+import baritone.launch.BaritoneVersionProvider;
import java.util.Arrays;
import java.util.List;
+import java.util.ServiceLoader;
import java.util.stream.Stream;
public class VersionCommand extends Command {
+ private static final BaritoneVersionProvider versionProvider = ServiceLoader.load(BaritoneVersionProvider.class, VersionCommand.class.getClassLoader()).findFirst().orElseThrow();
+
public VersionCommand(IBaritone baritone) {
super(baritone, "version");
}
@@ -36,7 +40,7 @@ public VersionCommand(IBaritone baritone) {
@Override
public void execute(String label, IArgConsumer args) throws CommandException {
args.requireMax(0);
- String version = getClass().getPackage().getImplementationVersion();
+ String version = versionProvider.getVersion();
if (version == null) {
throw new CommandInvalidStateException("Null version (this is normal in a dev environment)");
} else {
@@ -63,4 +67,5 @@ public List getLongDesc() {
"> version - View version information, if present"
);
}
+
}
diff --git a/src/main/java/baritone/launch/BaritoneVersionProvider.java b/src/main/java/baritone/launch/BaritoneVersionProvider.java
new file mode 100644
index 000000000..4e093b34a
--- /dev/null
+++ b/src/main/java/baritone/launch/BaritoneVersionProvider.java
@@ -0,0 +1,23 @@
+/*
+ * 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;
+
+public interface BaritoneVersionProvider {
+ String getVersion();
+
+}
diff --git a/tweaker/src/main/java/baritone/launch/BaritoneTweakerVersionProvider.java b/tweaker/src/main/java/baritone/launch/BaritoneTweakerVersionProvider.java
new file mode 100644
index 000000000..903f21c95
--- /dev/null
+++ b/tweaker/src/main/java/baritone/launch/BaritoneTweakerVersionProvider.java
@@ -0,0 +1,26 @@
+/*
+ * 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;
+
+public class BaritoneTweakerVersionProvider implements BaritoneVersionProvider {
+
+ @Override
+ public String getVersion() {
+ return getClass().getPackage().getImplementationVersion();
+ }
+}
diff --git a/tweaker/src/main/resources/META-INF/services/baritone.launch.BaritoneVersionProvider b/tweaker/src/main/resources/META-INF/services/baritone.launch.BaritoneVersionProvider
new file mode 100644
index 000000000..ef4d2ce68
--- /dev/null
+++ b/tweaker/src/main/resources/META-INF/services/baritone.launch.BaritoneVersionProvider
@@ -0,0 +1,18 @@
+#
+# 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 .
+#
+
+baritone.launch.BaritoneTweakerVersionProvider
\ No newline at end of file