mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-24 03:05:49 +01:00
Strip / add velocity to SpawnEntity packets that require it when rewritten
This commit is contained in:
parent
4872075bf7
commit
0b554be10a
@ -70,7 +70,7 @@ class EntityMap_1_8 extends EntityMap
|
|||||||
int[] ids = new int[ count ];
|
int[] ids = new int[ count ];
|
||||||
for ( int i = 0; i < count; i++ )
|
for ( int i = 0; i < count; i++ )
|
||||||
{
|
{
|
||||||
ids[ i ] = DefinedPacket.readVarInt( packet );
|
ids[i] = DefinedPacket.readVarInt( packet );
|
||||||
}
|
}
|
||||||
packet.readerIndex( readerIndex + packetIdLength );
|
packet.readerIndex( readerIndex + packetIdLength );
|
||||||
packet.writerIndex( readerIndex + packetIdLength );
|
packet.writerIndex( readerIndex + packetIdLength );
|
||||||
@ -97,12 +97,24 @@ class EntityMap_1_8 extends EntityMap
|
|||||||
packet.skipBytes( 14 );
|
packet.skipBytes( 14 );
|
||||||
int position = packet.readerIndex();
|
int position = packet.readerIndex();
|
||||||
int readId = packet.readInt();
|
int readId = packet.readInt();
|
||||||
|
int changedId = readId;
|
||||||
|
|
||||||
if ( readId == oldId )
|
if ( readId == oldId )
|
||||||
{
|
{
|
||||||
packet.setInt( position, newId );
|
packet.setInt( position, changedId = newId );
|
||||||
} else if ( readId == newId )
|
} else if ( readId == newId )
|
||||||
{
|
{
|
||||||
packet.setInt( position, oldId );
|
packet.setInt( position, changedId = oldId );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( readId > 0 && changedId <= 0 )
|
||||||
|
{
|
||||||
|
packet.writerIndex( packet.writerIndex() - 3 * Short.BYTES );
|
||||||
|
} else if ( changedId > 0 && readId <= 0 )
|
||||||
|
{
|
||||||
|
packet.ensureWritable( 6 );
|
||||||
|
packet.writerIndex( packet.writerIndex() + 3 * Short.BYTES );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ( packetId == 0x0C /* Spawn Player */ )
|
} else if ( packetId == 0x0C /* Spawn Player */ )
|
||||||
|
Loading…
Reference in New Issue
Block a user