Updated uCore, fixed GWT build, better client snapshot system

This commit is contained in:
Anuken
2018-06-09 17:05:47 -04:00
parent b33dd7e91c
commit d5a58be440
16 changed files with 125 additions and 59 deletions

View File

@@ -98,7 +98,7 @@ public class RemoteMethodAnnotationProcessor extends AbstractProcessor {
//can't generate none methods
if (annotation.targets() == Loc.none) {
Utils.messager.printMessage(Kind.ERROR, "A @Remote method's where() cannot be equal to 'none':", element);
Utils.messager.printMessage(Kind.ERROR, "A @Remote method's targets() cannot be equal to 'none':", element);
}
//get and create class entry if needed
@@ -106,6 +106,8 @@ public class RemoteMethodAnnotationProcessor extends AbstractProcessor {
ClassEntry clas = new ClassEntry(annotation.in());
classMap.put(annotation.in(), clas);
classes.add(clas);
Utils.messager.printMessage(Kind.NOTE, "Generating class '" + clas.name + "'.");
}
ClassEntry entry = classMap.get(annotation.in());

View File

@@ -28,7 +28,6 @@ public class RemoteWriteGenerator {
for(ClassEntry entry : entries){
//create builder
System.out.println("Generating class! " + entry.name);
TypeSpec.Builder classBuilder = TypeSpec.classBuilder(entry.name).addModifiers(Modifier.PUBLIC);
//add temporary write buffer
@@ -107,7 +106,12 @@ public class RemoteWriteGenerator {
int index = 0;
StringBuilder results = new StringBuilder();
for(VariableElement var : elem.getParameters()){
results.append(var.getSimpleName());
//special case: calling local-only methods uses the local player
if(index == 0 && methodEntry.where == Loc.client){
results.append("io.anuke.mindustry.Vars.players[0]");
}else {
results.append(var.getSimpleName());
}
if(index != elem.getParameters().size() - 1) results.append(", ");
index ++;
}
@@ -151,7 +155,7 @@ public class RemoteWriteGenerator {
//captialized version of type name for writing primitives
String capName = typeName.equals("byte") ? "" : Character.toUpperCase(typeName.charAt(0)) + typeName.substring(1);
//special case: method can be called from anywhere to anywhere
//thus, only write the player when the SERVER is writing data, since the client is the only one who reads that
//thus, only write the player when the SERVER is writing data, since the client is the only one who reads it
boolean writePlayerSkipCheck = methodEntry.where == Loc.both && methodEntry.local == Loc.both && i == 0;
if(writePlayerSkipCheck){ //write begin check