NBTCompound
A map-like structure for storing NBT tags associated with unique UTF-8 (modified) names.
Nesting
If a compound is inside another compound, the inner one is considered to be "nested", and the outer one is its "parent". To access the nested compound's contents, you would first need to get it from its parent, check that it is not null, and then repeat for any further nested compounds. To avoid this, the implementation allows you to use dot-notation in these cases. More specifically, dot-notation is valid in methods that cannot alter the structure of the compound (and those that accept a tag name), like getter and contains methods.Consider the following NBT data:
{
user: {
name: "User291",
id: "ae630aa9-cdbb-4aaf-be42-868889585b4d",
coins: 19531L,
social_media: {
discord: "Player291#4444",
twitter: "User291",
"i_have_a_dot_._in_me": true
},
}
}
Content copied to clipboard
"user.social_media.discord"
Content copied to clipboard
"user.id"
Content copied to clipboard
"user"
Content copied to clipboard
.
) in it that does not indicate nesting, a backslash can be used to escape the character. This means using a double-backslash in string literals, such as "user.social_media.i_have_a_dot_\\._in_me"
Content copied to clipboard
In any case, dot-notation is not required, and a compound's direct children can still be accessed normally using their respective names.
Author
Nullicorn
Constructors
Functions
Link copied to clipboard
Link copied to clipboard
public V computeIfPresent(K key, BiFunction<? extends Object, ? extends Object, ? extends V> remappingFunction)
Content copied to clipboard
Link copied to clipboard
Same as containsTag(...), but
true
will be returned if any tag in the compound uses the key
, regardless of the tag's type.Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
public void forEach(BiConsumer<? extends Object, ? extends Object> action)
Content copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
public void replaceAll(BiFunction<? extends Object, ? extends Object, ? extends V> function)
Content copied to clipboard
Link copied to clipboard