From b57fb4785502674bbc2b66908ec8bfe6040b8368 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 14 Aug 2020 19:45:22 -0400 Subject: [PATCH] Compilation for Android on Java 9+ --- android/build.gradle | 2 ++ build.gradle | 9 +++++++++ core/src/mindustry/logic/LExecutor.java | 6 +++++- core/src/mindustry/world/blocks/defense/Door.java | 6 ++++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index 412ed1c441..8155900015 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -33,6 +33,8 @@ dependencies{ natives "com.github.Anuken.Arc:natives-android:${getArcHash()}" natives "com.github.Anuken.Arc:natives-freetype-android:${getArcHash()}" natives "com.github.Anuken.Arc:natives-box2d-android:${getArcHash()}" + + if(localArc()) compileOnly fileTree(dir: '../../Arc/backends/backend-android/libs', include: ['*.jar']) } task deploy(type: Copy){ diff --git a/build.gradle b/build.gradle index 007090e96f..86f06caef2 100644 --- a/build.gradle +++ b/build.gradle @@ -180,6 +180,15 @@ allprojects{ } } +//compile with java 8 compatibility for everything except the annotati project +configure(subprojects - project(":annotations")){ + tasks.withType(JavaCompile){ + if(JavaVersion.current() != JavaVersion.VERSION_1_8){ + options.compilerArgs.addAll(['--release', '8']) + } + } +} + project(":desktop"){ apply plugin: "java" diff --git a/core/src/mindustry/logic/LExecutor.java b/core/src/mindustry/logic/LExecutor.java index dab3acb8ec..cca17d35cd 100644 --- a/core/src/mindustry/logic/LExecutor.java +++ b/core/src/mindustry/logic/LExecutor.java @@ -501,7 +501,11 @@ public class LExecutor{ //this should avoid any garbage allocation Var v = exec.vars[value]; if(v.isobj && value != 0){ - String strValue = v.objval instanceof String ? (String)v.objval : v.objval == null ? "null" : "[object]"; + String strValue = v.objval instanceof String ? (String)v.objval : v.objval == null ? "null" : + v.objval instanceof Content ? "[content]" : + v.objval instanceof Building ? "[building]" : + v.objval instanceof Unit ? "[unit]" : + "[object]"; exec.textBuffer.append(strValue); }else{ diff --git a/core/src/mindustry/world/blocks/defense/Door.java b/core/src/mindustry/world/blocks/defense/Door.java index 3e9f1b64b6..e4d7ae0cae 100644 --- a/core/src/mindustry/world/blocks/defense/Door.java +++ b/core/src/mindustry/world/blocks/defense/Door.java @@ -73,6 +73,12 @@ public class Door extends Wall{ } } + @Override + public double sense(LAccess sensor){ + if(sensor == LAccess.enabled) return open ? 1 : 0; + return super.sense(sensor); + } + @Override public void control(LAccess type, double p1, double p2, double p3, double p4){ if(type == LAccess.enabled){