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 boolmyBoolData as bool
Return Type:
bool
Returns: this data as a byte array
// BoolData.asByteArray() as byte[];myBoolData.asByteArray();
Return Type:
byte[]
// BoolData as byte[]myBoolData as byte[]
Return Type:
byte[]
Returns: this data as an int array
// BoolData.asIntArray() as int[];myBoolData.asIntArray();
Return Type:
int[]
// BoolData as int[]myBoolData as int[]
Return Type:
int[]
Returns: this data as a long array
// BoolData.asLongArray() as long[];myBoolData.asLongArray();
Return Type:
long[]
// BoolData as long[]myBoolData 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;myBoolData.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;myBoolData.getAsString();
Return Type:
string
E.G println(("hello" as IData).getAsString())
prints hello
// BoolData as stringmyBoolData as string
Return Type:
string
Returns: the intenral ID of this data.
// BoolData.getId() as byte;myBoolData.getId();
Return Type:
byte
// BoolData.isEmpty as boolmyBoolData.isEmpty
Return Type:
bool
Returns: True if empty.
// BoolData.isEmpty() as bool;myBoolData.isEmpty();
Return Type:
bool
// BoolData.keys as Set<string>myBoolData.keys
Return Type:
Set<string>
Returns: The keys of this IData.
// BoolData.keys() as Set<string>;myBoolData.keys();
Return Type:
Set<string>
// BoolData.length as intmyBoolData.length
Return Type:
int
Returns: The length of this IData.
// BoolData.length() as int;myBoolData.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
myBoolData.map((data) => 3);
Parameters:
Return Type:
IData
// BoolData.remove(index as int);myBoolData.remove(0);
Parameters:
index: int
Type: int
- The index to remove. // BoolData.remove(key as string);myBoolData.remove("key");
Parameters:
key: string
Type: string
- The key to remove.