From 00854988fb36f7f90ea7aa3747c976e7d7412ea4 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 19 Oct 2013 17:42:45 +1100 Subject: [PATCH] Latest snapshot. Doesnt seem to be worky though --- protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java | 4 ++-- .../src/main/java/net/md_5/bungee/protocol/packet/Login.java | 3 +++ .../main/java/net/md_5/bungee/protocol/packet/Respawn.java | 3 +++ proxy/src/main/java/net/md_5/bungee/PacketConstants.java | 4 ++-- proxy/src/main/java/net/md_5/bungee/ServerConnector.java | 4 ++-- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java b/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java index 59c28f9d..cb1b6a68 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java @@ -92,8 +92,8 @@ public enum Protocol }; /*========================================================================*/ public static final int MAX_PACKET_ID = 0xFF; - public static final int PROTOCOL_VERSION = 0x00; - public static final String MINECRAFT_VERSION = "13w41b"; + public static final int PROTOCOL_VERSION = 0x01; + public static final String MINECRAFT_VERSION = "13w42b"; /*========================================================================*/ public final ProtocolDirection TO_SERVER = new ProtocolDirection( "TO_SERVER" ); public final ProtocolDirection TO_CLIENT = new ProtocolDirection( "TO_CLIENT" ); diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Login.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Login.java index 321b93a8..ff41f7b9 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Login.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Login.java @@ -20,6 +20,7 @@ public class Login extends DefinedPacket private int dimension; private short difficulty; private short maxPlayers; + private String levelType; @Override public void read(ByteBuf buf) @@ -29,6 +30,7 @@ public class Login extends DefinedPacket dimension = buf.readByte(); difficulty = buf.readUnsignedByte(); maxPlayers = buf.readUnsignedByte(); + levelType = readString( buf ); } @Override @@ -39,6 +41,7 @@ public class Login extends DefinedPacket buf.writeByte( dimension ); buf.writeByte( difficulty ); buf.writeByte( maxPlayers ); + writeString( levelType, buf ); } @Override diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Respawn.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Respawn.java index b5a44823..d0a7529e 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Respawn.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Respawn.java @@ -18,6 +18,7 @@ public class Respawn extends DefinedPacket private int dimension; private short difficulty; private short gameMode; + private String levelType; @Override public void read(ByteBuf buf) @@ -25,6 +26,7 @@ public class Respawn extends DefinedPacket dimension = buf.readInt(); difficulty = buf.readUnsignedByte(); gameMode = buf.readUnsignedByte(); + levelType = readString( buf ); } @Override @@ -33,6 +35,7 @@ public class Respawn extends DefinedPacket buf.writeInt( dimension ); buf.writeByte( difficulty ); buf.writeByte( gameMode ); + writeString( levelType, buf ); } @Override diff --git a/proxy/src/main/java/net/md_5/bungee/PacketConstants.java b/proxy/src/main/java/net/md_5/bungee/PacketConstants.java index 75fd9b55..82814b07 100644 --- a/proxy/src/main/java/net/md_5/bungee/PacketConstants.java +++ b/proxy/src/main/java/net/md_5/bungee/PacketConstants.java @@ -7,8 +7,8 @@ import net.md_5.bungee.protocol.packet.PluginMessage; public class PacketConstants { - public static final Respawn DIM1_SWITCH = new Respawn( (byte) 1, (byte) 0, (byte) 0 ); - public static final Respawn DIM2_SWITCH = new Respawn( (byte) -1, (byte) 0, (byte) 0 ); + public static final Respawn DIM1_SWITCH = new Respawn( (byte) 1, (byte) 0, (byte) 0, "default" ); + public static final Respawn DIM2_SWITCH = new Respawn( (byte) -1, (byte) 0, (byte) 0, "default" ); public static final ClientStatus CLIENT_LOGIN = new ClientStatus( (byte) 0 ); public static final PluginMessage FORGE_MOD_REQUEST = new PluginMessage( "FML", new byte[] { diff --git a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java index 05f02263..d56e0f5e 100644 --- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java +++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java @@ -131,7 +131,7 @@ public class ServerConnector extends PacketHandler // Set tab list size, this sucks balls, TODO: what shall we do about packet mutability Login modLogin = new Login( login.getEntityId(), login.getGameMode(), (byte) login.getDimension(), login.getDifficulty(), - (byte) user.getPendingConnection().getListener().getTabListSize() ); + (byte) user.getPendingConnection().getListener().getTabListSize(), login.getLevelType() ); user.unsafe().sendPacket( modLogin ); @@ -156,7 +156,7 @@ public class ServerConnector extends PacketHandler user.sendDimensionSwitch(); user.setServerEntityId( login.getEntityId() ); - user.unsafe().sendPacket( new Respawn( login.getDimension(), login.getDifficulty(), login.getGameMode() ) ); + user.unsafe().sendPacket( new Respawn( login.getDimension(), login.getDifficulty(), login.getGameMode(), login.getLevelType() ) ); // Remove from old servers user.getServer().setObsolete( true );