EmptyData

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.EmptyData;

Description

Represents a marker object for data.

Note that this is not supposed to be used in scripts, and as such it cannot be obtained in any way.

Implements

EmptyData implements the following interfaces:

IData

Undocumented Interfaces

Comparable<IData>,Iterable<IData>

Operators

+(other as IData) as IData
Adds the given IData to this IData.
script.zs
// (EmptyData + (other as IData)) as IData
myEmptyData + 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
// (EmptyData & (other as IData)) as IData
myEmptyData & 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
// (EmptyData ~ (other as IData)) as IData
myEmptyData ~ myIData

Parameters:

other Type: IData - the other data to concatenate.

Return Type: IData

in(other as IData) as bool
Checks if this IData contains the other IData


For most data types, this will check equality of the data, but for map data, it will check if the other data is a string, and then check if it contains a key with that name

script.zs
// ((other as IData) in EmptyData) as bool
myIData in myEmptyData

Parameters:

other Type: IData - the other data to check

Return Type: bool

/(other as IData) as IData
Divides the given IData from this IData.
script.zs
// (EmptyData / (other as IData)) as IData
myEmptyData / myIData

Parameters:

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

Return Type: IData

==(other as IData) as bool
Checks if this IData is equal to the other IData.
script.zs
// (EmptyData == (other as IData)) as bool
myEmptyData == myIData

Parameters:

other Type: IData - The data to check equality of.

Return Type: bool

[](index as int) as IData
Gets the data at the given index.
script.zs
// EmptyData[index as int] as IData
myEmptyData[myInt]

Parameters:

index Type: int - The index to get

Return Type: IData

