Fix read/write mismatch

This commit is contained in:
md_5 2016-11-15 08:15:32 +11:00
parent 72002ed3bd
commit 9a4150cd47

View File

@ -55,7 +55,7 @@ public class Title extends DefinedPacket
@Override @Override
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion) public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{ {
int index = readVarInt( buf ); int index = action.ordinal();
// If we're working on 1.10 or lower, increment the value of the index so we pull out the correct value. // If we're working on 1.10 or lower, increment the value of the index so we pull out the correct value.
if ( protocolVersion <= ProtocolConstants.MINECRAFT_1_10 && index <= 2 ) if ( protocolVersion <= ProtocolConstants.MINECRAFT_1_10 && index <= 2 )
@ -63,7 +63,7 @@ public class Title extends DefinedPacket
index++; index++;
} }
action = Action.values()[index]; writeVarInt( index, buf );
switch ( action ) switch ( action )
{ {
case TITLE: case TITLE: