Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Lime712 authored Jan 3, 2024
1 parent dde1160 commit fd1fd79
Show file tree
Hide file tree
Showing 14 changed files with 46 additions and 54 deletions.
43 changes: 5 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,6 @@
# 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).
# Just Another Tantros Mod
A Java Mindustry mod that works on Android and PC, made by Lime712. **Does not support iOS**.

## Building for Desktop Testing

1. Install JDK **17**.
2. Run `gradlew jar` [1].
3. Your mod jar will be in the `build/libs` directory. **Only use this version for testing on desktop. It will not work with Android.**
To build an Android-compatible version, you need the Android SDK. You can either let Github Actions handle this, or set it up yourself. See steps below.

## Building through Github Actions

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`.
4. Run `gradlew deploy`. If you did everything correctlly, this will create a jar file in the `build/libs` directory that can be run on both Android and desktop.

## Adding Dependencies

Please note that all dependencies on Mindustry, Arc or its submodules **must be declared as compileOnly in Gradle**. Never use `implementation` for core Mindustry or Arc dependencies.

- `implementation` **places the entire dependency in the jar**, which is, in most mod dependencies, very undesirable. You do not want the entirety of the Mindustry API included with your mod.
- `compileOnly` means that the dependency is only around at compile time, and not included in the jar.

Only use `implementation` if you want to package another Java library *with your mod*, and that library is not present in Mindustry already.

---

*[1]* *On Linux/Mac it's `./gradlew`, but if you're using Linux I assume you know how to run executables properly anyway.*
*[2]: Yes, I know this is stupid. It's a Github UI limitation - while the jar itself is uploaded unzipped, there is currently no way to download it as a single file.*
## Content
Currently: 4 new items, 2 new liquids
Planned: 8 new items, 3 new liquids, >19 new blocks, ?? new units
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
14 changes: 7 additions & 7 deletions mod.hjson
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#the mod name as displayed in-game
displayName: "Java Mod Template"
displayName: "Just Another Tantros Mod"

#the internal name of your mod
name: "example-java-mod"
name: "jatm"

#your name
author: "You"
author: "Lime712"

#the fully qualified main class of the mod
main: "example.ExampleJavaMod"
main: "jatm.JustAnotherTantrosMod"

#the mod description as seen in the mod dialog
description: "A Mindustry Java mod template."
description: "[red]EN: Adds the hidden planet Tantros, along with additional content (like many other mods). Does not support iOS devices.[gold]\n\nDE: Fügt der versteckte Planet Tantros das Spiel hinzu, zusammen mit zusätzlichen Inhalt (Wie eine Menge andere Mods). Nicht verfügbar auf iOS"

#the mod version
version: 1.0
version: 0

#the minimum game build required to run this mod
minGameVersion: 145
minGameVersion: 146

#this is a java mod
java: true
11 changes: 5 additions & 6 deletions src/jatm/JustAnotherTantrosMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,21 @@
import mindustry.gen.*;
import mindustry.mod.*;
import mindustry.ui.dialogs.*;
import mindustry.type.*;
import jatm.content.*;

public class JustAnotherTantrosMod extends Mod{

public JustAnotherTantrosMod(){
Log.info("Loaded JustAnotherTantrosMod constructor.");

Events.on(ClientLoadEvent.class, e -> {
Planets.tantros.accessible = Planets.tantros.alwaysUnlocked = Planets.tantros.visible = true;
Planets.tantros.allowLaunchToNumbered = Planets.tantros.allowLaunchLoadout = false;
});
Log.info("Loaded JATM constructor.");
Planets.tantros.accessible = Planets.tantros.alwaysUnlocked = Planets.tantros.visible = true;
Planets.tantros.allowLaunchToNumbered = Planets.tantros.allowLaunchLoadout = false;
}

@Override
public void loadContent(){
JATMItems.load();
JATMLiquids.load();
for (Planet planet : Vars.content.planets()) {
if (planet.name != "tantros")
planet.hiddenItems.addAll(JATMItems.tantrosOnlyItems);
Expand Down
6 changes: 3 additions & 3 deletions src/jatm/content/JATMItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import arc.graphics.*;
import arc.struct.*;
import mindustry.type.*;
import mindustry.content.items.*;
import mindustry.content.*;

public class JATMItems{
public static Item
Expand All @@ -13,7 +13,7 @@ public class JATMItems{

public static void load(){
aluminium = new Item("aluminium", Color.valueOf("a89fc9")){{
hardness = 4;
hardness = 3;
cost = 0.6f;
healthScaling = 0.1f;
}};
Expand All @@ -31,7 +31,7 @@ public static void load(){
cost = 0.7f;
}};

tantrosItems.addAll(lead, metaglass, aluminium, corundum, lye, quicklime);
tantrosItems.addAll(lead, metaglass, silicon, aluminium, corundum, lye, quicklime);
tantrosOnlyItems.addAll(tantrosItems).removeAll(serpuloItems);
}
}
26 changes: 26 additions & 0 deletions src/jatm/content/JATMLiquids.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package jatm.content;

import arc.graphics.*;
import mindustry.type.*;
import mindustry.content.*;

public class JATMLiquids{
public static Liquid acid, brine; //methane

public static void load(){
acid = new Liquid("acid", Color.valueOf("000000")){{
heatCapacity = 0.3f;
effect = StatusEffects.corroded;
canStayOn.add(brine);
boilPoint = 0.6f;
gasColor = Color.valueOf("000000");
}};

brine = new Liquid("brine", Color.valueOf("000000")){{
heatCapacity = 0.25f;
effect = StatusEffects.wet;
boilPoint = 0.4f;
gasColor = Color.valueOf("000000");
}};
}
}

0 comments on commit fd1fd79

Please sign in to comment.