Home Commands Examples Getting Started With Scripts Global Keywords
BracketDumpers BracketHandlers BracketValidators ResourceLocationBracketHandler

BlockState

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.

script.zs
import crafttweaker.api.block.BlockState;

Description

Extends

BlockState extends BlockStateBase.

Implements

Undocumented Interfaces

IForgeBlockState

Operators

|(other as CTBlockIngredient) as CTBlockIngredient
script.zs
// (BlockState | (other as CTBlockIngredient)) as CTBlockIngredient
<blockstate:minecraft:grass> | myCTBlockIngredient

Parameters:

Return Type: BlockIngredient

Members

implicit as CTBlockIngredient
script.zs
// BlockState as CTBlockIngredient
<blockstate:minecraft:grass> as CTBlockIngredient

Return Type: BlockIngredient

asString() as string
script.zs
// BlockState.asString() as string;
<blockstate:minecraft:grass>.asString();

Return Type: string

Getter
Gets the base Block of this BlockState.
The Block will not contain any of the properties of this BlockState.
script.zs
// BlockState.block as Block
<blockstate:minecraft:grass>.block

Return Type: Block

implicit as Block
Gets the base Block of this BlockState.
The Block will not contain any of the properties of this BlockState.
script.zs
// BlockState as Block
<blockstate:minecraft:grass> as Block

Return Type: Block

Getter
Checks whether this BlockState is solid.
script.zs
// BlockState.canOcclude as bool
<blockstate:minecraft:grass>.canOcclude

Return Type: bool

canOcclude() as bool
Checks whether this BlockState is solid.

Returns: True if this BlockState is solid. False otherwise.

script.zs
// BlockState.canOcclude() as bool;
<blockstate:minecraft:grass>.canOcclude();

Return Type: bool

Getter
Gets the blockstate bracket handler syntax for this BlockState.
E.G. <blockstate:minecraft:grass:snowy=true>
script.zs
// BlockState.commandString as string
<blockstate:minecraft:grass>.commandString

Return Type: string

commandString() as string
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.

script.zs
// BlockState.commandString() as string;
<blockstate:minecraft:grass>.commandString();

Return Type: string

as string
Gets the blockstate bracket handler syntax for this BlockState.
E.G. <blockstate:minecraft:grass:snowy=true>
script.zs
// BlockState as string
<blockstate:minecraft:grass> as string

Return Type: string

Getter
Gets the hardness of this BlockState.
script.zs
// BlockState.destroySpeed as float
<blockstate:minecraft:grass>.destroySpeed

Return Type: float

Setter
Sets the destroy speed of this BlockState.
script.zs
// BlockState.destroySpeed = (destroySpeed as float);
<blockstate:minecraft:grass>.destroySpeed = myFloat;

Parameters:

destroySpeed Type: float - the new destroy speed of this BlockState
destroySpeed() as float
Gets the hardness of this BlockState.

Returns: The hardness of this BlockState.

script.zs
// BlockState.destroySpeed() as float;
<blockstate:minecraft:grass>.destroySpeed();

Return Type: float

destroySpeed(destroySpeed as float)
Sets the destroy speed of this BlockState.
script.zs
// BlockState.destroySpeed(destroySpeed as float);
<blockstate:minecraft:grass>.destroySpeed(2.4f);

Parameters:

destroySpeed Type: float - the new destroy speed of this BlockState
getAllowedValuesForProperty(name as string) as List<string>
Gets a list of allowed values for a given property.

Returns: a List of allowed values.

script.zs
// BlockState.getAllowedValuesForProperty(name as string) as List<string>;
<blockstate:minecraft:grass>.getAllowedValuesForProperty("snowy");

Parameters:

name Type: string - The name of the property to find the allowed values for.

Return Type: List<string>

getPropertyValue(name as string) as string
Gets the value of the given property.

Returns: The value of the property on this BlockState.

script.zs
// BlockState.getPropertyValue(name as string) as string;
<blockstate:minecraft:grass>.getPropertyValue(myString);

Parameters:

