ByteArrayData

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

script.zs
import crafttweaker.api.data.ByteArrayData;

Description

Implements

ByteArrayData implements the following interfaces:

IData

Undocumented Interfaces

Comparable<IData>,Iterable<IData>

Constructors

new(internal as byte[])
script.zs
// new ByteArrayData(internal as byte[]);
new ByteArrayData(myByte[]);

Parameters:

internal Type: byte[]

Operators

+(other as IData) as IData
Adds the given IData to this IData.
script.zs
// (ByteArrayData + (other as IData)) as IData
myByteArrayData + myIData

Parameters:

other Type: IData - the other data to add.

Return Type: IData

&(other as IData) as IData
Applies a bitwise AND (&) operation to this IData and the other IData
script.zs
// (ByteArrayData & (other as IData)) as IData
myByteArrayData & myIData

Parameters:

other Type: IData - the other data.

Return Type: IData

~(other as IData) as IData
Concatenates the given IData to this IData.
script.zs
// (ByteArrayData ~ (other as IData)) as IData
myByteArrayData ~ myIData

Parameters:

other Type: IData - the other data to concatenate.

Return Type: IData

/(other as IData) as IData
Divides the given IData from this IData.
script.zs
// (ByteArrayData / (other as IData)) as IData
myByteArrayData / myIData

Parameters:

other Type: IData - the other data to divide by.

Return Type: IData

[](key as string) as IData
Gets the data at the given key.
script.zs
// ByteArrayData[key as string] as IData
myByteArrayData[myString]

Parameters:

key Type: string - The key to get

Return Type: IData

%(other as IData) as IData
Applies a modulo operation to this IData against the other IData.
script.zs
// (ByteArrayData % (other as IData)) as IData
myByteArrayData % myIData

Parameters:

other Type: IData - the other data to modulo by.

Return Type: IData

*(other as IData) as IData
Multiplies the given IData to this IData.
script.zs
// (ByteArrayData * (other as IData)) as IData
myByteArrayData * myIData

Parameters:

other Type: IData - the other data to multiply by.

Return Type: IData

- as IData
Negates this IData.
script.zs
// (-ByteArrayData) as IData
-myByteArrayData

Return Type: IData

! as IData
Applies a NOT (!) operation to this IData.
script.zs
// (!ByteArrayData) as IData
!myByteArrayData

Return Type: IData

|(other as IData) as IData
Applies a bitwise OR (|) operation to this IData and the other IData
script.zs
// (ByteArrayData | (other as IData)) as IData
myByteArrayData | myIData

Parameters:

other Type: IData - the other data.

Return Type: IData

<<(other as IData) as IData
Applies a SHL (<<) operation to this data by the other data
script.zs
// (ByteArrayData << (other as IData)) as IData
myByteArrayData << myIData

Parameters:

other Type: IData - The data to SHL by.

Return Type: IData

>>(other as IData) as IData
Applies a SHR (>>) operation to this data by the other data
script.zs
// (ByteArrayData >> (other as IData)) as IData
myByteArrayData >> myIData

Parameters:

other Type: IData - The data to SHR by.

Return Type: IData

-(other as IData) as IData
Subtracts the given IData from this IData.
script.zs
// (ByteArrayData - (other as IData)) as IData
-myByteArrayData

Parameters:

other Type: IData - the other data to remove.

Return Type: IData

^(other as IData) as IData
Applies a bitwise XOR (^) operation to this IData and the other IData
script.zs
// (ByteArrayData ^ (other as IData)) as IData
myByteArrayData ^ myIData

Parameters:

other Type: IData - the other data.

Return Type: IData

Members

add(other as IData) as IData
Adds the given IData to this IData.

Returns: A new IData after adding the other data.

script.zs
// ByteArrayData.add(other as IData) as IData;
myByteArrayData.add(2);

Parameters:

other Type: IData - the other data to add.

Return Type: IData

asBool() as bool
Casts this IData to a boolean.

Returns: this data as a bool

script.zs
// ByteArrayData.asBool() as bool;
myByteArrayData.asBool();

Return Type: bool

as bool
Casts this IData to a boolean.
script.zs
// ByteArrayData as bool
myByteArrayData as bool

Return Type: bool

asByte() as byte
Casts this IData to a byte.

Returns: this data as a byte

script.zs
// ByteArrayData.asByte() as byte;
myByteArrayData.asByte();

Return Type: byte

as byte
Casts this IData to a byte.
script.zs
// ByteArrayData as byte
myByteArrayData as byte

Return Type: byte

asDouble() as double
Casts this IData to a double.

Returns: this data as a double

script.zs
// ByteArrayData.asDouble() as double;
myByteArrayData.asDouble();

Return Type: double

as double
Casts this IData to a double.
script.zs
// ByteArrayData as double
myByteArrayData as double

