Tidy up the handling of Spawn Object and fix a off by one error with it
This commit is contained in:
parent
74f5ffd08b
commit
d1d4cc7bbf
@ -61,21 +61,21 @@ class EntityMap_1_7_2 extends EntityMap
|
|||||||
} else if ( packetId == 0x0E /* Spawn Object */ )
|
} else if ( packetId == 0x0E /* Spawn Object */ )
|
||||||
{
|
{
|
||||||
DefinedPacket.readVarInt( packet );
|
DefinedPacket.readVarInt( packet );
|
||||||
int idLength = packet.readerIndex() - readerIndex - packetIdLength;
|
int type = packet.readUnsignedByte();
|
||||||
|
|
||||||
int type = packet.getByte( packetIdLength + idLength );
|
|
||||||
|
|
||||||
if ( type == 60 || type == 90 )
|
if ( type == 60 || type == 90 )
|
||||||
{
|
{
|
||||||
int readId = packet.getInt( packetIdLength + idLength + 15 );
|
packet.skipBytes( 14 );
|
||||||
|
int position = packet.readerIndex();
|
||||||
|
int readId = packet.readInt();
|
||||||
int changedId = -1;
|
int changedId = -1;
|
||||||
if ( readId == oldId )
|
if ( readId == oldId )
|
||||||
{
|
{
|
||||||
packet.setInt( packetIdLength + idLength + 15, newId );
|
packet.setInt( position, newId );
|
||||||
changedId = newId;
|
changedId = newId;
|
||||||
} else if ( readId == newId )
|
} else if ( readId == newId )
|
||||||
{
|
{
|
||||||
packet.setInt( packetIdLength + idLength + 15, oldId );
|
packet.setInt( position, oldId );
|
||||||
changedId = oldId;
|
changedId = oldId;
|
||||||
}
|
}
|
||||||
if ( changedId != -1 )
|
if ( changedId != -1 )
|
||||||
|
Loading…
Reference in New Issue
Block a user