Home Commands Examples Getting Started With Scripts Global Keywords
BracketDumpers BracketHandlers BracketValidators ResourceLocationBracketHandler

LongData

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

Description

Implements

LongData implements the following interfaces:

IData

Undocumented Interfaces

Comparable<IData>,Iterable<IData>

Constructors

new(internal as long)
script.zs
// new LongData(internal as long);
new LongData(myLong);

Parameters:

internal Type: long

Operators

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

Parameters:

other Type: IData - the other data to concatenate.

Return Type: IData

[](index as int) as IData
Gets the data at the given index.
script.zs
// LongData[index as int] as IData
myLongData[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
// LongData[key as string] as IData
myLongData[myString]

Parameters:

key Type: string - The key to get

Return Type: IData

! as IData
Applies a NOT (!) operation to this IData.
script.zs
// (!LongData) as IData
!myLongData

Return Type: IData

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

Parameters:

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

Members

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

Returns: this data as a byte array

script.zs
// LongData.asByteArray() as byte[];
myLongData.asByteArray();

Return Type: byte[]

as byte[]
Casts this IData to a byte array.
script.zs
// LongData as byte[]
myLongData as byte[]

Return Type: byte[]

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

Returns: this data as an int array

script.zs
// LongData.asIntArray() as int[];
myLongData.asIntArray();

Return Type: int[]

as int[]
Casts this IData to an int array.
script.zs
// LongData as int[]
myLongData as int[]

Return Type: int[]

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

Returns: this data as a list

script.zs
// LongData.asList() as List<IData>;
myLongData.asList();

Return Type: List<IData>

as List<IData>
Casts this IData to a list.
script.zs
// LongData as List<IData>
myLongData as List<IData>

Return Type: List<IData>

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

Returns: this data as a long array

script.zs
// LongData.asLongArray() as long[];
myLongData.asLongArray();

Return Type: long[]

as long[]
Casts this IData to a long array.
script.zs
// LongData as long[]
myLongData as long[]

Return Type: long[]

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

Returns: this data as a map

script.zs
// LongData.asMap() as IData[string];
myLongData.asMap();

Return Type: IData[string]

as IData[string]
Casts this IData to a map.
script.zs
// LongData as IData[string]
myLongData as IData[string]

Return Type: IData[string]

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
// LongData.asString() as string;
myLongData.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
// LongData.getAsString() as string;
myLongData.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
// LongData as string
myLongData as string

Return Type: string

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

Returns: the intenral ID of this data.

script.zs
// LongData.getId() as byte;
myLongData.getId();

Return Type: byte

Getter
Checks if this data is empty.
script.zs
// LongData.isEmpty as bool
myLongData.isEmpty

Return Type: bool

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

Returns: True if empty.

script.zs
// LongData.isEmpty() as bool;
myLongData.isEmpty();

Return Type: bool

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

Return Type: Set<string>

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

Returns: The keys of this IData.

script.zs
// LongData.keys() as Set<string>;
myLongData.keys();

Return Type: Set<string>

Getter
Gets the length of this IData.
script.zs
// LongData.length as int
myLongData.length

Return Type: int

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

Returns: The length of this IData.

script.zs
// LongData.length() as int;
myLongData.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
// LongData.listOf(members as IData[]) as IData;
LongData.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
// LongData.map(operation as function(r as IData) as IData) as IData;
myLongData.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
// LongData.merge(other as IData) as IData;
myLongData.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
// LongData.put(index as string, value as IData);
myLongData.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
// LongData.remove(index as int);
myLongData.remove(0);

Parameters:

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

Parameters:

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