name Type: string - "snowy"

Return Type: string

Getter
Checks whether this BlockState has a net.minecraft.world.level.block.entity.BlockEntity.
script.zs
// BlockState.hasBlockEntity as bool
<blockstate:minecraft:grass>.hasBlockEntity

Return Type: bool

hasBlockEntity() as bool
Checks whether this BlockState has a net.minecraft.world.level.block.entity.BlockEntity.

Returns: True if this BlockState has a net.minecraft.world.level.block.entity.BlockEntity. False otherwise.

script.zs
// BlockState.hasBlockEntity() as bool;
<blockstate:minecraft:grass>.hasBlockEntity();

Return Type: bool

hasProperty(name as string) as bool
Checks whether this BlockState has the given property.

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

script.zs
// BlockState.hasProperty(name as string) as bool;
<blockstate:minecraft:grass>.hasProperty("snowy");

Parameters:

name Type: string - the name of the property to check.

Return Type: bool

Getter
Checks whether this BlockState ticks randomly.
script.zs
// BlockState.isRandomlyTicking as bool
<blockstate:minecraft:grass>.isRandomlyTicking

Return Type: bool

isRandomlyTicking() as bool
Checks whether this BlockState ticks randomly.

Returns: True if this BlockState ticks randomly. False otherwise.

script.zs
// BlockState.isRandomlyTicking() as bool;
<blockstate:minecraft:grass>.isRandomlyTicking();

Return Type: bool

Getter
Checks whether this BlockState can provide Redstone Power
script.zs
// BlockState.isSignalSource as bool
<blockstate:minecraft:grass>.isSignalSource

Return Type: bool

isSignalSource() as bool
Checks whether this BlockState can provide Redstone Power

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

script.zs
// BlockState.isSignalSource() as bool;
<blockstate:minecraft:grass>.isSignalSource();

Return Type: bool

Getter
Gets the light level of this BlockState
script.zs
// BlockState.lightEmission as int
<blockstate:minecraft:grass>.lightEmission

Return Type: int

lightEmission() as int
Gets the light level of this BlockState

Returns: The light level of this BlockState.

script.zs
// BlockState.lightEmission() as int;
<blockstate:minecraft:grass>.lightEmission();

Return Type: int

Getter
Gets the properties of this BlockState.
script.zs
// BlockState.properties as string[string]
<blockstate:minecraft:grass>.properties

Return Type: string[string]

properties() as string[string]
Gets the properties of this BlockState.

Returns: a Map of the properties on this BlockState.

script.zs
// BlockState.properties() as string[string];
<blockstate:minecraft:grass>.properties();

Return Type: string[string]

Getter
Gets the names of the properties of this BlockState.
script.zs
// BlockState.propertyNames as List<string>
<blockstate:minecraft:grass>.propertyNames

Return Type: List<string>

propertyNames() as List<string>
Gets the names of the properties of this BlockState.

Returns: the List of the names of the BlockStates's properties.

script.zs
// BlockState.propertyNames() as List<string>;
<blockstate:minecraft:grass>.propertyNames();

Return Type: List<string>

rotate(rotation as Rotation) as BlockState
script.zs
// BlockState.rotate(rotation as Rotation) as BlockState;
<blockstate:minecraft:grass>.rotate(myRotation);

Parameters:

rotation Type: Rotation

Return Type: BlockState

Getter
script.zs
// BlockState.soundType as SoundType
<blockstate:minecraft:grass>.soundType

Return Type: SoundType

soundType() as SoundType
script.zs
// BlockState.soundType() as SoundType;
<blockstate:minecraft:grass>.soundType();

Return Type: SoundType

withProperty(name as string, value as string) as BlockState
Sets a block property based on it's name.

Returns: This BlockState with the new property value.

script.zs
// BlockState.withProperty(name as string, value as string) as BlockState;
<blockstate:minecraft:grass>.withProperty("snowy", "true");

Parameters:

name Type: string - The name of the property to set.
value Type: string - The new value of the property.

Return Type: BlockState