Fixed some important crashes and multithreading issues
This commit is contained in:
@@ -14,10 +14,7 @@ import javax.lang.model.element.ExecutableElement;
|
|||||||
import javax.lang.model.element.Modifier;
|
import javax.lang.model.element.Modifier;
|
||||||
import javax.lang.model.element.TypeElement;
|
import javax.lang.model.element.TypeElement;
|
||||||
import javax.tools.Diagnostic.Kind;
|
import javax.tools.Diagnostic.Kind;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@@ -87,6 +84,9 @@ public class RemoteMethodAnnotationProcessor extends AbstractProcessor {
|
|||||||
//list of all method entries
|
//list of all method entries
|
||||||
classes = new ArrayList<>();
|
classes = new ArrayList<>();
|
||||||
|
|
||||||
|
List<Element> orderedElements = new ArrayList<>(elements);
|
||||||
|
orderedElements.sort(Comparator.comparing(Object::toString));
|
||||||
|
|
||||||
//create methods
|
//create methods
|
||||||
for (Element element : elements) {
|
for (Element element : elements) {
|
||||||
Remote annotation = element.getAnnotation(Remote.class);
|
Remote annotation = element.getAnnotation(Remote.class);
|
||||||
|
|||||||
@@ -93,6 +93,11 @@ public class ItemTransfer extends TimedEntity implements DrawTrait{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
|
if(to == null){
|
||||||
|
remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
super.update();
|
super.update();
|
||||||
current.set(from).interpolate(tovec.set(to.getX(), to.getY()), fin(), Interpolation.pow3);
|
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));
|
current.add(tovec.set(to.getX(), to.getY()).sub(from).nor().rotate90(1).scl(seed * fslope() * 10f));
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static io.anuke.mindustry.Vars.netClient;
|
import static io.anuke.mindustry.Vars.netClient;
|
||||||
import static io.anuke.mindustry.Vars.port;
|
import static io.anuke.mindustry.Vars.port;
|
||||||
|
import static io.anuke.mindustry.Vars.threads;
|
||||||
|
|
||||||
public class KryoClient implements ClientProvider{
|
public class KryoClient implements ClientProvider{
|
||||||
Client client;
|
Client client;
|
||||||
@@ -64,14 +65,14 @@ public class KryoClient implements ClientProvider{
|
|||||||
c.id = connection.getID();
|
c.id = connection.getID();
|
||||||
if(connection.getRemoteAddressTCP() != null) c.addressTCP = connection.getRemoteAddressTCP().toString();
|
if(connection.getRemoteAddressTCP() != null) c.addressTCP = connection.getRemoteAddressTCP().toString();
|
||||||
|
|
||||||
Gdx.app.postRunnable(() -> Net.handleClientReceived(c));
|
threads.runDelay(() -> Net.handleClientReceived(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnected (Connection connection) {
|
public void disconnected (Connection connection) {
|
||||||
Disconnect c = new Disconnect();
|
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");
|
if(connection.getLastProtocolError() != null) Log.error("\n\n\n\nProtocol error: " + connection.getLastProtocolError() + "\n\n\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user