#2482: Fix error in reading slots

This commit is contained in:
md_5 2018-07-23 12:07:30 +10:00
parent 176b75b97e
commit a710698277

View File

@ -157,7 +157,7 @@ public abstract class EntityMap
packet.skipBytes( 16 ); // float, float, float, flat packet.skipBytes( 16 ); // float, float, float, flat
break; break;
case 27: // item case 27: // item
readSkipSlot( packet ); readSkipSlot( packet, protocolVersion );
break; break;
} }
break; break;
@ -192,7 +192,7 @@ public abstract class EntityMap
DefinedPacket.readString( packet ); DefinedPacket.readString( packet );
break; break;
case 5: case 5:
readSkipSlot( packet ); readSkipSlot( packet, protocolVersion );
break; break;
case 6: case 6:
packet.skipBytes( 1 ); // boolean packet.skipBytes( 1 ); // boolean
@ -238,11 +238,11 @@ public abstract class EntityMap
packet.readerIndex( readerIndex ); packet.readerIndex( readerIndex );
} }
private static void readSkipSlot(ByteBuf packet) private static void readSkipSlot(ByteBuf packet, int protocolVersion)
{ {
if ( packet.readShort() != -1 ) if ( packet.readShort() != -1 )
{ {
packet.skipBytes( 3 ); // byte, short packet.skipBytes( ( protocolVersion >= ProtocolConstants.MINECRAFT_1_13 ) ? 1 : 3 ); // byte vs byte, short
int position = packet.readerIndex(); int position = packet.readerIndex();
if ( packet.readByte() != 0 ) if ( packet.readByte() != 0 )