Merge branch 'master' of https://github.com/Anuken/Mindustry into crafting-rework

# Conflicts:
#	core/src/io/anuke/mindustry/content/Recipes.java
This commit is contained in:
Anuken 2019-01-06 09:45:11 -05:00
commit 307bb7aeec
6 changed files with 31 additions and 27 deletions

View File

@ -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());

View File

@ -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")

View File

@ -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)

View File

@ -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){

View File

@ -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")

View File

@ -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();
}