Latest snapshot. Doesnt seem to be worky though

This commit is contained in:
md_5 2013-10-19 17:42:45 +11:00
parent 4f8085678c
commit 00854988fb
5 changed files with 12 additions and 6 deletions

View File

@ -92,8 +92,8 @@ public enum Protocol
}; };
/*========================================================================*/ /*========================================================================*/
public static final int MAX_PACKET_ID = 0xFF; public static final int MAX_PACKET_ID = 0xFF;
public static final int PROTOCOL_VERSION = 0x00; public static final int PROTOCOL_VERSION = 0x01;
public static final String MINECRAFT_VERSION = "13w41b"; public static final String MINECRAFT_VERSION = "13w42b";
/*========================================================================*/ /*========================================================================*/
public final ProtocolDirection TO_SERVER = new ProtocolDirection( "TO_SERVER" ); public final ProtocolDirection TO_SERVER = new ProtocolDirection( "TO_SERVER" );
public final ProtocolDirection TO_CLIENT = new ProtocolDirection( "TO_CLIENT" ); public final ProtocolDirection TO_CLIENT = new ProtocolDirection( "TO_CLIENT" );

View File

@ -20,6 +20,7 @@ public class Login extends DefinedPacket
private int dimension; private int dimension;
private short difficulty; private short difficulty;
private short maxPlayers; private short maxPlayers;
private String levelType;
@Override @Override
public void read(ByteBuf buf) public void read(ByteBuf buf)
@ -29,6 +30,7 @@ public class Login extends DefinedPacket
dimension = buf.readByte(); dimension = buf.readByte();
difficulty = buf.readUnsignedByte(); difficulty = buf.readUnsignedByte();
maxPlayers = buf.readUnsignedByte(); maxPlayers = buf.readUnsignedByte();
levelType = readString( buf );
} }
@Override @Override
@ -39,6 +41,7 @@ public class Login extends DefinedPacket
buf.writeByte( dimension ); buf.writeByte( dimension );
buf.writeByte( difficulty ); buf.writeByte( difficulty );
buf.writeByte( maxPlayers ); buf.writeByte( maxPlayers );
writeString( levelType, buf );
} }
@Override @Override

View File

@ -18,6 +18,7 @@ public class Respawn extends DefinedPacket
private int dimension; private int dimension;
private short difficulty; private short difficulty;
private short gameMode; private short gameMode;
private String levelType;
@Override @Override
public void read(ByteBuf buf) public void read(ByteBuf buf)
@ -25,6 +26,7 @@ public class Respawn extends DefinedPacket
dimension = buf.readInt(); dimension = buf.readInt();
difficulty = buf.readUnsignedByte(); difficulty = buf.readUnsignedByte();
gameMode = buf.readUnsignedByte(); gameMode = buf.readUnsignedByte();
levelType = readString( buf );
} }
@Override @Override
@ -33,6 +35,7 @@ public class Respawn extends DefinedPacket
buf.writeInt( dimension ); buf.writeInt( dimension );
buf.writeByte( difficulty ); buf.writeByte( difficulty );
buf.writeByte( gameMode ); buf.writeByte( gameMode );
writeString( levelType, buf );
} }
@Override @Override

View File

@ -7,8 +7,8 @@ import net.md_5.bungee.protocol.packet.PluginMessage;
public class PacketConstants public class PacketConstants
{ {
public static final Respawn DIM1_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 ); 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 ClientStatus CLIENT_LOGIN = new ClientStatus( (byte) 0 );
public static final PluginMessage FORGE_MOD_REQUEST = new PluginMessage( "FML", new byte[] public static final PluginMessage FORGE_MOD_REQUEST = new PluginMessage( "FML", new byte[]
{ {

View File

@ -131,7 +131,7 @@ public class ServerConnector extends PacketHandler
// Set tab list size, this sucks balls, TODO: what shall we do about packet mutability // 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(), 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 ); user.unsafe().sendPacket( modLogin );
@ -156,7 +156,7 @@ public class ServerConnector extends PacketHandler
user.sendDimensionSwitch(); user.sendDimensionSwitch();
user.setServerEntityId( login.getEntityId() ); 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 // Remove from old servers
user.getServer().setObsolete( true ); user.getServer().setObsolete( true );