Class NbtAccounter
java.lang.Object
net.minecraft.nbt.NbtAccounter
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intprivate intprivate static final intprivate final intprivate final longstatic final intprivate long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccountBytes(long size) voidaccountBytes(long bytesPerEntry, long count) static NbtAccountercreate(long quota) static NbtAccounterintgetDepth()longgetUsage()voidpopDepth()voidNeo: UTF8 is not a simple encoding system, each character can be either 1, 2, or 3 bytes depending on where its numerical value falls.static NbtAccounterstatic NbtAccounter
-
Field Details
-
DEFAULT_NBT_QUOTA
public static final int DEFAULT_NBT_QUOTA- See Also:
-
UNCOMPRESSED_NBT_QUOTA
public static final int UNCOMPRESSED_NBT_QUOTA- See Also:
-
MAX_STACK_DEPTH
private static final int MAX_STACK_DEPTH- See Also:
-
quota
private final long quota -
usage
private long usage -
maxDepth
private final int maxDepth -
depth
private int depth
-
-
Constructor Details
-
NbtAccounter
public NbtAccounter(long quota, int maxDepth)
-
-
Method Details
-
create
-
defaultQuota
-
uncompressedQuota
-
unlimitedHeap
-
accountBytes
public void accountBytes(long bytesPerEntry, long count) -
accountBytes
public void accountBytes(long size) -
pushDepth
public void pushDepth() -
popDepth
public void popDepth() -
readUTF
Neo: UTF8 is not a simple encoding system, each character can be either 1, 2, or 3 bytes depending on where its numerical value falls. We have to count up each character individually to see the true length of the data.
Basic concept is that it uses the MSB of each byte as a 'read more' signal. So it has to shift each 7-bit segment.
This will accurately count the correct byte length to encode this string, plus the 2 bytes for its length prefix.
-
getUsage
public long getUsage() -
getDepth
public int getDepth()
-