diff --git a/annotations/src/main/java/mindustry/annotations/entity/EntityProcess.java b/annotations/src/main/java/mindustry/annotations/entity/EntityProcess.java index 4cf17621ef..66eb7e4636 100644 --- a/annotations/src/main/java/mindustry/annotations/entity/EntityProcess.java +++ b/annotations/src/main/java/mindustry/annotations/entity/EntityProcess.java @@ -196,14 +196,14 @@ public class EntityProcess extends BaseProcessor{ //skip double classes if(usedNames.containsKey(name)){ - extraNames.getOr(usedNames.get(name), ObjectSet::new).add(type.name()); + extraNames.get(usedNames.get(name), ObjectSet::new).add(type.name()); continue; } usedNames.put(name, type); - extraNames.getOr(type, ObjectSet::new).add(name); + extraNames.get(type, ObjectSet::new).add(name); if(!type.isType()){ - extraNames.getOr(type, ObjectSet::new).add(type.name()); + extraNames.get(type, ObjectSet::new).add(type.name()); } TypeSpec.Builder builder = TypeSpec.classBuilder(name).addModifiers(Modifier.PUBLIC); @@ -277,7 +277,7 @@ public class EntityProcess extends BaseProcessor{ //get all utility methods from components for(Smethod elem : comp.methods()){ - methods.getOr(elem.toString(), Array::new).add(elem); + methods.get(elem.toString(), Array::new).add(elem); } } @@ -552,8 +552,8 @@ public class EntityProcess extends BaseProcessor{ idStore.addStatement("idMap[$L] = $L::new", def.classID, def.name); extraNames.get(def.base).each(extra -> { idStore.addStatement("nameMap.put($S, $L::new)", extra, def.name); - if(!camelToKebab(extra).equals(extra)){ - idStore.addStatement("nameMap.put($S, $L::new)", camelToKebab(extra), def.name); + if(!Strings.camelToKebab(extra).equals(extra)){ + idStore.addStatement("nameMap.put($S, $L::new)", Strings.camelToKebab(extra), def.name); } }); @@ -749,22 +749,6 @@ public class EntityProcess extends BaseProcessor{ return comps.toString("", s -> s.name().replace("Comp", "")) + "Entity"; } - static String camelToKebab(String s){ - StringBuilder result = new StringBuilder(s.length() + 1); - - for(int i = 0; i < s.length(); i++){ - char c = s.charAt(i); - if(i > 0 && Character.isUpperCase(s.charAt(i))){ - result.append('-'); - } - - result.append(Character.toLowerCase(c)); - - } - - return result.toString(); - } - boolean isComponent(Stype type){ return type.annotation(Component.class) != null; } diff --git a/annotations/src/main/java/mindustry/annotations/misc/LoadRegionProcessor.java b/annotations/src/main/java/mindustry/annotations/misc/LoadRegionProcessor.java index 6703b92a16..6923dc2149 100644 --- a/annotations/src/main/java/mindustry/annotations/misc/LoadRegionProcessor.java +++ b/annotations/src/main/java/mindustry/annotations/misc/LoadRegionProcessor.java @@ -30,7 +30,7 @@ public class LoadRegionProcessor extends BaseProcessor{ err("@LoadRegion field must be public", field); } - fieldMap.getOr(field.enclosingType(), Array::new).add(field); + fieldMap.get(field.enclosingType(), Array::new).add(field); } for(Entry> entry : fieldMap){