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_OVERRIDES
Contains the names of tags which should appear before any other tag in a compound, even when they would otherwise appear later lexicographically.private static String
ENTRY_SEPARATOR
private static Set<String>
IGNORED_PATHS
Contains paths for which the indentation prefix should not be prepended to the result.private int
indentationLevel
private static String
KEY_VALUE_SEPARATOR
private List<String>
pathParts
private String
prefix
private String
result
private static Pattern
SIMPLE_NAME
-
Constructor Summary
Constructors Constructor Description NbtOrderedStringFormatter()
NbtOrderedStringFormatter(String prefix, int indentationLevel, List<String> pathParts)
-
Method Summary
Modifier and Type Method Description String
apply(Tag tag)
protected static String
escapeName(String name)
protected List<String>
getSortedNames(CompoundTag tag)
String
joinPath()
private void
popPathPart()
private void
pushPathPart(String part)
void
visitByteArrayTag(ByteArrayTag tag)
void
visitByteTag(ByteTag tag)
void
visitCompoundTag(CompoundTag tag)
void
visitDoubleTag(DoubleTag tag)
void
visitEndTag(EndTag tag)
void
visitFloatTag(FloatTag tag)
void
visitIntArrayTag(IntArrayTag tag)
void
visitIntTag(IntTag tag)
void
visitListTag(ListTag tag)
void
visitLongArrayTag(LongArrayTag tag)
void
visitLongTag(LongTag tag)
void
visitShortTag(ShortTag tag)
void
visitStringTag(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:
visitStringTag
in interfaceNbtTagVisitor
-
visitByteTag
- Specified by:
visitByteTag
in interfaceNbtTagVisitor
-
visitShortTag
- Specified by:
visitShortTag
in interfaceNbtTagVisitor
-
visitIntTag
- Specified by:
visitIntTag
in interfaceNbtTagVisitor
-
visitLongTag
- Specified by:
visitLongTag
in interfaceNbtTagVisitor
-
visitFloatTag
- Specified by:
visitFloatTag
in interfaceNbtTagVisitor
-
visitDoubleTag
- Specified by:
visitDoubleTag
in interfaceNbtTagVisitor
-
visitByteArrayTag
- Specified by:
visitByteArrayTag
in interfaceNbtTagVisitor
-
visitIntArrayTag
- Specified by:
visitIntArrayTag
in interfaceNbtTagVisitor
-
visitLongArrayTag
- Specified by:
visitLongArrayTag
in interfaceNbtTagVisitor
-
visitListTag
- Specified by:
visitListTag
in interfaceNbtTagVisitor
-
visitCompoundTag
- Specified by:
visitCompoundTag
in interfaceNbtTagVisitor
-
popPathPart
private void popPathPart() -
pushPathPart
-
getSortedNames
-
joinPath
-
escapeName
-
visitEndTag
- Specified by:
visitEndTag
in interfaceNbtTagVisitor
-