ListData
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.
import crafttweaker.api.data.ListData;
Description
Implements
ListData
implements the following interfaces:
Constructors
// new ListData();new ListData();
Operators
Members
Returns: this data as a bool
// ListData.asBool() as bool;(["Hello", "World", "!"] as IData).asBool();
Return Type:
bool
// ListData as bool(["Hello", "World", "!"] as IData) as bool
Return Type:
bool
Returns: this data as a byte
// ListData.asByte() as byte;(["Hello", "World", "!"] as IData).asByte();
Return Type:
byte
// ListData as byte(["Hello", "World", "!"] as IData) as byte
Return Type:
byte
Returns: this data as a double
// ListData.asDouble() as double;(["Hello", "World", "!"] as IData).asDouble();
Return Type:
double
// ListData as double(["Hello", "World", "!"] as IData) as double
Return Type:
double
Returns: this data as a float
// ListData.asFloat() as float;(["Hello", "World", "!"] as IData).asFloat();
Return Type:
float
// ListData as float(["Hello", "World", "!"] as IData) as float
Return Type:
float
Returns: this data as an int
// ListData.asInt() as int;(["Hello", "World", "!"] as IData).asInt();
Return Type:
int
// ListData as int(["Hello", "World", "!"] as IData) as int
Return Type:
int
Returns: this data as a long
// ListData.asLong() as long;(["Hello", "World", "!"] as IData).asLong();
Return Type:
long
// ListData as long(["Hello", "World", "!"] as IData) as long
Return Type:
long
Returns: this data as a short
// ListData.asShort() as short;(["Hello", "World", "!"] as IData).asShort();
Return Type:
short
// ListData as short(["Hello", "World", "!"] as IData) as short
Return Type:
short
E.G println(("hello" as IData).asString())
prints "hello"
Returns: The escaped string version of this IData.
// ListData.asString() as string;(["Hello", "World", "!"] as IData).asString();
Return Type:
string
E.G println(("hello" as IData).getAsString())
prints hello
Returns: The literal string version of this IData.
// ListData.getAsString() as string;(["Hello", "World", "!"] as IData).getAsString();
Return Type:
string
E.G println(("hello" as IData).getAsString())
prints hello
// ListData as string(["Hello", "World", "!"] as IData) as string
Return Type:
string
Returns: the intenral ID of this data.
// ListData.getId() as byte;(["Hello", "World", "!"] as IData).getId();
Return Type:
byte
// ListData.isEmpty as bool(["Hello", "World", "!"] as IData).isEmpty
Return Type:
bool
Returns: True if empty.
// ListData.isEmpty() as bool;(["Hello", "World", "!"] as IData).isEmpty();
Return Type:
bool
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.
Return Type:
IData
Returns: A new IData from the operation
(["Hello", "World", "!"] as IData).map((data) => 3);
Parameters:
Return Type:
IData
// ListData.remove(key as string);(["Hello", "World", "!"] as IData).remove("key");
Parameters:
key: string
Type: string
- The key to remove.