Search in sources :

Example 1 with ByteTag

use of net.glowstone.util.nbt.ByteTag in project Glowstone by GlowstoneMC.

the class Mojangson method fromTag.

/**
 * Creates a Mojangson string from the given ByteArray Tag.
 *
 * @param tag the ByteArray Tag to convert
 * @return the converted Mojangson string
 */
public static String fromTag(ByteArrayTag tag) {
    StringBuilder builder = new StringBuilder();
    builder.append(ARRAY_START);
    boolean start = true;
    for (byte value : tag.getValue()) {
        ByteTag b = new ByteTag(value);
        if (start) {
            start = false;
        } else {
            builder.append(ELEMENT_SEPERATOR);
        }
        builder.append(fromTag(b));
    }
    builder.append(ARRAY_END);
    return builder.toString();
}
Also used : ByteTag(net.glowstone.util.nbt.ByteTag)

Aggregations

ByteTag (net.glowstone.util.nbt.ByteTag)1