diff --git a/build.bat b/build.bat index 844fb1f..d58cbe9 100644 --- a/build.bat +++ b/build.bat @@ -1,10 +1,9 @@ @rem put this project path into PATH_FROM setlocal -set PATH_FROM=C:\Users\user\Documents\GitHub\Informatis +set PATH_FROM=C:\Users\jun\Documents\GitHub\Informatis @rem put your mindustry local path into PATH_TO setlocal -set PATH_TO=C:\Users\user\AppData\Roaming\Mindustry +set PATH_TO=C:\Users\jun\AppData\Roaming\Mindustry -if exist %PATH_TO%\mods\UnitInfo.jar del %PATH_TO%\mods\Informatis.jar -xcopy %PATH_FROM%\build\libs\Informatis.jar %PATH_TO%\mods\ /k /y -del %PATH_FROM%\build\libs\Informatis.jar \ No newline at end of file +if exist %PATH_TO%\mods\raw-Informatis.jar del %PATH_TO%\mods\raw-Informatis.jar +xcopy %PATH_FROM%\build\libs\raw-Informatis.jar %PATH_TO%\mods\ /k /y diff --git a/build.gradle b/build.gradle index f005dab..d09d92d 100644 --- a/build.gradle +++ b/build.gradle @@ -2,8 +2,13 @@ plugins { id 'java' } -group pGroup -version '1.0' +ext{ + sdkRoot = System.getenv("ANDROID_HOME") + sdkVersion = '30' + artifactFilename = "Informatis.jar" +} + +group "sharlotte" sourceSets.main { java.srcDir("src/") @@ -15,37 +20,41 @@ repositories { maven { url "https://jitpack.io" } } -jar { - archiveFileName.set pArtifactFilename - - from { - configurations.runtimeClasspath.collect { - it.isDirectory() ? it : zipTree(it) - } - } -} - - dependencies { - annotationProcessor 'com.github.Anuken:jabel:34e4c172e65b3928cd9eabe1993654ea79c409cd' - compileOnly "com.github.Anuken.MindustryJitpack:core:3ffa59efb6" + annotationProcessor 'com.github.Anuken:jabel:0.8.0' + compileOnly "com.github.Anuken.Mindustry:core:v137" compileOnly "com.github.Anuken.Arc:arc-core:dfcb21ce56" } -task dexify(type: Jar) { - archiveName "dexed-$pArtifactFilename" +jar.archiveFileName.set("raw-$artifactFilename") - final File jarArtifact = new File(tasks.jar.archiveFile.get().asFile.parent, pArtifactFilename), +def isWindows = System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("windows") + +task dexify(type: Jar){ + archiveFileName.set(artifactFilename) + + final File jarArtifact = new File(tasks.jar.archiveFile.get().asFile.parent, "raw-$artifactFilename"), dexedArtifact = new File(tasks.dexify.getTemporaryDir(), "dexed.jar") - doFirst { - exec { - workingDir dexedArtifact.parent - def command = ["d8", "--min-api", pMinApi, "--output", dexedArtifact, jarArtifact] - if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) - commandLine("cmd", "/c", *command) - else - commandLine(*command) + doFirst{ + //collect dependencies needed for desugaring + def files = (configurations.compileClasspath.asList() + configurations.runtimeClasspath.asList() + [new File("$sdkRoot/platforms/android-$sdkVersion/android.jar")]) + + exec{ + workingDir dexedArtifact.parent + def command = ["d8", "--min-api", "14"] + for(def file : files){ + command += "--classpath" + command += file.path + } + + command += ["--output", dexedArtifact, jarArtifact] + + if(isWindows){ + commandLine("cmd", "/c", *command) + }else{ + commandLine(*command) + } } } @@ -57,7 +66,7 @@ task buildDex dependsOn "build", "dexify" task buildMove(dependsOn: build) { doLast { copy { - from "build/libs/Informatis.jar" + from "build/libs/raw-Informatis.jar" into System.getenv("destination") } } @@ -65,12 +74,11 @@ task buildMove(dependsOn: build) { tasks.withType(JavaCompile){ targetCompatibility = 8 - sourceCompatibility = JavaVersion.VERSION_16 + sourceCompatibility = JavaVersion.VERSION_17 options.encoding = "UTF-8" - options.forkOptions.jvmArgs.addAll([ - '--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED', - '--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED' - ]) - options.compilerArgs.addAll(['--release', '8']) + options.compilerArgs += ["-Xlint:deprecation"] + if(JavaVersion.current() != JavaVersion.VERSION_1_8){ + options.compilerArgs.addAll(['--release', '8']) + } compileJava.options.fork = true } diff --git a/gradle.properties b/gradle.properties deleted file mode 100644 index 8fbe9aa..0000000 --- a/gradle.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Filename of output file (dexify prepends 'dexed-') (people will hate you if it isn't .jar) -pArtifactFilename = Informatis.jar -# Group of project (should line up with dirs in src/) -pGroup = sharlotte -# Version of Mindustry to use (if not working, consult jitpack.io) -pMindustryVersion = v136 -# Minimum API level for d8 (if you don't know what this is, leave it unless d8 yells at you) -pMinApi = 26 \ No newline at end of file diff --git a/src/informatis/ui/display/WaveInfoDisplay.java b/src/informatis/ui/display/WaveInfoDisplay.java index 729fe88..cfc0974 100644 --- a/src/informatis/ui/display/WaveInfoDisplay.java +++ b/src/informatis/ui/display/WaveInfoDisplay.java @@ -15,7 +15,7 @@ import static arc.Core.*; import static mindustry.Vars.*; public class WaveInfoDisplay { - public boolean waveShown; + private boolean waveShown; public void addWaveInfoTable() { Table waveInfoTable = new Table(Tex.buttonEdge4, table -> { diff --git a/src/informatis/ui/window/WaveWindow.java b/src/informatis/ui/window/WaveWindow.java index e4bfada..dcf4efd 100644 --- a/src/informatis/ui/window/WaveWindow.java +++ b/src/informatis/ui/window/WaveWindow.java @@ -155,7 +155,7 @@ public class WaveWindow extends Window implements Updatable { ObjectIntMap groups = getWaveGroup(index-1); int row = 0; - int max = Math.max(1, Math.round(window.getWidth()/2/8)); + int max = Math.max(1, Math.round(window.getWidth()/64)-5); for (SpawnGroup group : groups.keys()) { int spawners = state.rules.waveTeam.cores().size + (group.type.flying ? spawner.countFlyerSpawns() : spawner.countGroundSpawns()); int amount = groups.get(group);