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