1.9.1 support

This commit is contained in:
md_5 2016-03-16 16:53:19 +11:00 committed by Thinkofname
parent 891ad8711d
commit 6b4e285186
6 changed files with 29 additions and 10 deletions

View File

@ -108,7 +108,8 @@ public enum Protocol
public static final int MAX_PACKET_ID = 0xFF;
public static List<Integer> supportedVersions = Arrays.asList(
ProtocolConstants.MINECRAFT_1_8,
ProtocolConstants.MINECRAFT_1_9
ProtocolConstants.MINECRAFT_1_9,
ProtocolConstants.MINECRAFT_1_9_1
);
/*========================================================================*/
public final DirectionData TO_SERVER = new DirectionData( ProtocolConstants.Direction.TO_SERVER );
@ -131,8 +132,10 @@ public enum Protocol
{
packetRemap.put( ProtocolConstants.MINECRAFT_1_8, new TIntIntHashMap() );
packetRemapInv.put( ProtocolConstants.MINECRAFT_1_8, new TIntIntHashMap() );
packetRemap.put(ProtocolConstants.MINECRAFT_1_9, new TIntIntHashMap() );
packetRemapInv.put(ProtocolConstants.MINECRAFT_1_9, new TIntIntHashMap() );
packetRemap.put( ProtocolConstants.MINECRAFT_1_9, new TIntIntHashMap() );
packetRemapInv.put( ProtocolConstants.MINECRAFT_1_9, new TIntIntHashMap() );
packetRemap.put( ProtocolConstants.MINECRAFT_1_9_1, packetRemap.get( ProtocolConstants.MINECRAFT_1_9 ) );
packetRemapInv.put( ProtocolConstants.MINECRAFT_1_9_1, packetRemapInv.get( ProtocolConstants.MINECRAFT_1_9 ) );
}
public final DefinedPacket createPacket(int id, int protocol)

View File

@ -5,11 +5,14 @@ import java.util.List;
public class ProtocolConstants
{
public static final int MINECRAFT_1_8 = 47;
public static final int MINECRAFT_1_9 = 107;
public static final int MINECRAFT_1_9_1 = 108;
public static final List<String> SUPPORTED_VERSIONS = Arrays.asList(
"1.8.x",
"1.9"
"1.9",
"1.9.1"
);
public enum Direction

View File

@ -24,8 +24,8 @@ public class EncryptionRequest extends DefinedPacket
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
serverId = readString( buf );
publicKey = readArray( buf );
verifyToken = readArray( buf );
publicKey = readArray( buf, 128 );
verifyToken = readArray( buf, 128 );
}
@Override

View File

@ -22,8 +22,8 @@ public class EncryptionResponse extends DefinedPacket
@Override
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
sharedSecret = readArray( buf, 256 );
verifyToken = readArray( buf, 256 );
sharedSecret = readArray( buf, 128 );
verifyToken = readArray( buf, 128 );
}
@Override

View File

@ -29,7 +29,13 @@ public class Login extends DefinedPacket
{
entityId = buf.readInt();
gameMode = buf.readUnsignedByte();
dimension = buf.readByte();
if ( protocolVersion > ProtocolConstants.MINECRAFT_1_9 )
{
dimension = buf.readInt();
} else
{
dimension = buf.readByte();
}
difficulty = buf.readUnsignedByte();
maxPlayers = buf.readUnsignedByte();
levelType = readString( buf );
@ -44,7 +50,13 @@ public class Login extends DefinedPacket
{
buf.writeInt( entityId );
buf.writeByte( gameMode );
buf.writeByte( dimension );
if ( protocolVersion > ProtocolConstants.MINECRAFT_1_9 )
{
buf.writeInt( dimension );
} else
{
buf.writeByte( dimension );
}
buf.writeByte( difficulty );
buf.writeByte( maxPlayers );
writeString( levelType, buf );

View File

@ -28,6 +28,7 @@ public abstract class EntityMap
case ProtocolConstants.MINECRAFT_1_8:
return EntityMap_1_8.INSTANCE;
case ProtocolConstants.MINECRAFT_1_9:
case ProtocolConstants.MINECRAFT_1_9_1:
return EntityMap_1_9.INSTANCE;
}
throw new RuntimeException( "Version " + version + " has no entity map" );