Importing the class

Link to 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.

ZenScript
Copy
import crafttweaker.api.block.BlockState;
Result typeIs Implicit
Result type
Block
Is Implicit
true
Result type
string
Is Implicit
false

Link to g-

Name: canOcclude

Checks whether this BlockState is solid.

Returns: True if this BlockState is solid. False otherwise.
Return Type: boolean

ZenScript
Copy
// BlockState.canOcclude() as boolean

<blockstate:minecraft:grass>.canOcclude();

Link to g--1

Name: getAllowedValuesForProperty

Gets a list of allowed values for a given property.

Returns: a List of allowed values.
Return Type: stdlib.List<string>

ZenScript
Copy
// BlockState.getAllowedValuesForProperty(name as string) as stdlib.List<string>

<blockstate:minecraft:grass>.getAllowedValuesForProperty("snowy");
ParameterTypeDescription
Parameter
name
Type
string
Description
The name of the property to find the allowed values for.

Link to g--2

Name: getCommandString

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

ZenScript
Copy
// BlockState.getCommandString() as string

<blockstate:minecraft:grass>.getCommandString();

Link to g--3

Name: getDestroySpeed

Gets the hardness of this BlockState.

Returns: The hardness of this BlockState.
Return Type: float

ZenScript
Copy
// BlockState.getDestroySpeed() as float

<blockstate:minecraft:grass>.getDestroySpeed();

Link to g--4

Name: getLightEmission

Gets the light level of this BlockState

Returns: The light level of this BlockState.
Return Type: int

ZenScript
Copy
// BlockState.getLightEmission() as int

<blockstate:minecraft:grass>.getLightEmission();

Link to g--5

Name: getProperties

Gets the properties of this BlockState.

Returns: a Map of the properties on this BlockState.
Return Type: string[string]

ZenScript
Copy
// BlockState.getProperties() as string[string]

<blockstate:minecraft:grass>.getProperties();

Link to g--6

Name: getPropertyNames

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>

ZenScript
Copy
// BlockState.getPropertyNames() as stdlib.List<string>

<blockstate:minecraft:grass>.getPropertyNames();

Link to g--7

Name: getPropertyValue

Gets the value of the given property.

Returns: The value of the property on this BlockState.
Return Type: string

ZenScript
Copy
BlockState.getPropertyValue(name as string) as string
ParameterTypeDescription
Parameter
name
Type
string
Description
"snowy"

Link to g--8

Name: getSoundType

Return Type: SoundType

ZenScript
Copy
// BlockState.getSoundType() as SoundType

<blockstate:minecraft:grass>.getSoundType();

Link to g--9

Name: hasBlockEntity

Checks whether this BlockState has a BlockEntity.

Returns: True if this BlockState has a BlockEntity. False otherwise.
Return Type: boolean

ZenScript
Copy
// BlockState.hasBlockEntity() as boolean

<blockstate:minecraft:grass>.hasBlockEntity();

Link to g--10

Name: hasProperty

Checks whether this BlockState has the given property.

Returns: True if this BlockState has the property. False otherwise.
Return Type: boolean

ZenScript
Copy
// BlockState.hasProperty(name as string) as boolean

<blockstate:minecraft:grass>.hasProperty("snowy");
ParameterTypeDescription
Parameter
name
Type
string
Description
the name of the property to check.

Link to g--11

Name: isRandomlyTicking

Checks whether this BlockState ticks randomly.

Returns: True if this BlockState ticks randomly. False otherwise.
Return Type: boolean

ZenScript
Copy
// BlockState.isRandomlyTicking() as boolean

<blockstate:minecraft:grass>.isRandomlyTicking();

Link to g--12

Name: isSignalSource

Checks whether this BlockState can provide Redstone Power

Returns: True if this BlockState can provide Redstone Power. False otherwise.
Return Type: boolean

ZenScript
Copy
// BlockState.isSignalSource() as boolean

<blockstate:minecraft:grass>.isSignalSource();

Name: rotate

Return Type: BlockState

ZenScript
Copy
BlockState.rotate(rotation as Rotation) as BlockState
ParameterTypeDescription
Parameter
rotation
Type
Rotation
Description
No Description Provided

Link to g--14

Name: setHardness

Sets the destroy speed of this BlockState.

Return Type: void

ZenScript
Copy
// BlockState.setHardness(destroySpeed as float) as void

<blockstate:minecraft:grass>.setHardness(2.4f);
ParameterTypeDescription
Parameter
destroySpeed
Type
float
Description
the new destroy speed of this BlockState

Link to g--15

Name: withProperty

Sets a block property based on it's name.

Returns: This BlockState with the new property value.
Return Type: BlockState

ZenScript
Copy
// BlockState.withProperty(name as string, value as string) as BlockState

<blockstate:minecraft:grass>.withProperty("snowy", "true");
ParameterTypeDescription
Parameter
name
Type
string
Description
The name of the property to set.
Parameter
value
Type
string
Description
The new value of the property.
NombreTypeHas GetterHas SetterDescription
Nombre
block
Type
Block
Has Getter
true
Has Setter
false
Description
Gets the base Block of this BlockState.

The Block will not contain any of the properties of this BlockState.
Nombre
canOcclude
Type
boolean
Has Getter
true
Has Setter
false
Description
Checks whether this BlockState is solid.
Nombre
commandString
Type
string
Has Getter
true
Has Setter
false
Description
Gets the blockstate bracket handler syntax for this BlockState.

E.G.

blockstate:minecraft:grass:snowy=true
Nombre
destroySpeed
Type
float
Has Getter
true
Has Setter
true
Description
Gets the hardness of this BlockState.
Nombre
hasBlockEntity
Type
boolean
Has Getter
true
Has Setter
false
Description
Checks whether this BlockState has a BlockEntity.
Nombre
lightEmission
Type
int
Has Getter
true
Has Setter
false
Description
Gets the light level of this BlockState
Nombre
propertyNames
Type
stdlib.List<string>
Has Getter
true
Has Setter
false
Description
Gets the names of the properties of this BlockState.
Nombre
randomlyTicking
Type
boolean
Has Getter
true
Has Setter
false
Description
Checks whether this BlockState ticks randomly.
Nombre
signalSource
Type
boolean
Has Getter
true
Has Setter
false
Description
Checks whether this BlockState can provide Redstone Power
Nombre
soundType
Type
SoundType
Has Getter
true
Has Setter
false
Description
No Description Provided