amulet_nbt.IntArrayTag class

class amulet_nbt.IntArrayTag[source]

Bases: AbstractBaseArrayTag

This class behaves like an 1D Numpy signed integer array with each value stored in a int.

__init__(*args, **kwargs)[source]
copy()[source]

Return a shallow copy of the class

np_array[source]

A numpy array holding the same internal data. Changes to the array will also modify the internal state.

py_data[source]

A python representation of the class. Note that the return type is undefined and may change in the future. You would be better off using the py_{type} or np_array properties if you require a fixed type. This is here for convenience to get a python representation under the same property name.

save_to(filepath_or_buffer=None, *, compressed=True, little_endian=False, string_encoder=<built-in function encode_modified_utf8>, name='')[source]

Convert the data to the binary NBT format. Optionally write to a file.

If filepath_or_buffer is a valid file path in string form the data will be written to that file.

If filepath_or_buffer is a file like object the bytes will be written to it using .write method.

Parameters:
  • filepath_or_buffer – A path or writeable object to write the data to.

  • compressed – Should the bytes be compressed with gzip.

  • little_endian – Should the bytes be saved in little endian format.

  • string_encoder (Callable[[str], bytes]) – A function to encode strings to bytes.

  • name – The root tag name.

Return type:

bytes

Returns:

The binary NBT representation of the class.

tag_id = 11[source]
to_nbt(*, compressed=True, little_endian=False, string_encoder=<built-in function encode_modified_utf8>, name='')[source]

Get the data in binary NBT format.

Parameters:
  • compressed – Should the bytes be compressed with gzip.

  • little_endian – Should the bytes be saved in little endian format.

  • string_encoder (Callable[[str], bytes]) – A function to encode strings to bytes.

  • name – The root tag name.

Returns:

The binary NBT representation of the class.

to_snbt(indent=None, indent_chr=None)[source]

Return the NBT data in Stringified NBT format.

Parameters:
  • indent – int, str or None. If int will indent with this many spaces. If string will indent with this string. If None will return on one line.

  • indent_chr – Depreciated. Use indent instead.

Returns:

Stringified NBT representation of the data.

value[source]

Legacy property to access the python data. Depreciated. Use py_data or typed py_{type} instead.