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