Switched to different Kryonet fork; full Android support

This commit is contained in:
Anuken 2018-01-01 16:09:17 -05:00
parent c7dbdd1773
commit 20eea3b385
27 changed files with 416 additions and 310 deletions

View File

@ -7,6 +7,7 @@ import android.os.Bundle;
import android.telephony.TelephonyManager;
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.esotericsoftware.minlog.Log;
import io.anuke.kryonet.KryoClient;
import io.anuke.kryonet.KryoServer;
import io.anuke.mindustry.io.PlatformFunction;
@ -64,6 +65,8 @@ public class AndroidLauncher extends AndroidApplication{
config.hideStatusBar = true;
Log.set(Log.LEVEL_DEBUG);
Net.setClientProvider(new KryoClient());
Net.setServerProvider(new KryoServer());

View File

@ -114,7 +114,7 @@ project(":kryonet") {
dependencies {
compile project(":core")
compile "com.esotericsoftware:kryonet:2.22.0-RC1"
compile 'com.github.crykn:kryonet:2.22.1'
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

View File

@ -13,8 +13,9 @@ text.loadgame=Load Game
text.joingame=Join Game
text.quit=Quit
text.server.connected=A player has joined.
text.server.disconnected=A player has disconnected.
text.server.disconnected={0} has disconnected.
text.hostserver=Host Server
text.host=Host
text.joingame.title=Join Game
text.joingame.ip=IP:
text.disconnect=Disconnected.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -43,6 +43,7 @@ public class Vars{
public static final int zoomScale = Math.round(Unit.dp.scl(1));
//if true, player speed will be increased, massive amounts of resources will be given on start, and other debug options will be available
public static boolean debug = false;
public static boolean debugNet = false;
//whether the player can clip through walls
public static boolean noclip = false;
//whether to draw chunk borders

View File

@ -194,6 +194,7 @@ public class Control extends Module{
}
player = new Player();
player.isAndroid = Vars.android;
player.isLocal = true;
spawns = WaveCreator.getSpawns();
@ -397,6 +398,10 @@ public class Control extends Module{
}
public void coreDestroyed(){
if(Net.active() && Net.server()){
Net.closeServer();
}
Effects.shake(5, 6, Core.camera.position.x, Core.camera.position.y);
Sounds.play("corexplode");
for(int i = 0; i < 16; i ++){

View File

@ -1,6 +1,7 @@
package io.anuke.mindustry.core;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.TimeUtils;
import com.badlogic.gdx.utils.reflect.ClassReflection;
import com.badlogic.gdx.utils.reflect.ReflectionException;
import io.anuke.mindustry.Vars;
@ -33,7 +34,7 @@ import java.util.Arrays;
public class NetClient extends Module {
boolean connecting = false;
boolean gotEntities = false;
float playerSyncTime = 3;
float playerSyncTime = 2;
public NetClient(){
@ -44,6 +45,11 @@ public class NetClient extends Module {
Vars.ui.hideLoading();
Vars.ui.showLoading("$text.connecting.data");
});
ConnectPacket c = new ConnectPacket();
c.name = UCore.getProperty("user.name");
c.android = Vars.android;
Net.send(c, SendMode.tcp);
});
Net.handle(Disconnect.class, packet -> {
@ -98,7 +104,7 @@ public class NetClient extends Module {
int id = packet.ids[i];
if(id != Vars.player.id){
Entity entity = null;
if(id >= packet.enemyStart){
if(i >= packet.enemyStart){
entity = Vars.control.enemyGroup.getByID(id);
}else {
entity = Vars.control.playerGroup.getByID(id);
@ -106,7 +112,10 @@ public class NetClient extends Module {
Syncable sync = ((Syncable)entity);
if(sync == null) continue;
if(sync == null){
Gdx.app.error("Mindustry", "Unknown entity ID: " + id + " " + (i >= packet.enemyStart ? "(enemy)" : "(player)"));
continue;
}
//augh
((Interpolator)sync.getInterpolator()).type.read(entity, packet.data[i]);
@ -136,6 +145,8 @@ public class NetClient extends Module {
}
Vars.control.setWaveData(packet.enemies, packet.wave, packet.countdown);
Timers.resetTime(packet.time + (float)(TimeUtils.timeSinceMillis(packet.timestamp) / 1000.0 * 60.0));
Gdx.app.postRunnable(() -> {
Vars.ui.updateItems();
});
@ -217,6 +228,18 @@ public class NetClient extends Module {
e.printStackTrace();
}
});
Net.handle(DisconnectPacket.class, packet -> {
Player player = Vars.control.playerGroup.getByID(packet.playerid);
if(player != null){
player.remove();
}
});
Net.handle(Player.class, player -> {
player.add();
});
}
public void update(){
@ -259,7 +282,7 @@ public class NetClient extends Module {
if(Timers.get("syncPlayer", playerSyncTime)){
PositionPacket packet = new PositionPacket();
packet.data = Vars.player.getInterpolator().type.write(Vars.player);
Net.send(packet, SendMode.tcp); //TODO udp instead?
Net.send(packet, SendMode.udp); //TODO udp instead?
}
}
}

View File

@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.IntArray;
import com.badlogic.gdx.utils.IntMap;
import com.badlogic.gdx.utils.TimeUtils;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.entities.BulletType;
@ -24,6 +25,7 @@ import io.anuke.ucore.core.Effects.Effect;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.entities.Entity;
import io.anuke.ucore.modules.Module;
import io.anuke.ucore.util.Bundles;
import io.anuke.ucore.util.Mathf;
import java.io.ByteArrayInputStream;
@ -39,8 +41,14 @@ public class NetServer extends Module{
public NetServer(){
Net.handleServer(Connect.class, packet -> {
UCore.log("Sending world data to client (ID="+packet.id+"/"+packet.addressTCP+")");
Net.handleServer(Connect.class, connect -> {
UCore.log("Connection found: " + connect.addressTCP);
});
Net.handleServer(ConnectPacket.class, packet -> {
int id = Net.getLastConnection();
UCore.log("Sending world data to client (ID="+id+")");
WorldData data = new WorldData();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
@ -51,7 +59,7 @@ public class NetServer extends Module{
//TODO compress and uncompress when sending
data.stream = new ByteArrayInputStream(stream.toByteArray());
Net.sendStream(packet.id, data);
Net.sendStream(id, data);
Gdx.app.postRunnable(() -> {
Vars.ui.showInfo("$text.server.connected");
@ -59,25 +67,38 @@ public class NetServer extends Module{
EntityDataPacket dp = new EntityDataPacket();
Player player = new Player();
player.clientid = packet.id;
player.clientid = id;
player.name = packet.name;
player.isAndroid = packet.android;
player.set(Vars.control.core.worldx(), Vars.control.core.worldy() - Vars.tilesize*2);
player.add();
connections.put(packet.id, player);
connections.put(id, player);
dp.playerid = player.id;
dp.players = Vars.control.playerGroup.all().toArray(Player.class);
UCore.log("Sending entities: " + Arrays.toString(dp.players));
//TODO send pathfind positions
//TODO save enemy nodes
Net.sendExcept(id, player, SendMode.tcp);
Net.sendTo(packet.id, dp, SendMode.tcp);
Net.sendTo(id, dp, SendMode.tcp);
});
});
Net.handleServer(Disconnect.class, packet -> {
Gdx.app.postRunnable(() -> Vars.ui.showInfo("$text.server.disconnected"));
Player player = connections.get(packet.id);
if(player == null) {
Gdx.app.postRunnable(() -> Vars.ui.showInfo(Bundles.format("text.server.disconnected", "<???>")));
return;
}
Gdx.app.postRunnable(() -> Vars.ui.showInfo(Bundles.format("text.server.disconnected", player.name)));
DisconnectPacket dc = new DisconnectPacket();
dc.playerid = player.id;
Net.send(dc, SendMode.tcp);
});
Net.handleServer(PositionPacket.class, pos -> {
@ -200,7 +221,7 @@ public class NetServer extends Module{
packet.ids = new int[amount];
packet.data = new float[amount][0];
int index = 0;
short index = 0;
for(Player player : Vars.control.playerGroup.all()){
float[] out = player.getInterpolator().type.write(player);
@ -229,23 +250,24 @@ public class NetServer extends Module{
packet.countdown = Vars.control.getWaveCountdown();
packet.enemies = Vars.control.getEnemiesRemaining();
packet.wave = Vars.control.getWave();
packet.time = Timers.time();
packet.timestamp = TimeUtils.millis();
Net.send(packet, SendMode.udp);
}
if(Timers.get("serverBlockSync", blockSyncTime)){
BlockSyncPacket packet = new BlockSyncPacket();
IntArray connections = Net.getConnections();
for(int i = 0; i < connections.size; i ++){
int id = connections.get(i);
Player player = this.connections.get(i);
Player player = this.connections.get(id);
if(player == null) continue;
int x = Mathf.scl2(player.x, Vars.tilesize);
int y = Mathf.scl2(player.y, Vars.tilesize);
int w = 14;
int h = 10;
int w = 16;
int h = 12;
sendBlockSync(id, x, y, w, h);
}
@ -270,7 +292,7 @@ public class NetServer extends Module{
byte times = 0;
for(; times < tile.entity.timer.getTimes().length; times ++){
if(tile.entity.timer.getTimes()[times] > 0){
if(tile.entity.timer.getTimes()[times] <= 1f){
break;
}
}
@ -278,7 +300,7 @@ public class NetServer extends Module{
stream.writeByte(times);
for(int i = 0; i < times; i ++){
stream.writeFloat(tile.entity.timer.getTimes()[times]);
stream.writeFloat(tile.entity.timer.getTimes()[i]);
}
tile.entity.write(stream);

View File

@ -418,10 +418,8 @@ public class Renderer extends RendererModule{
drawHealth(entity);
}
if(!Vars.android && Vars.showPlayer) {
for(Player player : Vars.control.playerGroup.all()){
if(!player.isDead()) drawHealth(player);
}
for(Player player : Vars.control.playerGroup.all()){
if(!player.isDead() && !player.isAndroid) drawHealth(player);
}
}
}

View File

@ -181,10 +181,12 @@ public class UI extends SceneModule{
join = new FloatingDialog("$text.joingame.title");
join.content().add("$text.joingame.ip").left();
join.content().addField("localhost", text -> lastip = text).size(180f, 54f);
Mindustry.platforms.addDialog(join.content().addField("localhost", text -> lastip = text).size(180f, 54f).get());
join.content().row();
join.content().add("$text.server.port").left();
join.content().addField(Vars.port + "", new DigitsOnlyFilter(), text -> lastport = Strings.parseInt(text)).size(180f, 54f);
Mindustry.platforms.addDialog(join.content()
.addField(Vars.port + "", new DigitsOnlyFilter(), text -> lastport = Strings.parseInt(text))
.size(180f, 54f).get());
join.buttons().defaults().size(140f, 60f).pad(4f);
join.buttons().addButton("$text.cancel", join::hide);
join.buttons().addButton("$text.ok", () -> {
@ -472,6 +474,21 @@ public class UI extends SceneModule{
public void showInfo(String info){
scene.table().add(info).get().getParent().actions(Actions.fadeOut(4f), Actions.removeActor());
}
public void showHostServer(){
showTextInput("$text.hostserver", "$text.server.port", Vars.port + "", new DigitsOnlyFilter(), text -> {
int result = Strings.parseInt(text);
if(result == Integer.MIN_VALUE || result >= 65535){
Vars.ui.showError("$text.server.invalidport");
}else{
try{
Net.host(result);
}catch (IOException e){
Vars.ui.showError(Bundles.format("text.server.error", Strings.parseException(e, false)));
}
}
});
}
public void showAbout(){
about.show();

View File

@ -11,6 +11,7 @@ import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.Blocks;
import io.anuke.ucore.core.*;
import io.anuke.ucore.entities.DestructibleEntity;
import io.anuke.ucore.entities.SolidEntity;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
@ -19,10 +20,14 @@ import static io.anuke.mindustry.Vars.*;
public class Player extends DestructibleEntity implements Syncable{
private static final float speed = 1.1f;
private static final float dashSpeed = 1.8f;
public String name = "player name";
public transient Weapon weapon = Weapon.blaster;
public Mech mech = Mech.standard;
public float angle;
public boolean isAndroid;
public transient float targetAngle = 0f;
public transient int clientid;
public transient boolean isLocal = false;
@ -43,15 +48,20 @@ public class Player extends DestructibleEntity implements Syncable{
}
@Override
public Interpolator getInterpolator() {
public Interpolator<Player> getInterpolator() {
return inter;
}
@Override
public void damage(int amount){
if(!Vars.debug && !Vars.android)
if(!Vars.debug)
super.damage(amount);
}
@Override
public boolean collides(SolidEntity other){
return super.collides(other) && !isAndroid;
}
@Override
public void onDeath(){
@ -79,9 +89,13 @@ public class Player extends DestructibleEntity implements Syncable{
@Override
public void draw(){
if((Vars.debug && (!Vars.showPlayer || !Vars.showUI)) || (Vars.android && isLocal)) return;
if(isAndroid && isLocal){
angle = Mathf.lerpAngDelta(angle, targetAngle, 0.2f);
}
String part = Vars.android ? "ship" : "mech";
if((Vars.debug && (!Vars.showPlayer || !Vars.showUI)) || (isAndroid && isLocal)) return;
String part = isAndroid ? "ship" : "mech";
if(Vars.snapCamera && Settings.getBool("smoothcam") && Settings.getBool("pixelate")){
Draw.rect(part+"-"+mech.name(), (int)x, (int)y, angle-90);
@ -93,7 +107,7 @@ public class Player extends DestructibleEntity implements Syncable{
@Override
public void update(){
if(!isLocal || android){
if(!isLocal || isAndroid){
if(!isDead() && !isLocal) inter.update(this);
return;
}
@ -153,4 +167,9 @@ public class Player extends DestructibleEntity implements Syncable{
public Player add(){
return add(Vars.control.playerGroup);
}
@Override
public String toString() {
return "Player{" + id + ", android=" + isAndroid + ", local=" + isLocal + ", " + x + ", " + y + "}\n";
}
}

View File

@ -52,7 +52,7 @@ public class GestureHandler extends GestureAdapter{
float dx = deltaX*Core.camera.zoom/Core.cameraScale, dy = deltaY*Core.camera.zoom/Core.cameraScale;
player.x -= dx;
player.y += dy;
player.angle = Mathf.lerpAngDelta(player.angle, Mathf.atan2(dx, dy), 0.5f);
player.targetAngle = Mathf.atan2(dx, -dy);
}else if(player.placeMode.lockCamera && (player.placeMode.pan && player.recipe != null)){
input.mousex += deltaX;
input.mousey += deltaY;

View File

@ -1,7 +1,6 @@
package io.anuke.mindustry.io;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.TimeUtils;
import com.badlogic.gdx.utils.reflect.ClassReflection;
import io.anuke.mindustry.Vars;
@ -12,8 +11,6 @@ import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.Blocks;
import io.anuke.mindustry.world.blocks.types.BlockPart;
import io.anuke.mindustry.world.blocks.types.Rock;
import io.anuke.mindustry.world.blocks.types.production.Generator;
import io.anuke.ucore.UCore;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.entities.Entities;
@ -141,7 +138,7 @@ public class NetworkIO {
byte times = 0;
for(; times < tile.entity.timer.getTimes().length; times ++){
if(tile.entity.timer.getTimes()[times] > 0){
if(tile.entity.timer.getTimes()[times] <= 1){
break;
}
}
@ -149,7 +146,7 @@ public class NetworkIO {
stream.writeByte(times);
for(int i = 0; i < times; i ++){
stream.writeFloat(tile.entity.timer.getTimes()[times]);
stream.writeFloat(tile.entity.timer.getTimes()[i]);
}
tile.entity.write(stream);
@ -204,8 +201,6 @@ public class NetworkIO {
int enemies = stream.readInt();
Array<Enemy> enemiesToUpdate = new Array<>();
for(int i = 0; i < enemies; i ++){
int id = stream.readInt();
byte type = stream.readByte();
@ -226,7 +221,6 @@ public class NetworkIO {
enemy.tier = tier;
enemy.node = node;
enemy.add(Vars.control.enemyGroup);
enemiesToUpdate.add(enemy);
}catch (Exception e){
throw new RuntimeException(e);
}
@ -234,8 +228,7 @@ public class NetworkIO {
Vars.control.setWaveData(enemies, wave, wavetime);
if(!android)
Vars.player.add();
Vars.player.add();
//map

View File

@ -2,12 +2,7 @@ package io.anuke.mindustry.io;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Timer;
import com.badlogic.gdx.utils.Timer.Task;
import com.badlogic.gdx.utils.async.AsyncExecutor;
import com.badlogic.gdx.utils.reflect.ClassReflection;
import com.badlogic.gdx.utils.reflect.Field;
import com.badlogic.gdx.utils.reflect.ReflectionException;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.core.GameState;
import io.anuke.mindustry.core.GameState.State;
@ -156,6 +151,7 @@ public class Saves {
public void delete(){
SaveIO.fileFor(index).delete();
saves.removeValue(this, true);
if(this == current){
current = null;
}

View File

@ -192,6 +192,8 @@ public class Net{
public IntArray getConnections();
/**Register classes to be sent.*/
public void register(Class<?>... types);
/**Returns the ping for a certain connection.*/
public int getPingFor(int connection);
}
public enum SendMode{

View File

@ -28,17 +28,27 @@ public class Packets {
public static class SyncPacket{
public int[] ids;
public float[][] data;
public int enemyStart = 0;
public short enemyStart;
}
public static class BlockSyncPacket extends Streamable{
}
public static class StateSyncPacket {
public static class ConnectPacket{
public String name;
public boolean android;
}
public static class DisconnectPacket{
public int playerid;
}
public static class StateSyncPacket{
public int[] items;
public float countdown;
public float countdown, time;
public int enemies, wave;
public long timestamp;
}
public static class PositionPacket{

View File

@ -31,6 +31,8 @@ public class Registrator {
EnemyDeathPacket.class,
BlockUpdatePacket.class,
BlockDestroyPacket.class,
ConnectPacket.class,
DisconnectPacket.class,
Class.class,
byte[].class,

View File

@ -1,7 +1,6 @@
package io.anuke.mindustry.net;
import com.badlogic.gdx.math.Vector2;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.enemies.Enemy;
import io.anuke.mindustry.graphics.Fx;
@ -37,11 +36,11 @@ public interface Syncable {
@Override
public void update(Player entity, Interpolator interpolator) {
Interpolator i = entity.getInterpolator();
if(i.target.dst(entity.x, entity.y) > 16){
if(i.target.dst(entity.x, entity.y) > 16 && !entity.isAndroid){
entity.set(i.target.x, i.target.y);
}
if(Vars.android && i.target.dst(entity.x, entity.y) > 2f && Timers.get(entity, "dashfx", 3)){
if(entity.isAndroid && i.target.dst(entity.x, entity.y) > 2f && Timers.get(entity, "dashfx", 2)){
Angles.translation(entity.angle + 180, 3f);
Effects.effect(Fx.dashsmoke, entity.x + Angles.x(), entity.y + Angles.y());
}

View File

@ -10,11 +10,7 @@ import io.anuke.ucore.scene.Element;
import io.anuke.ucore.scene.builders.build;
import io.anuke.ucore.scene.builders.imagebutton;
import io.anuke.ucore.scene.ui.ImageButton;
import io.anuke.ucore.scene.ui.TextField.TextFieldFilter.DigitsOnlyFilter;
import io.anuke.ucore.util.Bundles;
import io.anuke.ucore.util.Strings;
import java.io.IOException;
import static io.anuke.mindustry.Vars.ui;
@ -62,26 +58,13 @@ public class MenuDialog extends FloatingDialog{
content().row();
content().addButton("$text.hostserver", () -> {
Vars.ui.showTextInput("$text.hostserver", "$text.server.port", Vars.port + "", new DigitsOnlyFilter(), text -> {
int result = Strings.parseInt(text);
if(result == Integer.MIN_VALUE || result >= 65535){
Vars.ui.showError("$text.server.invalidport");
}else{
try{
Net.host(result);
GameState.set(State.playing);
}catch (IOException e){
Vars.ui.showError(Bundles.format("text.server.error", Strings.parseException(e, false)));
}
}
});
}).disabled(b -> Net.active() || (Net.active() && !Net.server()));
content().addButton("$text.hostserver", () -> ui.showHostServer())
.disabled(b -> Net.active() || (Net.active() && !Net.server()));
content().row();
content().addButton("$text.quit", () -> {
Vars.ui.showConfirm("$text.confirm", "$text.quit.confirm", () -> {
ui.showConfirm("$text.confirm", "$text.quit.confirm", () -> {
runSave();
hide();
GameState.set(State.menu);
@ -105,8 +88,12 @@ public class MenuDialog extends FloatingDialog{
new imagebutton("icon-tools", isize, () -> ui.showPrefs()).text("$text.settings").padTop(4f);
new imagebutton("icon-save", isize, ()-> save.show()).text("$text.save").padTop(4f);
content().row();
new imagebutton("icon-load", isize, () -> load.show()).text("$text.load").padTop(4f);
new imagebutton("icon-host", isize, () -> ui.showHostServer()).text("$text.host").padTop(4f);
new imagebutton("icon-quit", isize, () -> {
Vars.ui.showConfirm("$text.confirm", "$text.quit.confirm", () -> {

View File

@ -150,6 +150,14 @@ public class HudFragment implements Fragment{
}}.end();
if(Vars.debugNet) {
new table() {{
new label(() -> "players: " + Vars.control.playerGroup.amount());
row();
new label(() -> "" + Vars.control.playerGroup.all());
}}.end();
}
blockfrag.build();
}

View File

@ -72,7 +72,7 @@ public class MenuFragment implements Fragment{
new imagebutton("icon-tools", isize, () -> ui.showPrefs()).text("$text.settings").padTop(4f);
new imagebutton("icon-tools", isize, () -> ui.showJoinGame()).text("$text.joingame").padTop(4f);
new imagebutton("icon-add", isize, () -> ui.showJoinGame()).text("$text.joingame").padTop(4f);
if(Mindustry.donationsCallable != null){
new imagebutton("icon-donate", isize, () -> {

View File

@ -1,15 +1,7 @@
package io.anuke.mindustry.world.blocks.types.distribution;
import static io.anuke.mindustry.Vars.tilesize;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.*;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.IntArray;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.world.Block;
@ -17,7 +9,20 @@ import io.anuke.mindustry.world.Layer;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Draw;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.util.*;
import io.anuke.ucore.util.Bits;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Strings;
import io.anuke.ucore.util.Tmp;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.AbstractList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import static io.anuke.mindustry.Vars.tilesize;
public class Conveyor extends Block{
private static ItemPos pos1 = new ItemPos();
@ -182,6 +187,7 @@ public class Conveyor extends Block{
@Override
public void read(DataInputStream stream) throws IOException{
convey.clear();
int amount = stream.readInt();
convey.ensureCapacity(amount);

Binary file not shown.

View File

@ -0,0 +1,2 @@
Manifest-Version: 1.0

View File

@ -133,6 +133,11 @@ public class KryoServer implements ServerProvider {
}
}
@Override
public int getPingFor(int connection) {
return getByID(connection).getReturnTripTime();
}
@Override
public void register(Class<?>... types) {
for(Class<?> c : types){