diff --git a/annotations/src/main/java/io/anuke/annotations/RemoteMethodAnnotationProcessor.java b/annotations/src/main/java/io/anuke/annotations/RemoteMethodAnnotationProcessor.java index 2762b03a8e..1c5bb5301d 100644 --- a/annotations/src/main/java/io/anuke/annotations/RemoteMethodAnnotationProcessor.java +++ b/annotations/src/main/java/io/anuke/annotations/RemoteMethodAnnotationProcessor.java @@ -28,6 +28,8 @@ import java.util.stream.Collectors; public class RemoteMethodAnnotationProcessor extends AbstractProcessor{ /** Maximum size of each event packet. */ public static final int maxPacketSize = 4096; + /** Warning on top of each autogenerated file.*/ + public static final String autogenWarning = "Autogenerated file. Do not modify!\n"; /** Name of the base package to put all the generated classes. */ private static final String packageName = "io.anuke.mindustry.gen"; @@ -136,6 +138,7 @@ public class RemoteMethodAnnotationProcessor extends AbstractProcessor{ //create class for storing unique method hash TypeSpec.Builder hashBuilder = TypeSpec.classBuilder("MethodHash").addModifiers(Modifier.PUBLIC); + hashBuilder.addJavadoc(autogenWarning); hashBuilder.addField(FieldSpec.builder(int.class, "HASH", Modifier.STATIC, Modifier.PUBLIC, Modifier.FINAL) .initializer("$1L", Objects.hash(methods)).build()); diff --git a/annotations/src/main/java/io/anuke/annotations/RemoteReadGenerator.java b/annotations/src/main/java/io/anuke/annotations/RemoteReadGenerator.java index 524e590847..61382d3f24 100644 --- a/annotations/src/main/java/io/anuke/annotations/RemoteReadGenerator.java +++ b/annotations/src/main/java/io/anuke/annotations/RemoteReadGenerator.java @@ -28,7 +28,7 @@ public class RemoteReadGenerator{ /** * Generates a class for reading remote invoke packets. * - * @param entries List of methods to use/ + * @param entries List of methods to use. * @param className Simple target class name. * @param packageName Full target package name. * @param needsPlayer Whether this read method requires a reference to the player sender. @@ -37,6 +37,7 @@ public class RemoteReadGenerator{ throws IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchMethodException, IOException{ TypeSpec.Builder classBuilder = TypeSpec.classBuilder(className).addModifiers(Modifier.PUBLIC); + classBuilder.addJavadoc(RemoteMethodAnnotationProcessor.autogenWarning); //create main method builder MethodSpec.Builder readMethod = MethodSpec.methodBuilder("readPacket") diff --git a/annotations/src/main/java/io/anuke/annotations/RemoteWriteGenerator.java b/annotations/src/main/java/io/anuke/annotations/RemoteWriteGenerator.java index 7a6b42d74b..62cff1f25b 100644 --- a/annotations/src/main/java/io/anuke/annotations/RemoteWriteGenerator.java +++ b/annotations/src/main/java/io/anuke/annotations/RemoteWriteGenerator.java @@ -29,6 +29,7 @@ public class RemoteWriteGenerator{ for(ClassEntry entry : entries){ //create builder TypeSpec.Builder classBuilder = TypeSpec.classBuilder(entry.name).addModifiers(Modifier.PUBLIC); + classBuilder.addJavadoc(RemoteMethodAnnotationProcessor.autogenWarning); //add temporary write buffer classBuilder.addField(FieldSpec.builder(ByteBuffer.class, "TEMP_BUFFER", Modifier.STATIC, Modifier.PRIVATE, Modifier.FINAL) diff --git a/annotations/src/main/java/io/anuke/annotations/SerializeAnnotationProcessor.java b/annotations/src/main/java/io/anuke/annotations/SerializeAnnotationProcessor.java index cbfdc3bc06..bd6a7ee023 100644 --- a/annotations/src/main/java/io/anuke/annotations/SerializeAnnotationProcessor.java +++ b/annotations/src/main/java/io/anuke/annotations/SerializeAnnotationProcessor.java @@ -46,6 +46,7 @@ public class SerializeAnnotationProcessor extends AbstractProcessor{ TypeSpec.Builder classBuilder = TypeSpec.classBuilder(className).addModifiers(Modifier.PUBLIC); classBuilder.addAnnotation(AnnotationSpec.builder(SuppressWarnings.class).addMember("value", "\"unchecked\"").build()); + classBuilder.addJavadoc(RemoteMethodAnnotationProcessor.autogenWarning); MethodSpec.Builder method = MethodSpec.methodBuilder("init").addModifiers(Modifier.PUBLIC, Modifier.STATIC); for(TypeElement elem : elements){ diff --git a/build.gradle b/build.gradle index f4ff0f9303..679cd39490 100644 --- a/build.gradle +++ b/build.gradle @@ -131,24 +131,6 @@ project(":ios"){ apply plugin: "java" apply plugin: "robovm" - task copyGen{ - doLast{ - copy{ - from("../core/build/classes/java/main/io/anuke/mindustry/gen/"){ - include "**/*.java" - } - - into "../core/src/io/anuke/mindustry/gen" - } - } - - doFirst{ - delete{ - delete "../core/src/io/anuke/mindustry/gen/" - } - } - } - task incrementConfig{ def vfile = file('robovm.properties') @@ -166,11 +148,6 @@ project(":ios"){ props.store(vfile.newWriter(), null) } - build.dependsOn(incrementConfig) - if(file('robovm.properties').exists()){ - build.dependsOn(copyGen) - } - dependencies{ compile project(":core") compile project(":net") @@ -191,8 +168,29 @@ project(":core"){ generateLocales() } + task cleanGen{ + doFirst{ + delete{ + delete "../core/src/io/anuke/mindustry/gen/" + } + } + } + + task copyGen{ + doLast{ + copy{ + from("../core/build/classes/java/main/io/anuke/mindustry/gen/"){ + include "**/*.java" + } + + into "../core/src/io/anuke/mindustry/gen" + } + } + } + dependencies{ - build.finalizedBy(finish) + compileJava.dependsOn(cleanGen) + build.finalizedBy(copyGen) compile arcModule("arc-core") compile arcModule("extensions:freetype") diff --git a/core/src/io/anuke/mindustry/content/Recipes.java b/core/src/io/anuke/mindustry/content/Recipes.java index 9a01f786ab..19e30d8037 100644 --- a/core/src/io/anuke/mindustry/content/Recipes.java +++ b/core/src/io/anuke/mindustry/content/Recipes.java @@ -82,7 +82,7 @@ public class Recipes implements ContentList{ new Recipe(distribution, DistributionBlocks.junction, new ItemStack(Items.copper, 2)).setAlwaysUnlocked(true); new Recipe(distribution, DistributionBlocks.router, new ItemStack(Items.copper, 6)).setAlwaysUnlocked(true); - //advanced densealloy transporat + //advanced densealloy transport new Recipe(distribution, DistributionBlocks.distributor, new ItemStack(Items.densealloy, 8), new ItemStack(Items.copper, 8)); new Recipe(distribution, DistributionBlocks.sorter, new ItemStack(Items.densealloy, 4), new ItemStack(Items.copper, 4)); new Recipe(distribution, DistributionBlocks.overflowGate, new ItemStack(Items.densealloy, 4), new ItemStack(Items.copper, 8)); diff --git a/core/src/io/anuke/mindustry/entities/TileEntity.java b/core/src/io/anuke/mindustry/entities/TileEntity.java index 2f0ed4f3bc..c3dc293f95 100644 --- a/core/src/io/anuke/mindustry/entities/TileEntity.java +++ b/core/src/io/anuke/mindustry/entities/TileEntity.java @@ -71,7 +71,7 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{ } /**Sets this tile entity data to this tile, and adds it if necessary.*/ - public TileEntity init(Tile tile, boolean added){ + public TileEntity init(Tile tile, boolean shouldAdd){ this.tile = tile; x = tile.drawx(); y = tile.drawy(); @@ -80,7 +80,7 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{ timer = new Interval(tile.block().timers); - if(added){ + if(shouldAdd){ add(); }