BlockState

A state that a block may be in.

This is a representation of a block with specific properties that affect its behaviour.

Functions

Link copied to clipboard
abstract fun asFluid(): FluidState

Converts this block state in to its corresponding fluid state.

Link copied to clipboard
abstract fun blocksMotion(): Boolean

If this block can be moved through.

Link copied to clipboard
abstract fun <T : Comparable<T>> getProperty(property: Property<T>): T?

Gets the value for the given property, or returns null if there is no value for the given property.

Link copied to clipboard
abstract fun hasProperty(property: Property<*>): Boolean

Checks if the given property has a value on this state.

Link copied to clipboard
abstract fun isAir(): Boolean

If this block state is air.

Link copied to clipboard
abstract fun isFlammable(): Boolean

If this block state can be set on fire.

Link copied to clipboard
abstract fun isLiquid(): Boolean

If this block state represents a liquid rather than a solid object.

Link copied to clipboard
abstract fun isOpaque(): Boolean

If this block state is opaque, meaning no light can pass through it.

Link copied to clipboard
abstract fun isReplaceable(): Boolean

If this block state can be replaced with another block state when attempting to place a block on this block.

Link copied to clipboard
abstract fun isSolid(): Boolean

If this block state is a solid object with collision, meaning entities cannot pass through it.

Link copied to clipboard
abstract fun <T : Comparable<T>> requireProperty(property: Property<T>): T

Gets the value for the given property, or throws an IllegalArgumentException if there is no value for the given property.

Link copied to clipboard
abstract fun <T : Comparable<T>> setProperty(property: Property<T>, value: T): BlockState

Sets the value for the given property to the given value and returns the resulting state.

Properties

Link copied to clipboard
@get:JvmName(name = "availableProperties")
abstract val availableProperties: @Unmodifiable Set<Property<*>>

All of the properties that can be set on this state.

Link copied to clipboard
@get:JvmName(name = "block")
abstract val block: Block

The block this is a state of.

Link copied to clipboard
@get:JvmName(name = "hardness")
abstract val hardness: Double

The hardness of this block state.

Link copied to clipboard
@get:JvmName(name = "properties")
abstract val properties: @Unmodifiable Map<Property<*>, Comparable<*>>

All of the properties that are currently set on this state.

Link copied to clipboard
@get:JvmName(name = "pushReaction")
abstract val pushReaction: PushReaction

How this block reacts to being pushed or pulled by pistons.