BoolData
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.BoolData;
Description
Careful with BoolData: While it works for specifying boolean attributes in JSON syntax, using it in Tags will instead use aByteData
object. Reason for this is that Minecraft does not have Boolean NBT values. Implements
BoolData
implements the following interfaces:
Constructors
// new BoolData(internalValue as bool);new BoolData(myBool);
Parameters:
internalValue: bool
Type: bool
Operators
Members
// BoolData as bool(true as IData) as bool
Return Type:
bool
Returns: this data as a byte array
// BoolData.asByteArray() as byte[];(true as IData).asByteArray();
Return Type:
byte[]
// BoolData as byte[](true as IData) as byte[]
Return Type:
byte[]
Returns: this data as an int array
// BoolData.asIntArray() as int[];(true as IData).asIntArray();
Return Type:
int[]
// BoolData as int[](true as IData) as int[]
Return Type:
int[]
Returns: this data as a long array
// BoolData.asLongArray() as long[];(true as IData).asLongArray();
Return Type:
long[]
// BoolData as long[](true as IData) as long[]
Return Type:
long[]
E.G println(("hello" as IData).asString())
prints "hello"
Returns: The escaped string version of this IData.
// BoolData.asString() as string;(true as IData).asString();
Return Type:
string
E.G println(("hello" as IData).getAsString())
prints hello
Returns: The literal string version of this IData.
// BoolData.getAsString() as string;(true as IData).getAsString();
Return Type:
string
E.G println(("hello" as IData).getAsString())
prints hello
// BoolData as string(true as IData) as string
Return Type:
string
Returns: the intenral ID of this data.
// BoolData.getId() as byte;(true as IData).getId();
Return Type:
byte
// BoolData.isEmpty as bool(true as IData).isEmpty
Return Type:
bool
Returns: True if empty.
// BoolData.isEmpty() as bool;(true as IData).isEmpty();
Return Type:
bool
// BoolData.keys as Set<string>(true as IData).keys
Return Type:
Set<string>
Returns: The keys of this IData.
// BoolData.keys() as Set<string>;(true as IData).keys();
Return Type:
Set<string>
// BoolData.length as int(true as IData).length
Return Type:
int
Returns: The length of this IData.
// BoolData.length() as int;(true as IData).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
(true as IData).map((data) => 3);
Parameters:
Return Type:
IData
// BoolData.remove(index as int);(true as IData).remove(0);
Parameters:
index: int
Type: int
- The index to remove. // BoolData.remove(key as string);(true as IData).remove("key");
Parameters:
key: string
Type: string
- The key to remove.