IData
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.IData;
Description
Loaders
This type is available in the following loaders:
crafttweaker
tags
Implements
Operators
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
myIData in myIData
Return Type:
bool
Members
Returns: this data as a bool
// IData.asBool() as bool;myIData.asBool();
Return Type:
bool
// IData as boolmyIData as bool
Return Type:
bool
Returns: this data as a byte
// IData.asByte() as byte;myIData.asByte();
Return Type:
byte
// IData as bytemyIData as byte
Return Type:
byte
Returns: this data as a byte array
// IData.asByteArray() as byte[];myIData.asByteArray();
Return Type:
byte[]
// IData as byte[]myIData as byte[]
Return Type:
byte[]
Returns: this data as a double
// IData.asDouble() as double;myIData.asDouble();
Return Type:
double
// IData as doublemyIData as double
Return Type:
double
Returns: this data as a float
// IData.asFloat() as float;myIData.asFloat();
Return Type:
float
// IData as floatmyIData as float
Return Type:
float
Returns: this data as an int
// IData.asInt() as int;myIData.asInt();
Return Type:
int
// IData as intmyIData as int
Return Type:
int
Returns: this data as an int array
// IData.asIntArray() as int[];myIData.asIntArray();
Return Type:
int[]
// IData as int[]myIData as int[]
Return Type:
int[]
Returns: this data as a long
// IData.asLong() as long;myIData.asLong();
Return Type:
long
// IData as longmyIData as long
Return Type:
long
Returns: this data as a long array
// IData.asLongArray() as long[];myIData.asLongArray();
Return Type:
long[]
// IData as long[]myIData as long[]
Return Type:
long[]
Returns: this data as a short
// IData.asShort() as short;myIData.asShort();
Return Type:
short
// IData as shortmyIData as short
Return Type:
short
E.G println(("hello" as IData).asString())
prints "hello"
Returns: The escaped string version of this IData.
// IData.asString() as string;myIData.asString();
Return Type:
string
E.G println(("hello" as IData).getAsString())
prints hello
Returns: The literal string version of this IData.
// IData.getAsString() as string;myIData.getAsString();
Return Type:
string
E.G println(("hello" as IData).getAsString())
prints hello
// IData as stringmyIData as string
Return Type:
string
Returns: the intenral ID of this data.
// IData.getId() as byte;myIData.getId();
Return Type:
byte
// IData.isEmpty as boolmyIData.isEmpty
Return Type:
bool
Returns: True if empty.
// IData.isEmpty() as bool;myIData.isEmpty();
Return Type:
bool
// IData.keys as Set<string>myIData.keys
Return Type:
Set<string>
Returns: The keys of this IData.
// IData.keys() as Set<string>;myIData.keys();
Return Type:
Set<string>
// IData.length as intmyIData.length
Return Type:
int
Returns: The length of this IData.
// IData.length() as int;myIData.length();
Return Type:
int
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
myIData.map((data) => 3);
Parameters:
Return Type:
IData
// IData.remove(index as int);myIData.remove(0);
Parameters:
index: int
Type: int
- The index to remove. // IData.remove(key as string);myIData.remove("key");
Parameters:
key: string
Type: string
- The key to remove.