Fixed some important crashes and multithreading issues

This commit is contained in:
Anuken 2018-06-25 18:46:04 -04:00
parent d948607039
commit b9b34eea37
3 changed files with 12 additions and 6 deletions

View File

@ -14,10 +14,7 @@ import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
import javax.tools.Diagnostic.Kind;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Objects;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
@ -87,6 +84,9 @@ public class RemoteMethodAnnotationProcessor extends AbstractProcessor {
//list of all method entries
classes = new ArrayList<>();
List<Element> orderedElements = new ArrayList<>(elements);
orderedElements.sort(Comparator.comparing(Object::toString));
//create methods
for (Element element : elements) {
Remote annotation = element.getAnnotation(Remote.class);

View File

@ -93,6 +93,11 @@ public class ItemTransfer extends TimedEntity implements DrawTrait{
@Override
public void update() {
if(to == null){
remove();
return;
}
super.update();
current.set(from).interpolate(tovec.set(to.getX(), to.getY()), fin(), Interpolation.pow3);
current.add(tovec.set(to.getX(), to.getY()).sub(from).nor().rotate90(1).scl(seed * fslope() * 10f));

View File

@ -27,6 +27,7 @@ import java.util.List;
import static io.anuke.mindustry.Vars.netClient;
import static io.anuke.mindustry.Vars.port;
import static io.anuke.mindustry.Vars.threads;
public class KryoClient implements ClientProvider{
Client client;
@ -64,14 +65,14 @@ public class KryoClient implements ClientProvider{
c.id = connection.getID();
if(connection.getRemoteAddressTCP() != null) c.addressTCP = connection.getRemoteAddressTCP().toString();
Gdx.app.postRunnable(() -> Net.handleClientReceived(c));
threads.runDelay(() -> Net.handleClientReceived(c));
}
@Override
public void disconnected (Connection connection) {
Disconnect c = new Disconnect();
Gdx.app.postRunnable(() -> Net.handleClientReceived(c));
threads.runDelay(() -> Net.handleClientReceived(c));
if(connection.getLastProtocolError() != null) Log.error("\n\n\n\nProtocol error: " + connection.getLastProtocolError() + "\n\n\n\n");
}