?
This commit is contained in:
@@ -5,16 +5,10 @@ import java.lang.annotation.*;
|
||||
public class Annotations{
|
||||
//region entity interfaces
|
||||
|
||||
/** Indicates that a component field is read-only.
|
||||
@Target({ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Render{
|
||||
RenderLayer value();
|
||||
}*/
|
||||
|
||||
public enum DrawLayer{
|
||||
floor,
|
||||
groundShadows,
|
||||
groundUnder,
|
||||
ground,
|
||||
flyingShadows,
|
||||
flying,
|
||||
@@ -69,6 +63,7 @@ public class Annotations{
|
||||
public @interface EntityDef{
|
||||
Class[] value();
|
||||
boolean isFinal() default true;
|
||||
boolean pooled() default false;
|
||||
}
|
||||
|
||||
/** Indicates an internal interface for entity components. */
|
||||
|
||||
@@ -157,7 +157,8 @@ public class EntityProcess extends BaseProcessor{
|
||||
|
||||
//look at each definition
|
||||
for(Stype type : allDefs){
|
||||
boolean isFinal = type.annotation(EntityDef.class).isFinal();
|
||||
EntityDef ann = type.annotation(EntityDef.class);
|
||||
boolean isFinal = ann.isFinal();
|
||||
if(!type.name().endsWith("Def")){
|
||||
err("All entity def names must end with 'Def'", type.e);
|
||||
}
|
||||
@@ -279,7 +280,7 @@ public class EntityProcess extends BaseProcessor{
|
||||
//add create() method
|
||||
builder.addMethod(MethodSpec.methodBuilder("create").addModifiers(Modifier.PUBLIC, Modifier.STATIC)
|
||||
.returns(tname(packageName + "." + name))
|
||||
.addStatement("return new $L()", name).build());
|
||||
.addStatement(ann.pooled() ? "return " : "return new $L()", name).build());
|
||||
|
||||
definitions.add(new EntityDefinition("mindustry.gen." + name, builder, type, components, groups));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user