fix some issues with connecting to a server with a forced version

This commit is contained in:
Bixilon 2020-08-26 20:58:49 +02:00
parent eb2c1eff63
commit 35ae072d79
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
3 changed files with 10 additions and 3 deletions

View File

@ -102,7 +102,7 @@ public class ServerListCell extends ListCell<Server> implements Initializable {
icon.setImage(favicon);
optionsConnect.setOnAction(e -> {
Connection connection = new Connection(Connection.lastConnectionId++, server.getAddress(), new Player(Minosoft.accountList.get(0)));
connection.resolve(ConnectionReasons.CONNECT);
connection.resolve(ConnectionReasons.CONNECT, server.getDesiredVersion());
});
optionsEdit.setOnAction(e -> edit());

View File

@ -82,13 +82,20 @@ public class Connection {
network.connect(address);
}
public void resolve(ConnectionReasons reason) {
public void resolve(ConnectionReasons reason, int protocolId) {
address = addresses.get(0);
this.nextReason = reason;
Log.info(String.format("Trying to connect to %s", address));
if (protocolId != -1) {
setVersion(Versions.getVersionById(protocolId));
}
resolve(address);
}
public void resolve(ConnectionReasons reason) {
resolve(reason, -1);
}
public void resolve(ServerAddress address) {
reason = ConnectionReasons.DNS;
network.connect(address);

View File

@ -385,7 +385,7 @@ public class InByteBuffer {
public EntityMetaData.MetaDataHashMap readMetaData() {
EntityMetaData.MetaDataHashMap sets = new EntityMetaData.MetaDataHashMap();
if (protocolId < 47) {
if (protocolId < 48) {
byte item = readByte();
while (item != 0x7F) {