1.9.1 support
This commit is contained in:
parent
891ad8711d
commit
6b4e285186
@ -108,7 +108,8 @@ public enum Protocol
|
|||||||
public static final int MAX_PACKET_ID = 0xFF;
|
public static final int MAX_PACKET_ID = 0xFF;
|
||||||
public static List<Integer> supportedVersions = Arrays.asList(
|
public static List<Integer> supportedVersions = Arrays.asList(
|
||||||
ProtocolConstants.MINECRAFT_1_8,
|
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 );
|
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() );
|
packetRemap.put( ProtocolConstants.MINECRAFT_1_8, new TIntIntHashMap() );
|
||||||
packetRemapInv.put( ProtocolConstants.MINECRAFT_1_8, new TIntIntHashMap() );
|
packetRemapInv.put( ProtocolConstants.MINECRAFT_1_8, new TIntIntHashMap() );
|
||||||
packetRemap.put(ProtocolConstants.MINECRAFT_1_9, new TIntIntHashMap() );
|
packetRemap.put( ProtocolConstants.MINECRAFT_1_9, new TIntIntHashMap() );
|
||||||
packetRemapInv.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)
|
public final DefinedPacket createPacket(int id, int protocol)
|
||||||
|
@ -5,11 +5,14 @@ import java.util.List;
|
|||||||
|
|
||||||
public class ProtocolConstants
|
public class ProtocolConstants
|
||||||
{
|
{
|
||||||
|
|
||||||
public static final int MINECRAFT_1_8 = 47;
|
public static final int MINECRAFT_1_8 = 47;
|
||||||
public static final int MINECRAFT_1_9 = 107;
|
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(
|
public static final List<String> SUPPORTED_VERSIONS = Arrays.asList(
|
||||||
"1.8.x",
|
"1.8.x",
|
||||||
"1.9"
|
"1.9",
|
||||||
|
"1.9.1"
|
||||||
);
|
);
|
||||||
|
|
||||||
public enum Direction
|
public enum Direction
|
||||||
|
@ -24,8 +24,8 @@ public class EncryptionRequest extends DefinedPacket
|
|||||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
{
|
{
|
||||||
serverId = readString( buf );
|
serverId = readString( buf );
|
||||||
publicKey = readArray( buf );
|
publicKey = readArray( buf, 128 );
|
||||||
verifyToken = readArray( buf );
|
verifyToken = readArray( buf, 128 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,8 +22,8 @@ public class EncryptionResponse extends DefinedPacket
|
|||||||
@Override
|
@Override
|
||||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
{
|
{
|
||||||
sharedSecret = readArray( buf, 256 );
|
sharedSecret = readArray( buf, 128 );
|
||||||
verifyToken = readArray( buf, 256 );
|
verifyToken = readArray( buf, 128 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -29,7 +29,13 @@ public class Login extends DefinedPacket
|
|||||||
{
|
{
|
||||||
entityId = buf.readInt();
|
entityId = buf.readInt();
|
||||||
gameMode = buf.readUnsignedByte();
|
gameMode = buf.readUnsignedByte();
|
||||||
|
if ( protocolVersion > ProtocolConstants.MINECRAFT_1_9 )
|
||||||
|
{
|
||||||
|
dimension = buf.readInt();
|
||||||
|
} else
|
||||||
|
{
|
||||||
dimension = buf.readByte();
|
dimension = buf.readByte();
|
||||||
|
}
|
||||||
difficulty = buf.readUnsignedByte();
|
difficulty = buf.readUnsignedByte();
|
||||||
maxPlayers = buf.readUnsignedByte();
|
maxPlayers = buf.readUnsignedByte();
|
||||||
levelType = readString( buf );
|
levelType = readString( buf );
|
||||||
@ -44,7 +50,13 @@ public class Login extends DefinedPacket
|
|||||||
{
|
{
|
||||||
buf.writeInt( entityId );
|
buf.writeInt( entityId );
|
||||||
buf.writeByte( gameMode );
|
buf.writeByte( gameMode );
|
||||||
|
if ( protocolVersion > ProtocolConstants.MINECRAFT_1_9 )
|
||||||
|
{
|
||||||
|
buf.writeInt( dimension );
|
||||||
|
} else
|
||||||
|
{
|
||||||
buf.writeByte( dimension );
|
buf.writeByte( dimension );
|
||||||
|
}
|
||||||
buf.writeByte( difficulty );
|
buf.writeByte( difficulty );
|
||||||
buf.writeByte( maxPlayers );
|
buf.writeByte( maxPlayers );
|
||||||
writeString( levelType, buf );
|
writeString( levelType, buf );
|
||||||
|
@ -28,6 +28,7 @@ public abstract class EntityMap
|
|||||||
case ProtocolConstants.MINECRAFT_1_8:
|
case ProtocolConstants.MINECRAFT_1_8:
|
||||||
return EntityMap_1_8.INSTANCE;
|
return EntityMap_1_8.INSTANCE;
|
||||||
case ProtocolConstants.MINECRAFT_1_9:
|
case ProtocolConstants.MINECRAFT_1_9:
|
||||||
|
case ProtocolConstants.MINECRAFT_1_9_1:
|
||||||
return EntityMap_1_9.INSTANCE;
|
return EntityMap_1_9.INSTANCE;
|
||||||
}
|
}
|
||||||
throw new RuntimeException( "Version " + version + " has no entity map" );
|
throw new RuntimeException( "Version " + version + " has no entity map" );
|
||||||
|
Loading…
Reference in New Issue
Block a user