#3845: Add method to read tag with custom limiter
This commit is contained in:
parent
5709a65785
commit
dd1531e28d
@ -453,6 +453,11 @@ public abstract class DefinedPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Tag readTag(ByteBuf input, int protocolVersion)
|
public static Tag readTag(ByteBuf input, int protocolVersion)
|
||||||
|
{
|
||||||
|
return readTag( input, protocolVersion, new NBTLimiter( 1 << 21 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Tag readTag(ByteBuf input, int protocolVersion, NBTLimiter limiter)
|
||||||
{
|
{
|
||||||
DataInputStream in = new DataInputStream( new ByteBufInputStream( input ) );
|
DataInputStream in = new DataInputStream( new ByteBufInputStream( input ) );
|
||||||
try
|
try
|
||||||
@ -465,11 +470,11 @@ public abstract class DefinedPacket
|
|||||||
return EndTag.INSTANCE;
|
return EndTag.INSTANCE;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
return Tag.readById( type, in, new NBTLimiter( 1 << 21 ) );
|
return Tag.readById( type, in, limiter );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NamedTag namedTag = new NamedTag();
|
NamedTag namedTag = new NamedTag();
|
||||||
namedTag.read( in, new NBTLimiter( 1 << 21 ) );
|
namedTag.read( in, limiter );
|
||||||
return namedTag;
|
return namedTag;
|
||||||
} catch ( IOException ex )
|
} catch ( IOException ex )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user