Package net.minecraft.nbt.visitor
Class NbtOrderedStringFormatter
java.lang.Object
net.minecraft.nbt.visitor.NbtOrderedStringFormatter
- All Implemented Interfaces:
NbtTagVisitor
public class NbtOrderedStringFormatter extends Object implements NbtTagVisitor
Formats an NBT tag as a multiline string where named tags inside of compounds are sorted
according to a defined ordering.
-
Field Summary
Fields Modifier and Type Field Description private static Map<String,List<String>>ENTRY_ORDER_OVERRIDESContains the names of tags which should appear before any other tag in a compound, even when they would otherwise appear later lexicographically.private static StringENTRY_SEPARATORprivate static Set<String>IGNORED_PATHSContains paths for which the indentation prefix should not be prepended to the result.private intindentationLevelprivate static StringKEY_VALUE_SEPARATORprivate List<String>pathPartsprivate Stringprefixprivate Stringresultprivate static PatternSIMPLE_NAME -
Constructor Summary
Constructors Constructor Description NbtOrderedStringFormatter()NbtOrderedStringFormatter(String prefix, int indentationLevel, List<String> pathParts) -
Method Summary
Modifier and Type Method Description Stringapply(Tag tag)protected static StringescapeName(String name)protected List<String>getSortedNames(CompoundTag tag)StringjoinPath()private voidpopPathPart()private voidpushPathPart(String part)voidvisitByteArrayTag(ByteArrayTag tag)voidvisitByteTag(ByteTag tag)voidvisitCompoundTag(CompoundTag tag)voidvisitDoubleTag(DoubleTag tag)voidvisitEndTag(EndTag tag)voidvisitFloatTag(FloatTag tag)voidvisitIntArrayTag(IntArrayTag tag)voidvisitIntTag(IntTag tag)voidvisitListTag(ListTag tag)voidvisitLongArrayTag(LongArrayTag tag)voidvisitLongTag(LongTag tag)voidvisitShortTag(ShortTag tag)voidvisitStringTag(StringTag tag)
-
Field Details
-
ENTRY_ORDER_OVERRIDES
Contains the names of tags which should appear before any other tag in a compound, even when they would otherwise appear later lexicographically. The list of tags which should be prioritized differs depending on the path of the compound. -
IGNORED_PATHS
Contains paths for which the indentation prefix should not be prepended to the result. -
SIMPLE_NAME
-
KEY_VALUE_SEPARATOR
-
ENTRY_SEPARATOR
-
prefix
-
indentationLevel
private final int indentationLevel -
pathParts
-
result
-
-
Constructor Details
-
NbtOrderedStringFormatter
public NbtOrderedStringFormatter() -
NbtOrderedStringFormatter
-
-
Method Details
-
apply
-
visitStringTag
- Specified by:
visitStringTagin interfaceNbtTagVisitor
-
visitByteTag
- Specified by:
visitByteTagin interfaceNbtTagVisitor
-
visitShortTag
- Specified by:
visitShortTagin interfaceNbtTagVisitor
-
visitIntTag
- Specified by:
visitIntTagin interfaceNbtTagVisitor
-
visitLongTag
- Specified by:
visitLongTagin interfaceNbtTagVisitor
-
visitFloatTag
- Specified by:
visitFloatTagin interfaceNbtTagVisitor
-
visitDoubleTag
- Specified by:
visitDoubleTagin interfaceNbtTagVisitor
-
visitByteArrayTag
- Specified by:
visitByteArrayTagin interfaceNbtTagVisitor
-
visitIntArrayTag
- Specified by:
visitIntArrayTagin interfaceNbtTagVisitor
-
visitLongArrayTag
- Specified by:
visitLongArrayTagin interfaceNbtTagVisitor
-
visitListTag
- Specified by:
visitListTagin interfaceNbtTagVisitor
-
visitCompoundTag
- Specified by:
visitCompoundTagin interfaceNbtTagVisitor
-
popPathPart
private void popPathPart() -
pushPathPart
-
getSortedNames
-
joinPath
-
escapeName
-
visitEndTag
- Specified by:
visitEndTagin interfaceNbtTagVisitor
-