From 80ef3cee34bd073e26188465406b10c6ab219568 Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 23 Aug 2021 15:33:28 -0400 Subject: [PATCH] Suppress gen deprecatio warning / Anuken/Mindustry-Suggestions/issues/2888 --- .../mindustry/annotations/entity/EntityProcess.java | 11 +++++++++++ core/src/mindustry/content/Blocks.java | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/annotations/src/main/java/mindustry/annotations/entity/EntityProcess.java b/annotations/src/main/java/mindustry/annotations/entity/EntityProcess.java index 9612018e7b..3b859e3436 100644 --- a/annotations/src/main/java/mindustry/annotations/entity/EntityProcess.java +++ b/annotations/src/main/java/mindustry/annotations/entity/EntityProcess.java @@ -101,6 +101,8 @@ public class EntityProcess extends BaseProcessor{ inter.addJavadoc("Interface for {@link $L}", component.fullName()); + skipDeprecated(inter); + //implement extra interfaces these components may have, e.g. position for(Stype extraInterface : component.interfaces().select(i -> !isCompInterface(i))){ //javapoet completely chokes on this if I add `addSuperInterface` or create the type name with TypeName.get @@ -570,6 +572,8 @@ public class EntityProcess extends BaseProcessor{ .returns(tname(packageName + "." + name)) .addStatement(ann.pooled() ? "return Pools.obtain($L.class, " +name +"::new)" : "return new $L()", name).build()); + skipDeprecated(builder); + definitions.add(new EntityDefinition(packageName + "." + name, builder, type, typeIsBase ? null : baseClass, components, groups, allFieldSpecs, legacy)); } @@ -837,6 +841,8 @@ public class EntityProcess extends BaseProcessor{ TypeSpec.Builder nullBuilder = TypeSpec.classBuilder(className) .addModifiers(Modifier.FINAL); + skipDeprecated(nullBuilder); + nullBuilder.addSuperinterface(interf.tname()); if(superclass != null) nullBuilder.superclass(tname(baseName(superclass))); @@ -980,6 +986,11 @@ public class EntityProcess extends BaseProcessor{ throw new IllegalArgumentException("Missing types."); } + void skipDeprecated(TypeSpec.Builder builder){ + //deprecations are irrelevant in generated code + builder.addAnnotation(AnnotationSpec.builder(SuppressWarnings.class).addMember("value", "\"deprecation\"").build()); + } + class GroupDefinition{ final String name; final ClassName baseType; diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 97fc58517a..515d89a2f8 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -1888,7 +1888,7 @@ public class Blocks implements ContentList{ requirements(Category.units, with(Items.copper, 50, Items.lead, 120, Items.silicon, 80)); plans = Seq.with( new UnitPlan(UnitTypes.dagger, 60f * 15, with(Items.silicon, 10, Items.lead, 10)), - new UnitPlan(UnitTypes.crawler, 60f * 12, with(Items.silicon, 10, Items.coal, 20)), + new UnitPlan(UnitTypes.crawler, 60f * 10, with(Items.silicon, 8, Items.coal, 10)), new UnitPlan(UnitTypes.nova, 60f * 40, with(Items.silicon, 30, Items.lead, 20, Items.titanium, 20)) ); size = 3;