IntData
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.IntData;
Description
Implements
IntData
implements the following interfaces:
Constructors
// new IntData(internal as int);new IntData(myInt);
Parameters:
internal: int
Type: int
Operators
Members
Returns: this data as a byte array
// IntData.asByteArray() as byte[];myIntData.asByteArray();
Return Type:
byte[]
// IntData as byte[]myIntData as byte[]
Return Type:
byte[]
Returns: this data as an int array
// IntData.asIntArray() as int[];myIntData.asIntArray();
Return Type:
int[]
// IntData as int[]myIntData as int[]
Return Type:
int[]
Returns: this data as a long array
// IntData.asLongArray() as long[];myIntData.asLongArray();
Return Type:
long[]
// IntData as long[]myIntData as long[]
Return Type:
long[]
E.G println(("hello" as IData).asString())
prints "hello"
Returns: The escaped string version of this IData.
// IntData.asString() as string;myIntData.asString();
Return Type:
string
E.G println(("hello" as IData).getAsString())
prints hello
Returns: The literal string version of this IData.
// IntData.getAsString() as string;myIntData.getAsString();
Return Type:
string
E.G println(("hello" as IData).getAsString())
prints hello
// IntData as stringmyIntData as string
Return Type:
string
Returns: the intenral ID of this data.
// IntData.getId() as byte;myIntData.getId();
Return Type:
byte
// IntData.isEmpty as boolmyIntData.isEmpty
Return Type:
bool
Returns: True if empty.
// IntData.isEmpty() as bool;myIntData.isEmpty();
Return Type:
bool
// IntData.keys as Set<string>myIntData.keys
Return Type:
Set<string>
Returns: The keys of this IData.
// IntData.keys() as Set<string>;myIntData.keys();
Return Type:
Set<string>
// IntData.length as intmyIntData.length
Return Type:
int
Returns: The length of this IData.
// IntData.length() as int;myIntData.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
myIntData.map((data) => 3);
Parameters:
Return Type:
IData
// IntData.remove(index as int);myIntData.remove(0);
Parameters:
index: int
Type: int
- The index to remove. // IntData.remove(key as string);myIntData.remove("key");
Parameters:
key: string
Type: string
- The key to remove.