Skip to content

Commit

Permalink
feat: support window version
Browse files Browse the repository at this point in the history
  • Loading branch information
sharrlotte committed Dec 11, 2023
1 parent 6bd4a2b commit 5c5fe04
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 17 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Mindustry Java Mod Template

A Java Mindustry mod template that works on Android and PC. The Kotlin version of this mod can be seen [here](https://github.com/Anuken/MindustryKotlinModTemplate).

## Building for Desktop Testing
Expand All @@ -12,13 +13,15 @@ To build an Android-compatible version, you need the Android SDK. You can either

This repository is set up with Github Actions CI to automatically build the mod for you every commit. This requires a Github repository, for obvious reasons.
To get a jar file that works for every platform, do the following:

1. Make a Github repository with your mod name, and upload the contents of this repo to it. Perform any modifications necessary, then commit and push.
2. Check the "Actions" tab on your repository page. Select the most recent commit in the list. If it completed successfully, there should be a download link under the "Artifacts" section.
3. Click the download link (should be the name of your repo). This will download a **zipped jar** - **not** the jar file itself [2]! Unzip this file and import the jar contained within in Mindustry. This version should work both on Android and Desktop.

## Building Locally

Building locally takes more time to set up, but shouldn't be a problem if you've done Android development before.

1. Download the Android SDK, unzip it and set the `ANDROID_HOME` environment variable to its location.
2. Make sure you have API level 30 installed, as well as any recent version of build tools (e.g. 30.0.1)
3. Add a build-tools folder to your PATH. For example, if you have `30.0.1` installed, that would be `$ANDROID_HOME/build-tools/30.0.1`.
Expand Down
2 changes: 1 addition & 1 deletion mod.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ author: "VN-Shar"

main: "main.Main"

description: "A Mindustry Java mod."
description: "A online schematic browser"

version: 1.1

Expand Down
16 changes: 2 additions & 14 deletions src/main/Main.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package main;

import arc.Events;
import arc.scene.ui.Dialog;
import main.config.Config;
import main.gui.SchematicDialog;
import mindustry.Vars;
import mindustry.game.EventType.ClientLoadEvent;
Expand All @@ -13,18 +11,8 @@ public class Main extends Mod {

public Main() {
Events.on(ClientLoadEvent.class, e -> {
if (Config.DEV == false || Vars.android == true) {
SchematicDialog schematicDialog = new SchematicDialog();
Vars.ui.schematics.buttons.button("Browse", Icon.menu, () -> schematicDialog.show());
} else {
Dialog dialog = new Dialog();
dialog.add(
"Desktop and IOS is not support because of some technical reason, please turn off the mod and use the website (Mindustry tool)");
dialog.addCloseButton();
dialog.closeOnBack();
dialog.fill();
dialog.show();
}
SchematicDialog schematicDialog = new SchematicDialog();
Vars.ui.schematics.buttons.button("Browse", Icon.menu, () -> schematicDialog.show());
});
}
}
4 changes: 2 additions & 2 deletions src/main/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

public class Config {

private static final String DEV_URL = "https://mindustry-tool-backend.onrender.com/api/v3/";
private static final String DEV_URL = "https://api.mindustry-tool.app/api/v3/";
// private static final String DEV_URL = "http://localhost:8080/api/v3/";
private static final String PROD_URL = "https://mindustry-tool-backend.onrender.com/api/v3/";
private static final String PROD_URL = "https://api.mindustry-tool.app/api/v3/";
private static final String ENV = System.getenv("ENV");
public static final boolean DEV = (ENV != null && ENV.equals("DEV"));
public static final String API_URL = DEV ? DEV_URL : PROD_URL;
Expand Down

0 comments on commit 5c5fe04

Please sign in to comment.