This commit is contained in:
Anuken
2020-06-08 17:31:02 -04:00
parent 5be5d11c8e
commit 6dd9369066
35 changed files with 121 additions and 125 deletions

View File

@@ -1,7 +1,7 @@
package mindustry.annotations; package mindustry.annotations;
import arc.files.*; import arc.files.*;
import arc.struct.Array; import arc.struct.*;
import arc.util.*; import arc.util.*;
import arc.util.Log; import arc.util.Log;
import arc.util.Log.*; import arc.util.Log.*;
@@ -126,12 +126,12 @@ public abstract class BaseProcessor extends AbstractProcessor{
write(builder, null); write(builder, null);
} }
public static void write(TypeSpec.Builder builder, Array<String> imports) throws Exception{ public static void write(TypeSpec.Builder builder, Seq<String> imports) throws Exception{
JavaFile file = JavaFile.builder(packageName, builder.build()).skipJavaLangImports(true).build(); JavaFile file = JavaFile.builder(packageName, builder.build()).skipJavaLangImports(true).build();
if(imports != null){ if(imports != null){
String rawSource = file.toString(); String rawSource = file.toString();
Array<String> result = new Array<>(); Seq<String> result = new Seq<>();
for (String s : rawSource.split("\n", -1)) { for (String s : rawSource.split("\n", -1)) {
result.add(s); result.add(s);
if (s.startsWith("package ")) { if (s.startsWith("package ")) {
@@ -152,22 +152,22 @@ public abstract class BaseProcessor extends AbstractProcessor{
} }
} }
public Array<Selement> elements(Class<? extends Annotation> type){ public Seq<Selement> elements(Class<? extends Annotation> type){
return Array.with(env.getElementsAnnotatedWith(type)).map(Selement::new); return Seq.with(env.getElementsAnnotatedWith(type)).map(Selement::new);
} }
public Array<Stype> types(Class<? extends Annotation> type){ public Seq<Stype> types(Class<? extends Annotation> type){
return Array.with(env.getElementsAnnotatedWith(type)).select(e -> e instanceof TypeElement) return Seq.with(env.getElementsAnnotatedWith(type)).select(e -> e instanceof TypeElement)
.map(e -> new Stype((TypeElement)e)); .map(e -> new Stype((TypeElement)e));
} }
public Array<Svar> fields(Class<? extends Annotation> type){ public Seq<Svar> fields(Class<? extends Annotation> type){
return Array.with(env.getElementsAnnotatedWith(type)).select(e -> e instanceof VariableElement) return Seq.with(env.getElementsAnnotatedWith(type)).select(e -> e instanceof VariableElement)
.map(e -> new Svar((VariableElement)e)); .map(e -> new Svar((VariableElement)e));
} }
public Array<Smethod> methods(Class<? extends Annotation> type){ public Seq<Smethod> methods(Class<? extends Annotation> type){
return Array.with(env.getElementsAnnotatedWith(type)).select(e -> e instanceof ExecutableElement) return Seq.with(env.getElementsAnnotatedWith(type)).select(e -> e instanceof ExecutableElement)
.map(e -> new Smethod((ExecutableElement)e)); .map(e -> new Smethod((ExecutableElement)e));
} }

View File

@@ -24,7 +24,7 @@ public class EntityIO{
final String name; final String name;
final TypeSpec.Builder type; final TypeSpec.Builder type;
final Fi directory; final Fi directory;
final Array<Revision> revisions = new Array<>(); final Seq<Revision> revisions = new Seq<>();
boolean write; boolean write;
MethodSpec.Builder method; MethodSpec.Builder method;
@@ -47,7 +47,7 @@ public class EntityIO{
int nextRevision = revisions.isEmpty() ? 0 : revisions.max(r -> r.version).version + 1; int nextRevision = revisions.isEmpty() ? 0 : revisions.max(r -> r.version).version + 1;
//resolve preferred field order based on fields that fit //resolve preferred field order based on fields that fit
Array<FieldSpec> fields = Array.with(type.fieldSpecs).select(spec -> Seq<FieldSpec> fields = Seq.with(type.fieldSpecs).select(spec ->
!spec.hasModifier(Modifier.TRANSIENT) && !spec.hasModifier(Modifier.TRANSIENT) &&
!spec.hasModifier(Modifier.STATIC) && !spec.hasModifier(Modifier.STATIC) &&
!spec.hasModifier(Modifier.FINAL)/* && !spec.hasModifier(Modifier.FINAL)/* &&
@@ -110,7 +110,7 @@ public class EntityIO{
} }
} }
void writeSync(MethodSpec.Builder method, boolean write, Array<Svar> syncFields, Array<Svar> allFields) throws Exception{ void writeSync(MethodSpec.Builder method, boolean write, Seq<Svar> syncFields, Seq<Svar> allFields) throws Exception{
this.method = method; this.method = method;
this.write = write; this.write = write;
@@ -147,7 +147,7 @@ public class EntityIO{
} }
} }
void writeSyncManual(MethodSpec.Builder method, boolean write, Array<Svar> syncFields) throws Exception{ void writeSyncManual(MethodSpec.Builder method, boolean write, Seq<Svar> syncFields) throws Exception{
this.method = method; this.method = method;
this.write = write; this.write = write;
@@ -170,7 +170,7 @@ public class EntityIO{
} }
} }
void writeInterpolate(MethodSpec.Builder method, Array<Svar> fields) throws Exception{ void writeInterpolate(MethodSpec.Builder method, Seq<Svar> fields) throws Exception{
this.method = method; this.method = method;
cont("if(lastUpdated != 0 && updateSpacing != 0)"); cont("if(lastUpdated != 0 && updateSpacing != 0)");
@@ -234,7 +234,7 @@ public class EntityIO{
String struct = type.substring(0, type.indexOf("<")); String struct = type.substring(0, type.indexOf("<"));
String generic = type.substring(type.indexOf("<") + 1, type.indexOf(">")); String generic = type.substring(type.indexOf("<") + 1, type.indexOf(">"));
if(struct.equals("arc.struct.Queue") || struct.equals("arc.struct.Array")){ if(struct.equals("arc.struct.Queue") || struct.equals("arc.struct.Seq")){
if(write){ if(write){
s("i", field + ".size"); s("i", field + ".size");
cont("for(int INDEX = 0; INDEX < $L.size; INDEX ++)", field); cont("for(int INDEX = 0; INDEX < $L.size; INDEX ++)", field);
@@ -289,9 +289,9 @@ public class EntityIO{
public static class Revision{ public static class Revision{
int version; int version;
Array<RevisionField> fields; Seq<RevisionField> fields;
Revision(int version, Array<RevisionField> fields){ Revision(int version, Seq<RevisionField> fields){
this.version = version; this.version = version;
this.fields = fields; this.fields = fields;
} }
@@ -299,7 +299,7 @@ public class EntityIO{
Revision(){} Revision(){}
/** @return whether these two revisions are compatible */ /** @return whether these two revisions are compatible */
boolean equal(Array<FieldSpec> specs){ boolean equal(Seq<FieldSpec> specs){
if(fields.size != specs.size) return false; if(fields.size != specs.size) return false;
for(int i = 0; i < fields.size; i++){ for(int i = 0; i < fields.size; i++){

View File

@@ -30,18 +30,18 @@ import java.lang.annotation.*;
"mindustry.annotations.Annotations.TypeIOHandler" "mindustry.annotations.Annotations.TypeIOHandler"
}) })
public class EntityProcess extends BaseProcessor{ public class EntityProcess extends BaseProcessor{
Array<EntityDefinition> definitions = new Array<>(); Seq<EntityDefinition> definitions = new Seq<>();
Array<GroupDefinition> groupDefs = new Array<>(); Seq<GroupDefinition> groupDefs = new Seq<>();
Array<Stype> baseComponents; Seq<Stype> baseComponents;
ObjectMap<String, Stype> componentNames = new ObjectMap<>(); ObjectMap<String, Stype> componentNames = new ObjectMap<>();
ObjectMap<Stype, Array<Stype>> componentDependencies = new ObjectMap<>(); ObjectMap<Stype, Seq<Stype>> componentDependencies = new ObjectMap<>();
ObjectMap<Selement, Array<Stype>> defComponents = new ObjectMap<>(); ObjectMap<Selement, Seq<Stype>> defComponents = new ObjectMap<>();
ObjectMap<Svar, String> varInitializers = new ObjectMap<>(); ObjectMap<Svar, String> varInitializers = new ObjectMap<>();
ObjectMap<Smethod, String> methodBlocks = new ObjectMap<>(); ObjectMap<Smethod, String> methodBlocks = new ObjectMap<>();
ObjectSet<String> imports = new ObjectSet<>(); ObjectSet<String> imports = new ObjectSet<>();
Array<Selement> allGroups = new Array<>(); Seq<Selement> allGroups = new Seq<>();
Array<Selement> allDefs = new Array<>(); Seq<Selement> allDefs = new Seq<>();
Array<Stype> allInterfaces = new Array<>(); Seq<Stype> allInterfaces = new Seq<>();
ClassSerializer serializer; ClassSerializer serializer;
{ {
@@ -58,7 +58,7 @@ public class EntityProcess extends BaseProcessor{
if(round == 1){ if(round == 1){
serializer = TypeIOResolver.resolve(this); serializer = TypeIOResolver.resolve(this);
baseComponents = types(BaseComponent.class); baseComponents = types(BaseComponent.class);
Array<Stype> allComponents = types(Component.class); Seq<Stype> allComponents = types(Component.class);
//store code //store code
for(Stype component : allComponents){ for(Stype component : allComponents){
@@ -103,7 +103,7 @@ public class EntityProcess extends BaseProcessor{
} }
//implement super interfaces //implement super interfaces
Array<Stype> depends = getDependencies(component); Seq<Stype> depends = getDependencies(component);
for(Stype type : depends){ for(Stype type : depends){
inter.addSuperinterface(ClassName.get(packageName, interfaceName(type))); inter.addSuperinterface(ClassName.get(packageName, interfaceName(type)));
} }
@@ -133,7 +133,7 @@ public class EntityProcess extends BaseProcessor{
//getter //getter
if(!signatures.contains(cname + "()")){ if(!signatures.contains(cname + "()")){
inter.addMethod(MethodSpec.methodBuilder(cname).addModifiers(Modifier.ABSTRACT, Modifier.PUBLIC) inter.addMethod(MethodSpec.methodBuilder(cname).addModifiers(Modifier.ABSTRACT, Modifier.PUBLIC)
.addAnnotations(Array.with(field.annotations()).select(a -> a.toString().contains("Null")).map(AnnotationSpec::get)) .addAnnotations(Seq.with(field.annotations()).select(a -> a.toString().contains("Null")).map(AnnotationSpec::get))
.addJavadoc(field.doc() == null ? "" : field.doc()) .addJavadoc(field.doc() == null ? "" : field.doc())
.returns(field.tname()).build()); .returns(field.tname()).build());
} }
@@ -144,7 +144,7 @@ public class EntityProcess extends BaseProcessor{
inter.addMethod(MethodSpec.methodBuilder(cname).addModifiers(Modifier.ABSTRACT, Modifier.PUBLIC) inter.addMethod(MethodSpec.methodBuilder(cname).addModifiers(Modifier.ABSTRACT, Modifier.PUBLIC)
.addJavadoc(field.doc() == null ? "" : field.doc()) .addJavadoc(field.doc() == null ? "" : field.doc())
.addParameter(ParameterSpec.builder(field.tname(), field.name()) .addParameter(ParameterSpec.builder(field.tname(), field.name())
.addAnnotations(Array.with(field.annotations()) .addAnnotations(Seq.with(field.annotations())
.select(a -> a.toString().contains("Null")).map(AnnotationSpec::get)).build()).build()); .select(a -> a.toString().contains("Null")).map(AnnotationSpec::get)).build()).build());
} }
} }
@@ -161,7 +161,7 @@ public class EntityProcess extends BaseProcessor{
//log methods generated //log methods generated
for(MethodSpec spec : inter.methodSpecs){ for(MethodSpec spec : inter.methodSpecs){
Log.debug("&g> > &c@ @(@)", simpleName(spec.returnType.toString()), spec.name, Array.with(spec.parameters).toString(", ", p -> simpleName(p.type.toString()) + " " + p.name)); Log.debug("&g> > &c@ @(@)", simpleName(spec.returnType.toString()), spec.name, Seq.with(spec.parameters).toString(", ", p -> simpleName(p.type.toString()) + " " + p.name));
} }
Log.debug(""); Log.debug("");
@@ -172,7 +172,7 @@ public class EntityProcess extends BaseProcessor{
//parse groups //parse groups
for(Selement<?> group : allGroups){ for(Selement<?> group : allGroups){
GroupDef an = group.annotation(GroupDef.class); GroupDef an = group.annotation(GroupDef.class);
Array<Stype> types = types(an, GroupDef::value).map(this::interfaceToComp); Seq<Stype> types = types(an, GroupDef::value).map(this::interfaceToComp);
boolean collides = an.collide(); boolean collides = an.collide();
groupDefs.add(new GroupDefinition(group.name().startsWith("g") ? group.name().substring(1) : group.name(), groupDefs.add(new GroupDefinition(group.name().startsWith("g") ? group.name().substring(1) : group.name(),
ClassName.bestGuess(packageName + "." + interfaceName(types.first())), types, an.spatial(), an.mapping(), collides)); ClassName.bestGuess(packageName + "." + interfaceName(types.first())), types, an.spatial(), an.mapping(), collides));
@@ -209,9 +209,9 @@ public class EntityProcess extends BaseProcessor{
TypeSpec.Builder builder = TypeSpec.classBuilder(name).addModifiers(Modifier.PUBLIC); TypeSpec.Builder builder = TypeSpec.classBuilder(name).addModifiers(Modifier.PUBLIC);
if(isFinal) builder.addModifiers(Modifier.FINAL); if(isFinal) builder.addModifiers(Modifier.FINAL);
Array<Stype> components = allComponents(type); Seq<Stype> components = allComponents(type);
Array<GroupDefinition> groups = groupDefs.select(g -> (!g.components.isEmpty() && !g.components.contains(s -> !components.contains(s))) || g.manualInclusions.contains(type)); Seq<GroupDefinition> groups = groupDefs.select(g -> (!g.components.isEmpty() && !g.components.contains(s -> !components.contains(s))) || g.manualInclusions.contains(type));
ObjectMap<String, Array<Smethod>> methods = new ObjectMap<>(); ObjectMap<String, Seq<Smethod>> methods = new ObjectMap<>();
ObjectMap<FieldSpec, Svar> specVariables = new ObjectMap<>(); ObjectMap<FieldSpec, Svar> specVariables = new ObjectMap<>();
ObjectSet<String> usedFields = new ObjectSet<>(); ObjectSet<String> usedFields = new ObjectSet<>();
@@ -219,8 +219,8 @@ public class EntityProcess extends BaseProcessor{
builder.addMethod(MethodSpec.methodBuilder("serialize").addModifiers(Modifier.PUBLIC, Modifier.FINAL).returns(boolean.class).addStatement("return " + ann.serialize()).build()); builder.addMethod(MethodSpec.methodBuilder("serialize").addModifiers(Modifier.PUBLIC, Modifier.FINAL).returns(boolean.class).addStatement("return " + ann.serialize()).build());
//all SyncField fields //all SyncField fields
Array<Svar> syncedFields = new Array<>(); Seq<Svar> syncedFields = new Seq<>();
Array<Svar> allFields = new Array<>(); Seq<Svar> allFields = new Seq<>();
boolean isSync = components.contains(s -> s.name().contains("Sync")); boolean isSync = components.contains(s -> s.name().contains("Sync"));
@@ -228,7 +228,7 @@ public class EntityProcess extends BaseProcessor{
for(Stype comp : components){ for(Stype comp : components){
//write fields to the class; ignoring transient/imported ones //write fields to the class; ignoring transient/imported ones
Array<Svar> fields = comp.fields().select(f -> !f.has(Import.class)); Seq<Svar> fields = comp.fields().select(f -> !f.has(Import.class));
for(Svar f : fields){ for(Svar f : fields){
if(!usedFields.add(f.name())){ if(!usedFields.add(f.name())){
err("Field '" + f.name() + "' of component '" + comp.name() + "' re-defines a field in entity '" + type.name() + "'"); err("Field '" + f.name() + "' of component '" + comp.name() + "' re-defines a field in entity '" + type.name() + "'");
@@ -279,7 +279,7 @@ public class EntityProcess extends BaseProcessor{
//get all utility methods from components //get all utility methods from components
for(Smethod elem : comp.methods()){ for(Smethod elem : comp.methods()){
methods.get(elem.toString(), Array::new).add(elem); methods.get(elem.toString(), Seq::new).add(elem);
} }
} }
@@ -297,7 +297,7 @@ public class EntityProcess extends BaseProcessor{
boolean hasIO = ann.genio() && (components.contains(s -> s.name().contains("Sync")) || ann.serialize()); boolean hasIO = ann.genio() && (components.contains(s -> s.name().contains("Sync")) || ann.serialize());
//add all methods from components //add all methods from components
for(ObjectMap.Entry<String, Array<Smethod>> entry : methods){ for(ObjectMap.Entry<String, Seq<Smethod>> entry : methods){
if(entry.value.contains(m -> m.has(Replace.class))){ if(entry.value.contains(m -> m.has(Replace.class))){
//check replacements //check replacements
if(entry.value.count(m -> m.has(Replace.class)) > 1){ if(entry.value.count(m -> m.has(Replace.class)) > 1){
@@ -513,7 +513,7 @@ public class EntityProcess extends BaseProcessor{
if(!idProps.exists()) idProps.writeString(""); if(!idProps.exists()) idProps.writeString("");
PropertiesUtils.load(map, idProps.reader()); PropertiesUtils.load(map, idProps.reader());
//next ID to be used in generation //next ID to be used in generation
Integer max = map.values().toArray().map(Integer::parseInt).max(i -> i); Integer max = map.values().toSeq().map(Integer::parseInt).max(i -> i);
int maxID = max == null ? 0 : max + 1; int maxID = max == null ? 0 : max + 1;
//assign IDs //assign IDs
@@ -591,7 +591,7 @@ public class EntityProcess extends BaseProcessor{
//generate getter/setter for each method //generate getter/setter for each method
for(Smethod method : inter.methods()){ for(Smethod method : inter.methods()){
String var = method.name(); String var = method.name();
FieldSpec field = Array.with(def.builder.fieldSpecs).find(f -> f.name.equals(var)); FieldSpec field = Seq.with(def.builder.fieldSpecs).find(f -> f.name.equals(var));
//make sure it's a real variable AND that the component doesn't already implement it somewhere with custom logic //make sure it's a real variable AND that the component doesn't already implement it somewhere with custom logic
if(field == null || methodNames.contains(method.simpleString())) continue; if(field == null || methodNames.contains(method.simpleString())) continue;
@@ -601,7 +601,7 @@ public class EntityProcess extends BaseProcessor{
} }
//setter //setter
if(method.isVoid() && !Array.with(field.annotations).contains(f -> f.type.toString().equals("@mindustry.annotations.Annotations.ReadOnly"))){ if(method.isVoid() && !Seq.with(field.annotations).contains(f -> f.type.toString().equals("@mindustry.annotations.Annotations.ReadOnly"))){
def.builder.addMethod(MethodSpec.overriding(method.e).addModifiers(Modifier.FINAL).addStatement("this." + var + " = " + var).build()); def.builder.addMethod(MethodSpec.overriding(method.e).addModifiers(Modifier.FINAL).addStatement("this." + var + " = " + var).build());
} }
} }
@@ -616,8 +616,8 @@ public class EntityProcess extends BaseProcessor{
//create mock types of all components //create mock types of all components
for(Stype interf : allInterfaces){ for(Stype interf : allInterfaces){
//indirect interfaces to implement methods for //indirect interfaces to implement methods for
Array<Stype> dependencies = interf.allInterfaces().and(interf); Seq<Stype> dependencies = interf.allInterfaces().and(interf);
Array<Smethod> methods = dependencies.flatMap(Stype::methods); Seq<Smethod> methods = dependencies.flatMap(Stype::methods);
methods.sortComparing(Object::toString); methods.sortComparing(Object::toString);
//used method signatures //used method signatures
@@ -668,8 +668,8 @@ public class EntityProcess extends BaseProcessor{
} }
} }
Array<String> getImports(Element elem){ Seq<String> getImports(Element elem){
return Array.with(trees.getPath(elem).getCompilationUnit().getImports()).map(Object::toString); return Seq.with(trees.getPath(elem).getCompilationUnit().getImports()).map(Object::toString);
} }
/** @return interface for a component type */ /** @return interface for a component type */
@@ -682,11 +682,11 @@ public class EntityProcess extends BaseProcessor{
} }
/** @return all components that a entity def has */ /** @return all components that a entity def has */
Array<Stype> allComponents(Selement<?> type){ Seq<Stype> allComponents(Selement<?> type){
if(!defComponents.containsKey(type)){ if(!defComponents.containsKey(type)){
//get base defs //get base defs
Array<Stype> interfaces = types(type.annotation(EntityDef.class), EntityDef::value); Seq<Stype> interfaces = types(type.annotation(EntityDef.class), EntityDef::value);
Array<Stype> components = new Array<>(); Seq<Stype> components = new Seq<>();
for(Stype i : interfaces){ for(Stype i : interfaces){
Stype comp = interfaceToComp(i); Stype comp = interfaceToComp(i);
if(comp != null){ if(comp != null){
@@ -709,7 +709,7 @@ public class EntityProcess extends BaseProcessor{
return defComponents.get(type); return defComponents.get(type);
} }
Array<Stype> getDependencies(Stype component){ Seq<Stype> getDependencies(Stype component){
if(!componentDependencies.containsKey(component)){ if(!componentDependencies.containsKey(component)){
ObjectSet<Stype> out = new ObjectSet<>(); ObjectSet<Stype> out = new ObjectSet<>();
//add base component interfaces //add base component interfaces
@@ -746,7 +746,7 @@ public class EntityProcess extends BaseProcessor{
} }
String createName(Selement<?> elem){ String createName(Selement<?> elem){
Array<Stype> comps = types(elem.annotation(EntityDef.class), EntityDef::value).map(this::interfaceToComp);; Seq<Stype> comps = types(elem.annotation(EntityDef.class), EntityDef::value).map(this::interfaceToComp);;
comps.sortComparing(Selement::name); comps.sortComparing(Selement::name);
return comps.toString("", s -> s.name().replace("Comp", "")) + "Entity"; return comps.toString("", s -> s.name().replace("Comp", "")) + "Entity";
} }
@@ -755,11 +755,11 @@ public class EntityProcess extends BaseProcessor{
return type.annotation(Component.class) != null; return type.annotation(Component.class) != null;
} }
<T extends Annotation> Array<Stype> types(T t, Cons<T> consumer){ <T extends Annotation> Seq<Stype> types(T t, Cons<T> consumer){
try{ try{
consumer.get(t); consumer.get(t);
}catch(MirroredTypesException e){ }catch(MirroredTypesException e){
return Array.with(e.getTypeMirrors()).map(Stype::of); return Seq.with(e.getTypeMirrors()).map(Stype::of);
} }
throw new IllegalArgumentException("Missing types."); throw new IllegalArgumentException("Missing types.");
} }
@@ -767,11 +767,11 @@ public class EntityProcess extends BaseProcessor{
class GroupDefinition{ class GroupDefinition{
final String name; final String name;
final ClassName baseType; final ClassName baseType;
final Array<Stype> components; final Seq<Stype> components;
final boolean spatial, mapping, collides; final boolean spatial, mapping, collides;
final ObjectSet<Selement> manualInclusions = new ObjectSet<>(); final ObjectSet<Selement> manualInclusions = new ObjectSet<>();
public GroupDefinition(String name, ClassName bestType, Array<Stype> components, boolean spatial, boolean mapping, boolean collides){ public GroupDefinition(String name, ClassName bestType, Seq<Stype> components, boolean spatial, boolean mapping, boolean collides){
this.baseType = bestType; this.baseType = bestType;
this.components = components; this.components = components;
this.name = name; this.name = name;
@@ -787,14 +787,14 @@ public class EntityProcess extends BaseProcessor{
} }
class EntityDefinition{ class EntityDefinition{
final Array<GroupDefinition> groups; final Seq<GroupDefinition> groups;
final Array<Stype> components; final Seq<Stype> components;
final TypeSpec.Builder builder; final TypeSpec.Builder builder;
final Selement base; final Selement base;
final String name; final String name;
int classID; int classID;
public EntityDefinition(String name, Builder builder, Selement base, Array<Stype> components, Array<GroupDefinition> groups){ public EntityDefinition(String name, Builder builder, Selement base, Seq<Stype> components, Seq<GroupDefinition> groups){
this.builder = builder; this.builder = builder;
this.name = name; this.name = name;
this.base = base; this.base = base;

View File

@@ -69,7 +69,7 @@ public class AssetsProcess extends BaseProcessor{
}); });
for(Element elem : elements){ for(Element elem : elements){
Array.with(((TypeElement)elem).getEnclosedElements()).each(e -> e.getKind() == ElementKind.FIELD, field -> { Seq.with(((TypeElement)elem).getEnclosedElements()).each(e -> e.getKind() == ElementKind.FIELD, field -> {
String fname = field.getSimpleName().toString(); String fname = field.getSimpleName().toString();
if(fname.startsWith("default")){ if(fname.startsWith("default")){
loadStyles.addStatement("arc.Core.scene.addStyle(" + field.asType().toString() + ".class, mindustry.ui.Styles." + fname + ")"); loadStyles.addStatement("arc.Core.scene.addStyle(" + field.asType().toString() + ".class, mindustry.ui.Styles." + fname + ")");

View File

@@ -23,17 +23,17 @@ public class LoadRegionProcessor extends BaseProcessor{
.addParameter(tname("mindustry.ctype.MappableContent"), "content") .addParameter(tname("mindustry.ctype.MappableContent"), "content")
.addModifiers(Modifier.STATIC, Modifier.PUBLIC); .addModifiers(Modifier.STATIC, Modifier.PUBLIC);
ObjectMap<Stype, Array<Svar>> fieldMap = new ObjectMap<>(); ObjectMap<Stype, Seq<Svar>> fieldMap = new ObjectMap<>();
for(Svar field : fields(Load.class)){ for(Svar field : fields(Load.class)){
if(!field.is(Modifier.PUBLIC)){ if(!field.is(Modifier.PUBLIC)){
err("@LoadRegion field must be public", field); err("@LoadRegion field must be public", field);
} }
fieldMap.get(field.enclosingType(), Array::new).add(field); fieldMap.get(field.enclosingType(), Seq::new).add(field);
} }
for(Entry<Stype, Array<Svar>> entry : fieldMap){ for(Entry<Stype, Seq<Svar>> entry : fieldMap){
method.beginControlFlow("if(content instanceof $T)", entry.key.tname()); method.beginControlFlow("if(content instanceof $T)", entry.key.tname());
for(Svar field : entry.value){ for(Svar field : entry.value){

View File

@@ -139,7 +139,7 @@ public class RemoteWriteGenerator{
//reset stream //reset stream
method.addStatement("OUT.reset()"); method.addStatement("OUT.reset()");
method.addTypeVariables(Array.with(elem.getTypeParameters()).map(BaseProcessor::getTVN)); method.addTypeVariables(Seq.with(elem.getTypeParameters()).map(BaseProcessor::getTVN));
for(int i = 0; i < elem.getParameters().size(); i++){ for(int i = 0; i < elem.getParameters().size(); i++){
//first argument is skipped as it is always the player caller //first argument is skipped as it is always the player caller

View File

@@ -9,7 +9,7 @@ public class SerializerResolver{
public static String locate(ExecutableElement elem, TypeMirror mirror, boolean write){ public static String locate(ExecutableElement elem, TypeMirror mirror, boolean write){
//generic type //generic type
if((mirror.toString().equals("T") && Array.with(elem.getTypeParameters().get(0).getBounds()).contains(SerializerResolver::isEntity)) || if((mirror.toString().equals("T") && Seq.with(elem.getTypeParameters().get(0).getBounds()).contains(SerializerResolver::isEntity)) ||
isEntity(mirror)){ isEntity(mirror)){
return write ? "mindustry.io.TypeIO.writeEntity" : "mindustry.io.TypeIO.readEntity"; return write ? "mindustry.io.TypeIO.writeEntity" : "mindustry.io.TypeIO.readEntity";
} }

View File

@@ -1,6 +1,6 @@
package mindustry.annotations.util; package mindustry.annotations.util;
import arc.struct.Array; import arc.struct.*;
import arc.util.ArcAnnotate.*; import arc.util.ArcAnnotate.*;
import com.squareup.javapoet.*; import com.squareup.javapoet.*;
import com.sun.tools.javac.code.Attribute.*; import com.sun.tools.javac.code.Attribute.*;
@@ -23,8 +23,8 @@ public class Selement<T extends Element>{
return BaseProcessor.elementu.getDocComment(e); return BaseProcessor.elementu.getDocComment(e);
} }
public Array<Selement<?>> enclosed(){ public Seq<Selement<?>> enclosed(){
return Array.with(e.getEnclosedElements()).map(Selement::new); return Seq.with(e.getEnclosedElements()).map(Selement::new);
} }
public String fullName(){ public String fullName(){
@@ -55,8 +55,8 @@ public class Selement<T extends Element>{
return e instanceof ExecutableElement; return e instanceof ExecutableElement;
} }
public Array<? extends AnnotationMirror> annotations(){ public Seq<? extends AnnotationMirror> annotations(){
return Array.with(e.getAnnotationMirrors()); return Seq.with(e.getAnnotationMirrors());
} }
public <A extends Annotation> A annotation(Class<A> annotation){ public <A extends Annotation> A annotation(Class<A> annotation){

View File

@@ -29,20 +29,20 @@ public class Smethod extends Selement<ExecutableElement>{
return new Stype((TypeElement)up()); return new Stype((TypeElement)up());
} }
public Array<TypeMirror> thrown(){ public Seq<TypeMirror> thrown(){
return Array.with(e.getThrownTypes()).as(); return Seq.with(e.getThrownTypes()).as();
} }
public Array<TypeName> thrownt(){ public Seq<TypeName> thrownt(){
return Array.with(e.getThrownTypes()).map(TypeName::get); return Seq.with(e.getThrownTypes()).map(TypeName::get);
} }
public Array<TypeParameterElement> typeVariables(){ public Seq<TypeParameterElement> typeVariables(){
return Array.with(e.getTypeParameters()).as(); return Seq.with(e.getTypeParameters()).as();
} }
public Array<Svar> params(){ public Seq<Svar> params(){
return Array.with(e.getParameters()).map(Svar::new); return Seq.with(e.getParameters()).map(Svar::new);
} }
public boolean isVoid(){ public boolean isVoid(){

View File

@@ -20,19 +20,19 @@ public class Stype extends Selement<TypeElement>{
return mirror().toString(); return mirror().toString();
} }
public Array<Stype> interfaces(){ public Seq<Stype> interfaces(){
return Array.with(e.getInterfaces()).map(Stype::of); return Seq.with(e.getInterfaces()).map(Stype::of);
} }
public Array<Stype> allInterfaces(){ public Seq<Stype> allInterfaces(){
return interfaces().flatMap(s -> s.allInterfaces().and(s)).distinct(); return interfaces().flatMap(s -> s.allInterfaces().and(s)).distinct();
} }
public Array<Stype> superclasses(){ public Seq<Stype> superclasses(){
return Array.with(BaseProcessor.typeu.directSupertypes(mirror())).map(Stype::of); return Seq.with(BaseProcessor.typeu.directSupertypes(mirror())).map(Stype::of);
} }
public Array<Stype> allSuperclasses(){ public Seq<Stype> allSuperclasses(){
return superclasses().flatMap(s -> s.allSuperclasses().and(s)).distinct(); return superclasses().flatMap(s -> s.allSuperclasses().and(s)).distinct();
} }
@@ -40,17 +40,17 @@ public class Stype extends Selement<TypeElement>{
return new Stype((TypeElement)BaseProcessor.typeu.asElement(BaseProcessor.typeu.directSupertypes(mirror()).get(0))); return new Stype((TypeElement)BaseProcessor.typeu.asElement(BaseProcessor.typeu.directSupertypes(mirror()).get(0)));
} }
public Array<Svar> fields(){ public Seq<Svar> fields(){
return Array.with(e.getEnclosedElements()).select(e -> e instanceof VariableElement).map(e -> new Svar((VariableElement)e)); return Seq.with(e.getEnclosedElements()).select(e -> e instanceof VariableElement).map(e -> new Svar((VariableElement)e));
} }
public Array<Smethod> methods(){ public Seq<Smethod> methods(){
return Array.with(e.getEnclosedElements()).select(e -> e instanceof ExecutableElement return Seq.with(e.getEnclosedElements()).select(e -> e instanceof ExecutableElement
&& !e.getSimpleName().toString().contains("<")).map(e -> new Smethod((ExecutableElement)e)); && !e.getSimpleName().toString().contains("<")).map(e -> new Smethod((ExecutableElement)e));
} }
public Array<Smethod> constructors(){ public Seq<Smethod> constructors(){
return Array.with(e.getEnclosedElements()).select(e -> e instanceof ExecutableElement return Seq.with(e.getEnclosedElements()).select(e -> e instanceof ExecutableElement
&& e.getSimpleName().toString().contains("<")).map(e -> new Smethod((ExecutableElement)e)); && e.getSimpleName().toString().contains("<")).map(e -> new Smethod((ExecutableElement)e));
} }

View File

@@ -19,10 +19,10 @@ public class TypeIOResolver{
ClassSerializer out = new ClassSerializer(new ObjectMap<>(), new ObjectMap<>(), new ObjectMap<>()); ClassSerializer out = new ClassSerializer(new ObjectMap<>(), new ObjectMap<>(), new ObjectMap<>());
for(Stype type : processor.types(TypeIOHandler.class)){ for(Stype type : processor.types(TypeIOHandler.class)){
//look at all TypeIOHandler methods //look at all TypeIOHandler methods
Array<Smethod> methods = type.methods(); Seq<Smethod> methods = type.methods();
for(Smethod meth : methods){ for(Smethod meth : methods){
if(meth.is(Modifier.PUBLIC) && meth.is(Modifier.STATIC)){ if(meth.is(Modifier.PUBLIC) && meth.is(Modifier.STATIC)){
Array<Svar> params = meth.params(); Seq<Svar> params = meth.params();
//2 params, second one is type, first is writer //2 params, second one is type, first is writer
if(params.size == 2 && params.first().tname().toString().equals("arc.util.io.Writes")){ if(params.size == 2 && params.first().tname().toString().equals("arc.util.io.Writes")){
out.writers.put(params.get(1).tname().toString(), type.fullName() + "." + meth.name()); out.writers.put(params.get(1).tname().toString(), type.fullName() + "." + meth.name());

View File

@@ -12,12 +12,12 @@ mindustry.entities.comp.PlayerComp=8
mindustry.entities.comp.PuddleComp=9 mindustry.entities.comp.PuddleComp=9
mindustry.entities.comp.TileComp=10 mindustry.entities.comp.TileComp=10
mindustry.type.Weather.WeatherComp=11 mindustry.type.Weather.WeatherComp=11
mindustry.world.blocks.campaign.CoreLauncher.LaunchCoreComp=20 mindustry.world.blocks.campaign.CoreLauncher.LaunchCoreComp=12
mindustry.world.blocks.campaign.LaunchPad.LaunchPayloadComp=12 mindustry.world.blocks.campaign.LaunchPad.LaunchPayloadComp=13
oculon=13 oculon=14
phantom=14 phantom=15
tau=19 tau=16
titan=15 titan=17
trident=18 trident=18
vanguard=16 vanguard=19
wraith=17 wraith=20

View File

@@ -1 +1 @@
{fields:[{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]} {fields:[{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

View File

@@ -1 +1 @@
{fields:[{name:armor,type:float,size:4},{name:baseRotation,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:mineTile,type:mindustry.world.Tile,size:-1},{name:requests,type:arc.struct.Queue<mindustry.entities.units.BuildRequest>,size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]} {fields:[{name:armor,type:float,size:4},{name:baseRotation,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:mineTile,type:mindustry.world.Tile,size:-1},{name:requests,type:arc.struct.Queue<mindustry.entities.units.BuildRequest>,size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

View File

@@ -1 +1 @@
{fields:[{name:armor,type:float,size:4},{name:baseRotation,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:requests,type:arc.struct.Queue<mindustry.entities.units.BuildRequest>,size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]} {fields:[{name:armor,type:float,size:4},{name:baseRotation,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:requests,type:arc.struct.Queue<mindustry.entities.units.BuildRequest>,size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

View File

@@ -1 +1 @@
{fields:[{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:mineTile,type:mindustry.world.Tile,size:-1},{name:payloads,type:arc.struct.Array<mindustry.world.blocks.payloads.Payload>,size:-1},{name:requests,type:arc.struct.Queue<mindustry.entities.units.BuildRequest>,size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]} {fields:[{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:mineTile,type:mindustry.world.Tile,size:-1},{name:payloads,type:arc.struct.Seq<mindustry.world.blocks.payloads.Payload>,size:-1},{name:requests,type:arc.struct.Queue<mindustry.entities.units.BuildRequest>,size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

View File

@@ -1 +1 @@
{fields:[{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:mineTile,type:mindustry.world.Tile,size:-1},{name:requests,type:arc.struct.Queue<mindustry.entities.units.BuildRequest>,size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]} {fields:[{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:mineTile,type:mindustry.world.Tile,size:-1},{name:requests,type:arc.struct.Queue<mindustry.entities.units.BuildRequest>,size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

View File

@@ -1 +1 @@
{fields:[{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:requests,type:arc.struct.Queue<mindustry.entities.units.BuildRequest>,size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]} {fields:[{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:requests,type:arc.struct.Queue<mindustry.entities.units.BuildRequest>,size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

View File

@@ -1 +1 @@
{fields:[{name:collided,type:arc.struct.IntArray,size:-1},{name:damage,type:float,size:4},{name:data,type:java.lang.Object,size:-1},{name:lifetime,type:float,size:4},{name:owner,type:Entityc,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:time,type:float,size:4},{name:type,type:mindustry.entities.bullet.BulletType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]} {fields:[{name:collided,type:arc.struct.IntSeq,size:-1},{name:damage,type:float,size:4},{name:data,type:java.lang.Object,size:-1},{name:lifetime,type:float,size:4},{name:owner,type:Entityc,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:time,type:float,size:4},{name:type,type:mindustry.entities.bullet.BulletType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

View File

@@ -1 +1 @@
{fields:[{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]} {fields:[{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

View File

@@ -1 +1 @@
{fields:[{name:lifetime,type:float,size:4},{name:team,type:mindustry.game.Team,size:-1},{name:time,type:float,size:4},{name:x,type:float,size:4},{name:y,type:float,size:4}]} {fields:[{name:block,type:mindustry.world.Block,size:-1},{name:lifetime,type:float,size:4},{name:time,type:float,size:4},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

View File

@@ -1 +0,0 @@
{version:1,fields:[{name:block,type:mindustry.world.Block,size:-1},{name:lifetime,type:float,size:4},{name:team,type:mindustry.game.Team,size:-1},{name:time,type:float,size:4},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

View File

@@ -1 +0,0 @@
{version:2,fields:[{name:block,type:mindustry.world.Block,size:-1},{name:lifetime,type:float,size:4},{name:time,type:float,size:4},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

View File

@@ -1 +1 @@
{fields:[{name:lifetime,type:float,size:4},{name:stacks,type:arc.struct.Array<mindustry.type.ItemStack>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:time,type:float,size:4},{name:x,type:float,size:4},{name:y,type:float,size:4}]} {fields:[{name:lifetime,type:float,size:4},{name:stacks,type:arc.struct.Seq<mindustry.type.ItemStack>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:time,type:float,size:4},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

View File

@@ -1 +1 @@
{fields:[{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]} {fields:[{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

View File

@@ -1 +1 @@
{fields:[{name:armor,type:float,size:4},{name:baseRotation,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]} {fields:[{name:armor,type:float,size:4},{name:baseRotation,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

View File

@@ -1 +1 @@
{fields:[{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:mineTile,type:mindustry.world.Tile,size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]} {fields:[{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:mineTile,type:mindustry.world.Tile,size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

View File

@@ -1 +1 @@
{fields:[{name:accepting,type:float,size:4},{name:amount,type:float,size:4},{name:generation,type:int,size:4},{name:lastRipple,type:float,size:4},{name:liquid,type:mindustry.type.Liquid,size:-1},{name:tile,type:mindustry.world.Tile,size:-1},{name:updateTime,type:float,size:4},{name:x,type:float,size:4},{name:y,type:float,size:4}]} {fields:[{name:amount,type:float,size:4},{name:generation,type:int,size:4},{name:liquid,type:mindustry.type.Liquid,size:-1},{name:tile,type:mindustry.world.Tile,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

View File

@@ -1 +0,0 @@
{version:1,fields:[{name:amount,type:float,size:4},{name:generation,type:int,size:4},{name:liquid,type:mindustry.type.Liquid,size:-1},{name:tile,type:mindustry.world.Tile,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

View File

@@ -1 +0,0 @@
{fields:[{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

View File

@@ -1 +1 @@
{fields:[{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]} {fields:[{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

View File

@@ -536,7 +536,7 @@ public class ContentParser{
private void checkNullFields(Object object){ private void checkNullFields(Object object){
if(object instanceof Number || object instanceof String || toBeParsed.contains(object)) return; if(object instanceof Number || object instanceof String || toBeParsed.contains(object)) return;
parser.getFields(object.getClass()).values().toArray().each(field -> { parser.getFields(object.getClass()).values().toSeq().each(field -> {
try{ try{
if(field.field.getType().isPrimitive()) return; if(field.field.getType().isPrimitive()) return;

View File

@@ -414,7 +414,7 @@ public class Administration{
} }
public Seq<PlayerInfo> getWhitelisted(){ public Seq<PlayerInfo> getWhitelisted(){
return playerInfo.values().toArray().select(p -> isWhitelisted(p.id, p.adminUsid)); return playerInfo.values().toSeq().select(p -> isWhitelisted(p.id, p.adminUsid));
} }
private PlayerInfo getCreateInfo(String id){ private PlayerInfo getCreateInfo(String id){

View File

@@ -14,7 +14,7 @@ public class BlockBars{
public void remove(String name){ public void remove(String name){
if(!bars.containsKey(name)) if(!bars.containsKey(name))
throw new RuntimeException("No bar with name '" + name + "' found; current bars: " + bars.keys().toArray()); throw new RuntimeException("No bar with name '" + name + "' found; current bars: " + bars.keys().toSeq());
bars.remove(name); bars.remove(name);
} }

View File

@@ -1,3 +1,3 @@
org.gradle.daemon=true org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=3df599fed17ea11be2b58aedc0edf596861807a2 archash=8eb22e43810c7c50ff8cc642e9c5f3e651b2372c