BlockState
Importing the class
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
import crafttweaker.api.block.BlockState;Casters
| Result Type | Is Implicit | 
|---|---|
| Result TypeBlock | Is Implicittrue | 
| Result TypeBlockIngredient | Is Implicittrue | 
| Result Typestring | Is Implicitfalse | 
Methods
Return Type: string
// BlockState.asString() as string
<blockstate:minecraft:grass>.asString();Checks whether this BlockState is solid.
Returns: True if this BlockState is solid. False otherwise.
Return Type: boolean
// BlockState.canOcclude() as boolean
<blockstate:minecraft:grass>.canOcclude();Gets a list of allowed values for a given property.
Returns: a List of allowed values.
Return Type: stdlib.List<string>
// BlockState.getAllowedValuesForProperty(name as string) as stdlib.List<string>
<blockstate:minecraft:grass>.getAllowedValuesForProperty("snowy");| Parameter | Type | Description | 
|---|---|---|
| Parametername | Typestring | DescriptionThe name of the property to find the allowed values for. | 
Gets the blockstate bracket handler syntax for this BlockState.
E.G.
<blockstate:minecraft:grass:snowy=true>
Returns: The blockstate bracket handler syntax for this BlockState.
Return Type: string
// BlockState.getCommandString() as string
<blockstate:minecraft:grass>.getCommandString();Gets the hardness of this BlockState.
Returns: The hardness of this BlockState.
Return Type: float
// BlockState.getDestroySpeed() as float
<blockstate:minecraft:grass>.getDestroySpeed();Gets the light level of this BlockState
Returns: The light level of this BlockState.
Return Type: int
// BlockState.getLightEmission() as int
<blockstate:minecraft:grass>.getLightEmission();Gets the properties of this BlockState.
Returns: a Map of the properties on this BlockState.
Return Type: string[string]
// BlockState.getProperties() as string[string]
<blockstate:minecraft:grass>.getProperties();Gets the names of the properties of this BlockState.
Returns: the List of the names of the BlockStates’s properties.
Return Type: stdlib.List<string>
// BlockState.getPropertyNames() as stdlib.List<string>
<blockstate:minecraft:grass>.getPropertyNames();Gets the value of the given property.
Returns: The value of the property on this BlockState.
Return Type: string
BlockState.getPropertyValue(name as string) as string| Parameter | Type | Description | 
|---|---|---|
| Parametername | Typestring | Description”snowy” | 
Return Type: SoundType
// BlockState.getSoundType() as SoundType
<blockstate:minecraft:grass>.getSoundType();Checks whether this BlockState has a BlockEntity.
Returns: True if this BlockState has a BlockEntity. False otherwise.
Return Type: boolean
// BlockState.hasBlockEntity() as boolean
<blockstate:minecraft:grass>.hasBlockEntity();Checks whether this BlockState has the given property.
Returns: True if this BlockState has the property. False otherwise.
Return Type: boolean
// BlockState.hasProperty(name as string) as boolean
<blockstate:minecraft:grass>.hasProperty("snowy");| Parameter | Type | Description | 
|---|---|---|
| Parametername | Typestring | Descriptionthe name of the property to check. | 
Checks whether this BlockState ticks randomly.
Returns: True if this BlockState ticks randomly. False otherwise.
Return Type: boolean
// BlockState.isRandomlyTicking() as boolean
<blockstate:minecraft:grass>.isRandomlyTicking();Checks whether this BlockState can provide Redstone Power
Returns: True if this BlockState can provide Redstone Power. False otherwise.
Return Type: boolean
// BlockState.isSignalSource() as boolean
<blockstate:minecraft:grass>.isSignalSource();Return Type: BlockState
BlockState.rotate(rotation as Rotation) as BlockState| Parameter | Type | 
|---|---|
| Parameterrotation | TypeRotation | 
Sets the destroy speed of this BlockState.
// BlockState.setDestroySpeed(destroySpeed as float)
<blockstate:minecraft:grass>.setDestroySpeed(2.4f);| Parameter | Type | Description | 
|---|---|---|
| ParameterdestroySpeed | Typefloat | Descriptionthe new destroy speed of this BlockState | 
Sets a block property based on it’s name.
Returns: This BlockState with the new property value.
Return Type: BlockState
// BlockState.withProperty(name as string, value as string) as BlockState
<blockstate:minecraft:grass>.withProperty("snowy", "true");| Parameter | Type | Description | 
|---|---|---|
| Parametername | Typestring | DescriptionThe name of the property to set. | 
| Parametervalue | Typestring | DescriptionThe new value of the property. | 
Properties
| Name | Type | Has Getter | Has Setter | Description | 
|---|---|---|---|---|
| Nameblock | TypeBlock | Has Gettertrue | Has Setterfalse | DescriptionGets the base Block of this BlockState. The Block will not contain any of the properties of this BlockState. | 
| NamecanOcclude | Typeboolean | Has Gettertrue | Has Setterfalse | DescriptionChecks whether this BlockState is solid. | 
| NamecommandString | Typestring | Has Gettertrue | Has Setterfalse | DescriptionGets the blockstate bracket handler syntax for this BlockState. E.G. <blockstate:minecraft:grass:snowy=true> | 
| NamedestroySpeed | Typefloat | Has Gettertrue | Has Settertrue | DescriptionGets the hardness of this BlockState. | 
| NamehasBlockEntity | Typeboolean | Has Gettertrue | Has Setterfalse | DescriptionChecks whether this BlockState has a BlockEntity. | 
| NameisRandomlyTicking | Typeboolean | Has Gettertrue | Has Setterfalse | DescriptionChecks whether this BlockState ticks randomly. | 
| NameisSignalSource | Typeboolean | Has Gettertrue | Has Setterfalse | DescriptionChecks whether this BlockState can provide Redstone Power | 
| NamelightEmission | Typeint | Has Gettertrue | Has Setterfalse | DescriptionGets the light level of this BlockState | 
| Nameproperties | Typestring[string] | Has Gettertrue | Has Setterfalse | DescriptionGets the properties of this BlockState. | 
| NamepropertyNames | Typestdlib.List<string> | Has Gettertrue | Has Setterfalse | DescriptionGets the names of the properties of this BlockState. | 
| NamesoundType | TypeSoundType | Has Gettertrue | Has Setterfalse | Description |