[](key as string) as IData
Gets the data at the given key.
script.zs
// EmptyData[key as string] as IData
myEmptyData[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
// (EmptyData % (other as IData)) as IData
myEmptyData % 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
// (EmptyData * (other as IData)) as IData
myEmptyData * myIData

Parameters:

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

Return Type: IData

- as IData
Negates this IData.
script.zs
// (-EmptyData) as IData
-myEmptyData

Return Type: IData

! as IData
Applies a NOT (!) operation to this IData.
script.zs
// (!EmptyData) as IData
!myEmptyData

Return Type: IData

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

Parameters:

other Type: IData - the other data.

Return Type: IData

[]=(index as string, value as IData)
Puts the given value inside this IData at the given index.
script.zs
// EmptyData[index as string] = (value as IData)
myEmptyData[myString] = myIData

Parameters:

index Type: string - The key to store the data at
value Type: IData - The data to store.
<<(other as IData) as IData
Applies a SHL (<<) operation to this data by the other data
script.zs
// (EmptyData << (other as IData)) as IData
myEmptyData << 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
// (EmptyData >> (other as IData)) as IData
myEmptyData >> 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
// (EmptyData - (other as IData)) as IData
-myEmptyData

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
// (EmptyData ^ (other as IData)) as IData
myEmptyData ^ 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
// EmptyData.add(other as IData) as IData;
myEmptyData.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
// EmptyData.asBool() as bool;
myEmptyData.asBool();

Return Type: bool

as bool
Casts this IData to a boolean.
script.zs
// EmptyData as bool
myEmptyData as bool

Return Type: bool

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

Returns: this data as a byte

script.zs
// EmptyData.asByte() as byte;
myEmptyData.asByte();

Return Type: byte

as byte
Casts this IData to a byte.
script.zs
// EmptyData as byte
myEmptyData as byte

Return Type: byte

asByteArray() as byte[]
Casts this IData to a byte array.

Returns: this data as a byte array

script.zs
// EmptyData.asByteArray() as byte[];
myEmptyData.asByteArray();

Return Type: byte[]

as byte[]
Casts this IData to a byte array.
script.zs
// EmptyData as byte[]
myEmptyData as byte[]

Return Type: byte[]

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

Returns: this data as a double

script.zs
// EmptyData.asDouble() as double;
myEmptyData.asDouble();

Return Type: double

as double
Casts this IData to a double.
script.zs
// EmptyData as double
myEmptyData as double

Return Type: double

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

Returns: this data as a float

script.zs
// EmptyData.asFloat() as float;
myEmptyData.asFloat();

Return Type: float

as float
Casts this IData to a float.
script.zs
// EmptyData as float
myEmptyData as float

Return Type: float

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

Returns: this data as an int

script.zs
// EmptyData.asInt() as int;
myEmptyData.asInt();

Return Type: int

as int
Casts this IData to an int.
script.zs
// EmptyData as int
myEmptyData as int

Return Type: int

asIntArray() as int[]
Casts this IData to an int array.

Returns: this data as an int array

script.zs
// EmptyData.asIntArray() as int[];
myEmptyData.asIntArray();

Return Type: int[]

as int[]
Casts this IData to an int array.
script.zs
// EmptyData as int[]
myEmptyData as int[]

Return Type: int[]

asList() as List<IData>
Casts this IData to a list.

Returns: this data as a list

script.zs
// EmptyData.asList() as List<IData>;
myEmptyData.asList();

Return Type: List<IData>

as List<IData>
Casts this IData to a list.
script.zs
// EmptyData as List<IData>
myEmptyData as List<IData>

Return Type: List<IData>

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

Returns: this data as a long

script.zs
// EmptyData.asLong() as long;
myEmptyData.asLong();

Return Type: long

as long
Casts this IData to a long.
script.zs
// EmptyData as long
myEmptyData as long

Return Type: long

asLongArray() as long[]
Casts this IData to a long array.

Returns: this data as a long array

script.zs
// EmptyData.asLongArray() as long[];
myEmptyData.asLongArray();

Return Type: long[]

as long[]
Casts this IData to a long array.
script.zs
// EmptyData as long[]
myEmptyData as long[]

Return Type: long[]

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

Returns: this data as a map

script.zs
// EmptyData.asMap() as IData[string];
myEmptyData.asMap();

Return Type: IData[string]

as IData[string]
Casts this IData to a map.
script.zs
// EmptyData as IData[string]
myEmptyData as IData[string]

Return Type: IData[string]

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

Returns: this data as a short

script.zs
// EmptyData.asShort() as short;
myEmptyData.asShort();

Return Type: short

as short
Casts this IData to a short.
script.zs
// EmptyData as short
myEmptyData 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
// EmptyData.asString() as string;
myEmptyData.asString();

Return Type: string

compareTo(other as IData) as int
Compares this IData to the other IData

Returns: The comparison result.

script.zs
// EmptyData.compareTo(other as IData) as int;
myEmptyData.compareTo(5);

Parameters:

other Type: IData - the data to be compared.

Return Type: int

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
// EmptyData.getAsString() as string;
myEmptyData.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
// EmptyData as string
myEmptyData as string

Return Type: string

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

Returns: the intenral ID of this data.

script.zs
// EmptyData.getId() as byte;
myEmptyData.getId();

Return Type: byte

Getter
Checks if this data is empty.
script.zs
// EmptyData.isEmpty as bool
myEmptyData.isEmpty

Return Type: bool

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

Returns: True if empty.

script.zs
// EmptyData.isEmpty() as bool;
myEmptyData.isEmpty();

Return Type: bool

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

Return Type: Set<string>

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

Returns: The keys of this IData.

script.zs
// EmptyData.keys() as Set<string>;
myEmptyData.keys();

Return Type: Set<string>

Getter
Gets the length of this IData.
script.zs
// EmptyData.length as int
myEmptyData.length

Return Type: int

length() as int
Gets the length of this IData.

Returns: The length of this IData.

script.zs
// EmptyData.length() as int;
myEmptyData.length();

Return Type: int

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
// EmptyData.listOf(members as IData[]) as IData;
EmptyData.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
// EmptyData.map(operation as function(r as IData) as IData) as IData;
myEmptyData.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
// EmptyData.merge(other as IData) as IData;
myEmptyData.merge(myIData);

Parameters:

other Type: IData - the data to merge

Return Type: IData

put(index as string, value as IData)
Puts the given value inside this IData at the given index.
script.zs
// EmptyData.put(index as string, value as IData);
myEmptyData.put("key", "value");

Parameters:

index Type: string - The key to store the data at
value Type: IData - The data to store.
remove(index as int)
Removes the stored data at the given index.
script.zs
// EmptyData.remove(index as int);
myEmptyData.remove(0);

Parameters:

index Type: int - The index to remove.
remove(key as string)
Removes the stored data at the given key.
script.zs
// EmptyData.remove(key as string);
myEmptyData.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
// EmptyData.setAt(name as string, data as IData);
myEmptyData.setAt(myString, myIData);

Parameters:

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