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 . ByteData;
ByteData
implements the following interfaces:
IData
Undocumented Interfaces Comparable <IData >
, Iterable <IData >
// new ByteData(internal as byte);
Parameters:
internal: byte
Type: byte
Concatenates the given IData to this IData. Parameters:
other: IData
Type: IData
- the other data to concatenate.
Return Type:
IData
Gets the data at the given index. // ByteData[index as int] as IData
Parameters:
index: int
Type: int
- The index to get
Return Type:
IData
Gets the data at the given key. // ByteData[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. // ByteData[index as string] = (value as IData ) ( 4 as IData)[myString] = myIData
Parameters:
index: string
Type: string
- The key to store the data at
Applies a SHL (<<) operation to this data by the other data
Return Type:
IData
Applies a SHR (>>) operation to this data by the other data
Return Type:
IData
Casts this IData to a byte array. Returns : this data as a byte array
// ByteData.asByteArray() as byte[];
( 4 as IData).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
// ByteData.asIntArray() as int[];
( 4 as IData).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
// ByteData.asList() as List< IData >;
Return Type:
List <IData >
Casts this IData to a list. // ByteData as List< IData > ( 4 as IData) as List < IData>
Return Type:
List <IData >
Casts this IData to a long array. Returns : this data as a long array
// ByteData.asLongArray() as long[];
( 4 as IData).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
// ByteData.asMap() as IData [string];
Return Type:
IData [string ]
Casts this IData to a map. // ByteData as IData [string] ( 4 as IData) 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.
// ByteData.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.
// ByteData.getAsString() as string;
( 4 as IData).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.
// ByteData.getId() as byte;
Return Type:
byte
Checks if this data is empty. // ByteData.isEmpty as bool
Return Type:
bool
Checks if this data is empty. Returns : True if empty.
// ByteData.isEmpty() as bool;
Return Type:
bool
Gets the keys of this IData // ByteData.keys as Set<string>
Return Type:
Set <string >
Gets the keys of this IData Returns : The keys of this IData.
// ByteData.keys() as Set<string>;
Return Type:
Set <string >
Gets the length of this IData. // ByteData.length as int
Return Type:
int
Gets the length of this IData. Returns : The length of this IData.
// ByteData.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.
ByteData . 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
( 4 as IData).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.
( 4 as IData).merge(myIData);
Return Type:
IData
Puts the given value inside this IData at the given index. // ByteData.put(index as string, value as IData ); ( 4 as IData).put( "key" , "value" );
Parameters:
index: string
Type: string
- The key to store the data at
Removes the stored data at the given index. // ByteData.remove(index as int);
Parameters:
index: int
Type: int
- The index to remove.
Removes the stored data at the given key. // ByteData.remove(key as string);
( 4 as IData).remove( "key" );
Parameters:
key: string
Type: string
- The key to remove.
Sets the given value inside this IData at the given index. // ByteData.setAt(name as string, data as IData ); ( 4 as IData).setAt(myString, myIData);
Parameters:
name: string
Type: string
- The key to store the data at