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;
ShortData
implements the following interfaces:
IData
Undocumented Interfaces Comparable <IData >
, Iterable <IData >
// new ShortData(internal as short);
Parameters:
internal: short
Type: short
Concatenates the given IData to this IData. // (ShortData ~ (other as IData)) as IData
Parameters:
other: IData
Type: IData
- the other data to concatenate.
Return Type:
IData
Gets the data at the given index. // ShortData[index as int] as IData
Parameters:
index: int
Type: int
- The index to get
Return Type:
IData
Gets the data at the given key. // ShortData[key as string] as IData
Parameters:
key: string
Type: string
- The key to get
Return Type:
IData
Applies a NOT (!) operation to this IData.
Return Type:
IData
Puts the given value inside this IData at the given index. // ShortData[index as string] = (value as IData)
myShortData[myString] = myIData
Parameters:
index: string
Type: string
- The key to store the data at
Casts this IData to a byte array. Returns : this data as a byte array
// ShortData.asByteArray() as byte[];
myShortData . asByteArray();
Return Type:
byte []
Casts this IData to a byte array.
Return Type:
byte []
Casts this IData to an int array. Returns : this data as an int array
// ShortData.asIntArray() as int[];
myShortData . asIntArray();
Return Type:
int []
Casts this IData to an int array.
Return Type:
int []
Casts this IData to a list. Returns : this data as a list
// ShortData.asList() as List<IData>;
Return Type:
List <IData >
Casts this IData to a list. // ShortData as List<IData>
myShortData as List < IData>
Return Type:
List <IData >
Casts this IData to a long array. Returns : this data as a long array
// ShortData.asLongArray() as long[];
myShortData . asLongArray();
Return Type:
long []
Casts this IData to a long array.
Return Type:
long []
Casts this IData to a map. Returns : this data as a map
// ShortData.asMap() as IData[string];
Return Type:
IData [string ]
Casts this IData to a map. // ShortData as IData[string]
myShortData as IData [ string ]
Return Type:
IData [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.
// ShortData.asString() as string;
Return Type:
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.
// ShortData.getAsString() as string;
myShortData . getAsString();
Return Type:
string
Gets the literal string version of this IData. E.G println(("hello" as IData).getAsString())
prints hello
Return Type:
string
Gets the internal ID of this data. Returns : the intenral ID of this data.
// ShortData.getId() as byte;
Return Type:
byte
Checks if this data is empty. // ShortData.isEmpty as bool
Return Type:
bool
Checks if this data is empty. Returns : True if empty.
// ShortData.isEmpty() as bool;
Return Type:
bool
Gets the keys of this IData // ShortData.keys as Set<string>
Return Type:
Set <string >
Gets the keys of this IData Returns : The keys of this IData.
// ShortData.keys() as Set<string>;
Return Type:
Set <string >
Gets the length of this IData. // ShortData.length as int
Return Type:
int
Gets the length of this IData. Returns : The length of this IData.
// ShortData.length() as int;
Return Type:
int
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.
// ShortData.listOf(members as IData[]) as IData;
ShortData . listOf( 1 , 2 , 3 );
Parameters:
members: IData []
Type: IData []
- The members to put in the list.
Return Type:
IData
Maps this IData to another IData based on the given operation. Returns : A new IData from the operation
// ShortData.map(operation as function(r as IData) as IData) as IData;
myShortData . map((data) => 3 );
Parameters:
operation: function(r as IData ) as IData
Type: function(r as IData ) as IData
- The operation to apply to this IData
Return Type:
IData
Merges the given data with this data. Returns : the result of merging the datas.
// ShortData.merge(other as IData) as IData;
myShortData . merge(myIData);
Return Type:
IData
Puts the given value inside this IData at the given index. // ShortData.put(index as string, value as IData);
myShortData . put( "key" , "value" );
Parameters:
index: string
Type: string
- The key to store the data at
Removes the stored data at the given index. // ShortData.remove(index as int);
Parameters:
index: int
Type: int
- The index to remove.
Removes the stored data at the given key. // ShortData.remove(key as string);
myShortData . remove( "key" );
Parameters:
key: string
Type: string
- The key to remove.
Sets the given value inside this IData at the given index. // ShortData.setAt(name as string, data as IData);
myShortData . setAt(myString, myIData);
Parameters:
name: string
Type: string
- The key to store the data at