Return Type: double

asFloat() as float
Casts this IData to a float.

Returns: this data as a float

script.zs
// ByteArrayData.asFloat() as float;
myByteArrayData.asFloat();

Return Type: float

as float
Casts this IData to a float.
script.zs
// ByteArrayData as float
myByteArrayData as float

Return Type: float

asInt() as int
Casts this IData to an int.

Returns: this data as an int

script.zs
// ByteArrayData.asInt() as int;
myByteArrayData.asInt();

Return Type: int

as int
Casts this IData to an int.
script.zs
// ByteArrayData as int
myByteArrayData as int

Return Type: int

asLong() as long
Casts this IData to a long.

Returns: this data as a long

script.zs
// ByteArrayData.asLong() as long;
myByteArrayData.asLong();

Return Type: long

as long
Casts this IData to a long.
script.zs
// ByteArrayData as long
myByteArrayData as long

Return Type: long

asMap() as IData[string]
Casts this IData to a map.

Returns: this data as a map

script.zs
// ByteArrayData.asMap() as IData[string];
myByteArrayData.asMap();

Return Type: IData[string]

as IData[string]
Casts this IData to a map.
script.zs
// ByteArrayData as IData[string]
myByteArrayData as IData[string]

Return Type: IData[string]

asShort() as short
Casts this IData to a short.

Returns: this data as a short

script.zs
// ByteArrayData.asShort() as short;
myByteArrayData.asShort();

Return Type: short

as short
Casts this IData to a short.
script.zs
// ByteArrayData as short
myByteArrayData as short

Return Type: short

asString() as string
Gets an escaped string version of this IData, quotes are included in the output

E.G println(("hello" as IData).asString()) prints "hello"

Returns: The escaped string version of this IData.

script.zs
// ByteArrayData.asString() as string;
myByteArrayData.asString();

Return Type: string

getAsString() as string
Gets the literal string version of this IData.

E.G println(("hello" as IData).getAsString()) prints hello

Returns: The literal string version of this IData.

script.zs
// ByteArrayData.getAsString() as string;
myByteArrayData.getAsString();

Return Type: string

as string
Gets the literal string version of this IData.

E.G println(("hello" as IData).getAsString()) prints hello

script.zs
// ByteArrayData as string
myByteArrayData as string

Return Type: string

getId() as byte
Gets the internal ID of this data.

Returns: the intenral ID of this data.

script.zs
// ByteArrayData.getId() as byte;
myByteArrayData.getId();

Return Type: byte

Getter
Checks if this data is empty.
script.zs
// ByteArrayData.isEmpty as bool
myByteArrayData.isEmpty

Return Type: bool

isEmpty() as bool
Checks if this data is empty.

Returns: True if empty.

script.zs
// ByteArrayData.isEmpty() as bool;
myByteArrayData.isEmpty();

Return Type: bool

Getter
Gets the keys of this IData
script.zs
// ByteArrayData.keys as Set<string>
myByteArrayData.keys

Return Type: Set<string>

keys() as Set<string>
Gets the keys of this IData

Returns: The keys of this IData.

script.zs
// ByteArrayData.keys() as Set<string>;
myByteArrayData.keys();

Return Type: Set<string>

static listOf(members as IData[]) as IData
Creates a collection of the given IData members.


This attempts to give the most accurate type for the given members, for example, if all the members are bytes, then it returns a ByteArrayData.
However if the types are mixed or do not have a *ArrayData version, then a ListData is returned.

Returns: A list of the given members.

script.zs
// ByteArrayData.listOf(members as IData[]) as IData;
ByteArrayData.listOf(1, 2, 3);

Parameters:

members Type: IData[] - The members to put in the list.

Return Type: IData

map(operation as function(r as IData) as IData) as IData
Maps this IData to another IData based on the given operation.

Returns: A new IData from the operation

script.zs
// ByteArrayData.map(operation as function(r as IData) as IData) as IData;
myByteArrayData.map((data) => 3);

Parameters:

operation Type: function(r as IData) as IData - The operation to apply to this IData

Return Type: IData

merge(other as IData) as IData
Merges the given data with this data.

Returns: the result of merging the datas.

script.zs
// ByteArrayData.merge(other as IData) as IData;
myByteArrayData.merge(myIData);

Parameters:

other Type: IData - the data to merge

Return Type: IData

remove(key as string)
Removes the stored data at the given key.
script.zs
// ByteArrayData.remove(key as string);
myByteArrayData.remove("key");

Parameters:

key Type: string - The key to remove.
setAt(name as string, data as IData)
Sets the given value inside this IData at the given index.
script.zs
// ByteArrayData.setAt(name as string, data as IData);
myByteArrayData.setAt(myString, myIData);

Parameters:

name Type: string - The key to store the data at
data Type: IData - The data to store.