mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-19 16:57:15 +07:00
Merge branches 'master' and 'unsector' of https://github.com/Anuken/Mindustry into unsector
This commit is contained in:
commit
415252a5b2
@ -28,6 +28,8 @@ import java.util.stream.Collectors;
|
|||||||
public class RemoteMethodAnnotationProcessor extends AbstractProcessor{
|
public class RemoteMethodAnnotationProcessor extends AbstractProcessor{
|
||||||
/** Maximum size of each event packet. */
|
/** Maximum size of each event packet. */
|
||||||
public static final int maxPacketSize = 4096;
|
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. */
|
/** Name of the base package to put all the generated classes. */
|
||||||
private static final String packageName = "io.anuke.mindustry.gen";
|
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
|
//create class for storing unique method hash
|
||||||
TypeSpec.Builder hashBuilder = TypeSpec.classBuilder("MethodHash").addModifiers(Modifier.PUBLIC);
|
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)
|
hashBuilder.addField(FieldSpec.builder(int.class, "HASH", Modifier.STATIC, Modifier.PUBLIC, Modifier.FINAL)
|
||||||
.initializer("$1L", Objects.hash(methods)).build());
|
.initializer("$1L", Objects.hash(methods)).build());
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ public class RemoteReadGenerator{
|
|||||||
/**
|
/**
|
||||||
* Generates a class for reading remote invoke packets.
|
* 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 className Simple target class name.
|
||||||
* @param packageName Full target package name.
|
* @param packageName Full target package name.
|
||||||
* @param needsPlayer Whether this read method requires a reference to the player sender.
|
* @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{
|
throws IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchMethodException, IOException{
|
||||||
|
|
||||||
TypeSpec.Builder classBuilder = TypeSpec.classBuilder(className).addModifiers(Modifier.PUBLIC);
|
TypeSpec.Builder classBuilder = TypeSpec.classBuilder(className).addModifiers(Modifier.PUBLIC);
|
||||||
|
classBuilder.addJavadoc(RemoteMethodAnnotationProcessor.autogenWarning);
|
||||||
|
|
||||||
//create main method builder
|
//create main method builder
|
||||||
MethodSpec.Builder readMethod = MethodSpec.methodBuilder("readPacket")
|
MethodSpec.Builder readMethod = MethodSpec.methodBuilder("readPacket")
|
||||||
|
@ -29,6 +29,7 @@ public class RemoteWriteGenerator{
|
|||||||
for(ClassEntry entry : entries){
|
for(ClassEntry entry : entries){
|
||||||
//create builder
|
//create builder
|
||||||
TypeSpec.Builder classBuilder = TypeSpec.classBuilder(entry.name).addModifiers(Modifier.PUBLIC);
|
TypeSpec.Builder classBuilder = TypeSpec.classBuilder(entry.name).addModifiers(Modifier.PUBLIC);
|
||||||
|
classBuilder.addJavadoc(RemoteMethodAnnotationProcessor.autogenWarning);
|
||||||
|
|
||||||
//add temporary write buffer
|
//add temporary write buffer
|
||||||
classBuilder.addField(FieldSpec.builder(ByteBuffer.class, "TEMP_BUFFER", Modifier.STATIC, Modifier.PRIVATE, Modifier.FINAL)
|
classBuilder.addField(FieldSpec.builder(ByteBuffer.class, "TEMP_BUFFER", Modifier.STATIC, Modifier.PRIVATE, Modifier.FINAL)
|
||||||
|
@ -46,6 +46,7 @@ public class SerializeAnnotationProcessor extends AbstractProcessor{
|
|||||||
|
|
||||||
TypeSpec.Builder classBuilder = TypeSpec.classBuilder(className).addModifiers(Modifier.PUBLIC);
|
TypeSpec.Builder classBuilder = TypeSpec.classBuilder(className).addModifiers(Modifier.PUBLIC);
|
||||||
classBuilder.addAnnotation(AnnotationSpec.builder(SuppressWarnings.class).addMember("value", "\"unchecked\"").build());
|
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);
|
MethodSpec.Builder method = MethodSpec.methodBuilder("init").addModifiers(Modifier.PUBLIC, Modifier.STATIC);
|
||||||
|
|
||||||
for(TypeElement elem : elements){
|
for(TypeElement elem : elements){
|
||||||
|
46
build.gradle
46
build.gradle
@ -131,24 +131,6 @@ project(":ios"){
|
|||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
apply plugin: "robovm"
|
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{
|
task incrementConfig{
|
||||||
def vfile = file('robovm.properties')
|
def vfile = file('robovm.properties')
|
||||||
|
|
||||||
@ -166,11 +148,6 @@ project(":ios"){
|
|||||||
props.store(vfile.newWriter(), null)
|
props.store(vfile.newWriter(), null)
|
||||||
}
|
}
|
||||||
|
|
||||||
build.dependsOn(incrementConfig)
|
|
||||||
if(file('robovm.properties').exists()){
|
|
||||||
build.dependsOn(copyGen)
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies{
|
dependencies{
|
||||||
compile project(":core")
|
compile project(":core")
|
||||||
compile project(":net")
|
compile project(":net")
|
||||||
@ -191,8 +168,29 @@ project(":core"){
|
|||||||
generateLocales()
|
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{
|
dependencies{
|
||||||
build.finalizedBy(finish)
|
compileJava.dependsOn(cleanGen)
|
||||||
|
build.finalizedBy(copyGen)
|
||||||
|
|
||||||
compile arcModule("arc-core")
|
compile arcModule("arc-core")
|
||||||
compile arcModule("extensions:freetype")
|
compile arcModule("extensions:freetype")
|
||||||
|
@ -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.junction, new ItemStack(Items.copper, 2)).setAlwaysUnlocked(true);
|
||||||
new Recipe(distribution, DistributionBlocks.router, new ItemStack(Items.copper, 6)).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.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.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));
|
new Recipe(distribution, DistributionBlocks.overflowGate, new ItemStack(Items.densealloy, 4), new ItemStack(Items.copper, 8));
|
||||||
|
@ -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.*/
|
/**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;
|
this.tile = tile;
|
||||||
x = tile.drawx();
|
x = tile.drawx();
|
||||||
y = tile.drawy();
|
y = tile.drawy();
|
||||||
@ -80,7 +80,7 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{
|
|||||||
|
|
||||||
timer = new Interval(tile.block().timers);
|
timer = new Interval(tile.block().timers);
|
||||||
|
|
||||||
if(added){
|
if(shouldAdd){
|
||||||
add();
|
add();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user