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