72 lines
1.8 KiB
Markdown
72 lines
1.8 KiB
Markdown
# INBTCompound.print
|
|
|
|
[← INBTCompound](index.md) · [← Master](../../wiki.md)
|
|
|
|
Parça 1/2 · [sonraki](print-2.md)
|
|
|
|
print(compound.stringify());
|
|
|
|
|
|
Returns:
|
|
Whether given NBT code was successfully was inserted.
|
|
|
|
get
|
|
|
|
|
|
|
|
java.lang.Object get(java.lang.String key)
|
|
|
|
Get the value of in this compound by given key of the raw type. Following value types are possible
|
|
(depending on whatever was found in the compound): INBTCompound, INBTList, String, Double, Long,
|
|
Float, Int, Short, Byte, or null if the value is absent by given key.
|
|
|
|
var tag = mappet.createCompound("{id:\"minecraft:diamond_hoe\",Count:1b}");
|
|
|
|
c.send(tag.get("id"));
|
|
c.send(tag.get("Count"));
|
|
|
|
|
|
Parameters:
|
|
key - the key of the value
|
|
|
|
Returns:
|
|
the value found by that key or null
|
|
|
|
equals
|
|
|
|
boolean equals(INBTCompound compound)
|
|
|
|
Check if this compound is equal to given compound (order of keys doesn't matter).
|
|
|
|
var tag1 = mappet.createCompound("{id:\"minecraft:diamond_hoe\",Count:1b}");
|
|
var tag2 = mappet.createCompound("{Count:1b,id:\"minecraft:diamond_hoe\"}");
|
|
|
|
c.send(tag1.equals(tag2));
|
|
|
|
|
|
Parameters:
|
|
compound - the compound to compare with
|
|
|
|
Returns:
|
|
whether this compound is equal to the given compound
|
|
|
|
addCompound
|
|
|
|
void addCompound(java.lang.String key)
|
|
|
|
Adds a new compound to this compound.
|
|
|
|
var tag = mappet.createCompound();
|
|
tag.addCompound("compound");
|
|
tag.get("compound").setString("x", "123")
|
|
c.send(tag) //{compound:{x:"123"}}
|
|
|
|
|
|
dumpJSON
|
|
|
|
java.lang.String dumpJSON()
|
|
|
|
Dumps to a JSON String. It first replaces the key-value colons with the proper JSON format. Then, it
|
|
creates a pattern to match the desired numeric literals and boolean values. It checks if the current
|
|
matched pattern is "0b" or "1b" and replaces them with "false" and "true" respectively. For the other
|