dev.polymodloader.api.content.block.state
This page is generated from the source's Javadoc by ./gradlew apiReference. Do not edit it; fix the source comment and generate it again.
| Type | Kind | Description |
|---|---|---|
BlockProperty | interface | A block state property such as lit=true, level=3, or facing=north. |
BlockProperty.BooleanProperty | record | A boolean property. |
BlockProperty.ChoiceProperty | record | A property with named values. |
BlockProperty.DirectionProperty | record | A direction property. |
BlockProperty.IntegerProperty | record | An integer property. |
BlockProperty.Names | class | Name validation shared by the property records. |
BlockStateView | interface | A block together with the values of its properties; an immutable snapshot. |
BlockProperty
interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier
public sealed interface BlockProperty<T>
A block state property such as lit=true, level=3, or facing=north. Each combination of values is one block state; blockstate files in the resource pack select models by these names and values. Property names use a-z 0-9 _. The same property object may be read from any block that has a property with the same name and value type, including the game's own blocks (for example facing of a furnace).
A choice property has named values (shape=round); it also reads the game's own named properties such as half of stairs or axis of logs.
name()
String name()
Since 0.1.0-alpha.4 or earlier
Property name used in blockstate files and commands.
Returns String
defaultValue()
T defaultValue()
Since 0.1.0-alpha.4 or earlier
Value of the block's default state.
Returns T
values()
List<T> values()
Since 0.1.0-alpha.4 or earlier
Every allowed value, in the game's order.
Returns List<T>
bool(String)
static BlockProperty.BooleanProperty bool(String name)
Since 0.1.0-alpha.4 or earlier
A true/false property, default false.
| Parameter | Type | Description |
|---|---|---|
name | String | — |
Returns BlockProperty.BooleanProperty
integer(String, int, int)
static BlockProperty.IntegerProperty integer(String name, int min, int max)
Since 0.1.0-alpha.4 or earlier
A whole-number property in [min, max] with 0 <= min < max <= min + 255, default min.
| Parameter | Type | Description |
|---|---|---|
name | String | — |
min | int | — |
max | int | — |
Returns BlockProperty.IntegerProperty
horizontalFacing(String)
static BlockProperty.DirectionProperty horizontalFacing(String name)
Since 0.1.0-alpha.4 or earlier
A horizontal facing (north, south, west, east), default north.
| Parameter | Type | Description |
|---|---|---|
name | String | — |
Returns BlockProperty.DirectionProperty
direction(String)
static BlockProperty.DirectionProperty direction(String name)
Since 0.1.0-alpha.4 or earlier
Any of the six directions, default north.
| Parameter | Type | Description |
|---|---|---|
name | String | — |
Returns BlockProperty.DirectionProperty
choice(String, String[])
static BlockProperty.ChoiceProperty choice(String name, String... values)
Since 0.1.0-alpha.4 or earlier
A property with named values, in this order; the first is the default. Values use a-z 0-9 _.
| Parameter | Type | Description |
|---|---|---|
name | String | — |
values | String[] | — |
Returns BlockProperty.ChoiceProperty
BlockProperty.BooleanProperty
record · Since 0.1.0-alpha.4 or earlier
public static record BooleanProperty(String name, Boolean defaultValue) implements BlockProperty<Boolean>
A boolean property.
| Component | Type | Description |
|---|---|---|
name | String | — |
defaultValue | Boolean | — |
Supertypes: BlockProperty
values()
public List<Boolean> values()
Since 0.1.0-alpha.4 or earlier
Every allowed value, in the game's order.
Returns List<Boolean>
withDefault(boolean)
public BlockProperty.BooleanProperty withDefault(boolean value)
Since 0.1.0-alpha.4 or earlier
The same property with another default.
| Parameter | Type | Description |
|---|---|---|
value | boolean | — |
Returns BlockProperty.BooleanProperty
name()
public String name()
Since 0.1.0-alpha.4 or earlier
Property name used in blockstate files and commands.
Returns String
defaultValue()
public Boolean defaultValue()
Since 0.1.0-alpha.4 or earlier
Value of the block's default state.
Returns Boolean
BlockProperty.ChoiceProperty
record · Since 0.1.0-alpha.4 or earlier
public static record ChoiceProperty(String name, List<String> values, String defaultValue) implements BlockProperty<String>
A property with named values.
| Component | Type | Description |
|---|---|---|
name | String | — |
values | List<String> | — |
defaultValue | String | — |
Supertypes: BlockProperty
withDefault(String)
public BlockProperty.ChoiceProperty withDefault(String value)
Since 0.1.0-alpha.4 or earlier
The same property with another default.
| Parameter | Type | Description |
|---|---|---|
value | String | — |
Returns BlockProperty.ChoiceProperty
name()
public String name()
Since 0.1.0-alpha.4 or earlier
Property name used in blockstate files and commands.
Returns String
values()
public List<String> values()
Since 0.1.0-alpha.4 or earlier
Every allowed value, in the game's order.
Returns List<String>
defaultValue()
public String defaultValue()
Since 0.1.0-alpha.4 or earlier
Value of the block's default state.
Returns String
BlockProperty.DirectionProperty
record · Since 0.1.0-alpha.4 or earlier
public static record DirectionProperty(String name, boolean horizontalOnly, Direction defaultValue) implements BlockProperty<Direction>
A direction property.
| Component | Type | Description |
|---|---|---|
name | String | — |
horizontalOnly | boolean | — |
defaultValue | Direction | — |
Supertypes: BlockProperty
values()
public List<Direction> values()
Since 0.1.0-alpha.4 or earlier
Every allowed value, in the game's order.
Returns List<Direction>
withDefault(Direction)
public BlockProperty.DirectionProperty withDefault(Direction value)
Since 0.1.0-alpha.4 or earlier
The same property with another default.
| Parameter | Type | Description |
|---|---|---|
value | Direction | — |
Returns BlockProperty.DirectionProperty
name()
public String name()
Since 0.1.0-alpha.4 or earlier
Property name used in blockstate files and commands.
Returns String
defaultValue()
public Direction defaultValue()
Since 0.1.0-alpha.4 or earlier
Value of the block's default state.
Returns Direction
BlockProperty.IntegerProperty
record · Since 0.1.0-alpha.4 or earlier
public static record IntegerProperty(String name, int min, int max, Integer defaultValue) implements BlockProperty<Integer>
An integer property.
| Component | Type | Description |
|---|---|---|
name | String | — |
min | int | — |
max | int | — |
defaultValue | Integer | — |
Supertypes: BlockProperty
values()
public List<Integer> values()
Since 0.1.0-alpha.4 or earlier
Every allowed value, in the game's order.
Returns List<Integer>
withDefault(int)
public BlockProperty.IntegerProperty withDefault(int value)
Since 0.1.0-alpha.4 or earlier
The same property with another default.
| Parameter | Type | Description |
|---|---|---|
value | int | — |
Returns BlockProperty.IntegerProperty
name()
public String name()
Since 0.1.0-alpha.4 or earlier
Property name used in blockstate files and commands.
Returns String
defaultValue()
public Integer defaultValue()
Since 0.1.0-alpha.4 or earlier
Value of the block's default state.
Returns Integer
BlockProperty.Names
class · Since 0.1.0-alpha.4 or earlier
public static final class Names
Name validation shared by the property records.
BlockStateView
interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier
public interface BlockStateView
A block together with the values of its properties; an immutable snapshot.
block()
ResourceId block()
Since 0.1.0-alpha.4 or earlier
The block, for example minecraft:furnace.
Returns ResourceId
has(BlockProperty<?>)
boolean has(BlockProperty<?> property)
Since 0.1.0-alpha.4 or earlier
Whether the block has a property with this name and value type.
| Parameter | Type | Description |
|---|---|---|
property | BlockProperty<?> | — |
Returns boolean
get(BlockProperty<T>)
<T> T get(BlockProperty<T> property)
Since 0.1.0-alpha.4 or earlier
The property's value.
| Parameter | Type | Description |
|---|---|---|
property | BlockProperty<T> | — |
Returns T
Throws IllegalArgumentException — when the block has no such property
find(BlockProperty<T>)
default <T> Optional<T> find(BlockProperty<T> property)
Since 0.1.0-alpha.4 or earlier
The property's value, or empty when the block has no such property.
| Parameter | Type | Description |
|---|---|---|
property | BlockProperty<T> | — |
Returns Optional<T>
with(BlockProperty<T>, T)
<T> BlockStateView with(BlockProperty<T> property, T value)
Since 0.1.0-alpha.4 or earlier
This state with one property changed; this snapshot stays as it is. It does not change the world: use WorldView.setProperty for that.
| Parameter | Type | Description |
|---|---|---|
property | BlockProperty<T> | — |
value | T | — |
Returns BlockStateView
Throws IllegalArgumentException — when the block has no such property or the value is not allowed