[#1714] Make a copy of the main Minecraft buffer as EntityMap.rewriteVarInt may require more bytes than available.
This commit is contained in:
parent
052131c1fa
commit
841c81cdc4
@ -21,7 +21,7 @@ public class MinecraftDecoder extends MessageToMessageDecoder<ByteBuf>
|
|||||||
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception
|
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception
|
||||||
{
|
{
|
||||||
Protocol.DirectionData prot = ( server ) ? protocol.TO_SERVER : protocol.TO_CLIENT;
|
Protocol.DirectionData prot = ( server ) ? protocol.TO_SERVER : protocol.TO_CLIENT;
|
||||||
ByteBuf slice = in.slice().retain();
|
ByteBuf slice = in.copy(); // Can't slice this one due to EntityMap :(
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -88,7 +88,7 @@ public abstract class EntityMap
|
|||||||
int readIdLength = packet.readerIndex() - offset;
|
int readIdLength = packet.readerIndex() - offset;
|
||||||
if ( readId == oldId || readId == newId )
|
if ( readId == oldId || readId == newId )
|
||||||
{
|
{
|
||||||
ByteBuf data = packet.slice().copy();
|
ByteBuf data = packet.copy();
|
||||||
packet.readerIndex( offset );
|
packet.readerIndex( offset );
|
||||||
packet.writerIndex( offset );
|
packet.writerIndex( offset );
|
||||||
DefinedPacket.writeVarInt( readId == oldId ? newId : oldId, packet );
|
DefinedPacket.writeVarInt( readId == oldId ? newId : oldId, packet );
|
||||||
|
@ -37,7 +37,7 @@ class EntityMap_1_7_6 extends EntityMap_1_7_2
|
|||||||
if ( profile != null && profile.getProperties() != null
|
if ( profile != null && profile.getProperties() != null
|
||||||
&& profile.getProperties().length >= 1 )
|
&& profile.getProperties().length >= 1 )
|
||||||
{
|
{
|
||||||
ByteBuf rest = packet.slice().copy();
|
ByteBuf rest = packet.copy();
|
||||||
packet.readerIndex( readerIndex );
|
packet.readerIndex( readerIndex );
|
||||||
packet.writerIndex( readerIndex + packetIdLength + idLength );
|
packet.writerIndex( readerIndex + packetIdLength + idLength );
|
||||||
DefinedPacket.writeString( player.getUniqueId().toString(), packet );
|
DefinedPacket.writeString( player.getUniqueId().toString(), packet );
|
||||||
|
Loading…
Reference in New Issue
Block a user