Better annotation processor IC
This commit is contained in:
@@ -123,9 +123,15 @@ public abstract class BaseProcessor extends AbstractProcessor{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void write(TypeSpec.Builder builder, Seq<String> imports) throws Exception{
|
public static void write(TypeSpec.Builder builder, Seq<String> imports) throws Exception{
|
||||||
|
builder.superinterfaces.sort(Structs.comparing(t -> t.toString()));
|
||||||
|
builder.methodSpecs.sort(Structs.comparing(m -> m.toString()));
|
||||||
|
builder.fieldSpecs.sort(Structs.comparing(f -> f.name));
|
||||||
|
|
||||||
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){
|
||||||
|
imports = imports.map(m -> Seq.with(m.split("\n")).sort().toString("\n"));
|
||||||
|
imports.sort();
|
||||||
String rawSource = file.toString();
|
String rawSource = file.toString();
|
||||||
Seq<String> result = new Seq<>();
|
Seq<String> result = new Seq<>();
|
||||||
for(String s : rawSource.split("\n", -1)){
|
for(String s : rawSource.split("\n", -1)){
|
||||||
|
|||||||
@@ -409,7 +409,7 @@ public class EntityProcess extends BaseProcessor{
|
|||||||
err("Type " + type + " has multiple components implementing non-void method " + entry.key + ".");
|
err("Type " + type + " has multiple components implementing non-void method " + entry.key + ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
entry.value.sort(Structs.comps(Structs.comparingFloat(m -> m.has(MethodPriority.class) ? m.annotation(MethodPriority.class).value() : 0), Structs.comparing(Selement::name)));
|
entry.value.sort(Structs.comps(Structs.comparingFloat(m -> m.has(MethodPriority.class) ? m.annotation(MethodPriority.class).value() : 0), Structs.comparing(s -> s.up().getSimpleName().toString())));
|
||||||
|
|
||||||
//representative method
|
//representative method
|
||||||
Smethod first = entry.value.first();
|
Smethod first = entry.value.first();
|
||||||
@@ -545,6 +545,7 @@ public class EntityProcess extends BaseProcessor{
|
|||||||
builder.addSuperinterface(Poolable.class);
|
builder.addSuperinterface(Poolable.class);
|
||||||
//implement reset()
|
//implement reset()
|
||||||
MethodSpec.Builder resetBuilder = MethodSpec.methodBuilder("reset").addModifiers(Modifier.PUBLIC);
|
MethodSpec.Builder resetBuilder = MethodSpec.methodBuilder("reset").addModifiers(Modifier.PUBLIC);
|
||||||
|
allFieldSpecs.sortComparing(s -> s.name);
|
||||||
for(FieldSpec spec : allFieldSpecs){
|
for(FieldSpec spec : allFieldSpecs){
|
||||||
@Nullable Svar variable = specVariables.get(spec);
|
@Nullable Svar variable = specVariables.get(spec);
|
||||||
if(variable != null && variable.isAny(Modifier.STATIC, Modifier.FINAL)) continue;
|
if(variable != null && variable.isAny(Modifier.STATIC, Modifier.FINAL)) continue;
|
||||||
|
|||||||
@@ -4229,7 +4229,7 @@ public class Blocks{
|
|||||||
size = 3;
|
size = 3;
|
||||||
reloadTime = 130f;
|
reloadTime = 130f;
|
||||||
chargeTime = 90f;
|
chargeTime = 90f;
|
||||||
range = 500f;
|
range = 600f;
|
||||||
maxPayloadSize = 2.5f;
|
maxPayloadSize = 2.5f;
|
||||||
fogRadius = 5;
|
fogRadius = 5;
|
||||||
consumePower(0.5f);
|
consumePower(0.5f);
|
||||||
|
|||||||
@@ -3146,6 +3146,7 @@ public class UnitTypes{
|
|||||||
hitSize = 12f;
|
hitSize = 12f;
|
||||||
engineSize = 0;
|
engineSize = 0;
|
||||||
fogRadius = 25;
|
fogRadius = 25;
|
||||||
|
itemCapacity = 0;
|
||||||
|
|
||||||
setEnginesMirror(
|
setEnginesMirror(
|
||||||
new UnitEngine(34 / 4f, 31 / 4f, 3f, 45f),
|
new UnitEngine(34 / 4f, 31 / 4f, 3f, 45f),
|
||||||
|
|||||||
@@ -24,8 +24,6 @@ import mindustry.ui.*;
|
|||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class JoinDialog extends BaseDialog{
|
public class JoinDialog extends BaseDialog{
|
||||||
//TODO unused
|
|
||||||
Seq<Host> commmunityHosts = new Seq<>();
|
|
||||||
Seq<Server> servers = new Seq<>();
|
Seq<Server> servers = new Seq<>();
|
||||||
Dialog add;
|
Dialog add;
|
||||||
Server renaming;
|
Server renaming;
|
||||||
@@ -393,7 +391,6 @@ public class JoinDialog extends BaseDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void refreshCommunity(){
|
void refreshCommunity(){
|
||||||
commmunityHosts.clear();
|
|
||||||
int cur = refreshes;
|
int cur = refreshes;
|
||||||
|
|
||||||
global.clear();
|
global.clear();
|
||||||
@@ -415,8 +412,6 @@ public class JoinDialog extends BaseDialog{
|
|||||||
if(refreshes != cur) return;
|
if(refreshes != cur) return;
|
||||||
res.port = resport;
|
res.port = resport;
|
||||||
|
|
||||||
commmunityHosts.add(res);
|
|
||||||
|
|
||||||
//add header
|
//add header
|
||||||
if(groupTable[0] == null){
|
if(groupTable[0] == null){
|
||||||
global.table(t -> groupTable[0] = t).row();
|
global.table(t -> groupTable[0] = t).row();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package mindustry.world.consumers;
|
|||||||
|
|
||||||
import arc.func.*;
|
import arc.func.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
/** A power consumer that uses a dynamic amount of power. */
|
/** A power consumer that uses a dynamic amount of power. */
|
||||||
public class ConsumePowerDynamic extends ConsumePower{
|
public class ConsumePowerDynamic extends ConsumePower{
|
||||||
@@ -16,4 +17,9 @@ public class ConsumePowerDynamic extends ConsumePower{
|
|||||||
public float requestedPower(Building entity){
|
public float requestedPower(Building entity){
|
||||||
return usage.get(entity);
|
return usage.get(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void display(Stats stats){
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user