Forge support is now working - however an unidentified mod is breaking it due to the use of packet 80. All I can tell is this mod is present in FTB lite.

This commit is contained in:
md_5 2013-02-14 19:41:16 +11:00
parent bef2818537
commit 9b1f1d9a50
2 changed files with 26 additions and 8 deletions

View File

@ -44,6 +44,10 @@ public class InitialHandler extends PacketHandler implements Runnable, PendingCo
private PacketFDEncryptionRequest request;
private List<PacketFAPluginMessage> loginMessages = new ArrayList<>();
private State thisState = State.HANDSHAKE;
private static final PacketFAPluginMessage forgeMods = new PacketFAPluginMessage( "FML", new byte[]
{
0, 0, 0, 0, 0, 2
} );
public InitialHandler(Socket socket, ListenerInfo info) throws IOException
{
@ -106,6 +110,7 @@ public class InitialHandler extends PacketHandler implements Runnable, PendingCo
{
Preconditions.checkState( thisState == State.HANDSHAKE, "Not expecting HANDSHAKE" );
this.handshake = handshake;
stream.write( forgeMods );
request = EncryptionUtil.encryptRequest();
stream.write( request );
thisState = State.ENCRYPT;
@ -166,6 +171,7 @@ public class InitialHandler extends PacketHandler implements Runnable, PendingCo
{
byte[] buf = stream.readPacket();
DefinedPacket packet = DefinedPacket.packet( buf );
System.out.println( packet );
packet.handle( this );
}
} catch ( Exception ex )

View File

@ -55,18 +55,30 @@ public class ServerConnection extends GenericConnection implements Server
}
stream.write( handshake );
stream.write( PacketCDClientStatus.CLIENT_LOGIN );
stream.readPacket();
byte[] loginResponse = null;
loop:
while ( true )
{
loginResponse = stream.readPacket();
int id = Util.getId( loginResponse );
switch ( id )
{
case 0x01:
break loop;
case 0xFA:
for ( PacketFAPluginMessage message : user.loginMessages )
{
stream.write( message );
}
stream.write( PacketCDClientStatus.CLIENT_LOGIN );
stream.readPacket();
byte[] loginResponse = stream.readPacket();
if ( Util.getId( loginResponse ) == 0xFF )
{
break;
case 0xFF:
throw new KickException( "[Kicked] " + new PacketFFKick( loginResponse ).message );
default:
throw new IllegalArgumentException( "Unknown login packet " + Util.hex( id ) );
}
}
Packet1Login login = new Packet1Login( loginResponse );