Package com.sk89q.worldedit.world.block
Class BlockState
java.lang.Object
com.sk89q.worldedit.world.block.BlockState
- All Implemented Interfaces:
Filter
,TileEntityBlock
,Pattern
,BlockStateHolder<BlockState>
,NbtValued
- Direct Known Subclasses:
FuzzyBlockState
An immutable class that represents the state a block can be in.
-
Constructor Summary
ConstructorsConstructorDescriptionBlockState
(BlockType blockType, int internalId, int ordinal) BlockState
(BlockType blockType, int internalId, int ordinal, CompoundTag tile) -
Method Summary
Modifier and TypeMethodDescriptionboolean
apply
(Extent extent, BlockVector3 get, BlockVector3 set) applyBlock
(BlockVector3 position) Return aBaseBlock
for the given position.void
applyTileEntity
(OutputExtent output, int x, int y, int z) boolean
boolean
equalsFuzzy
(BlockStateHolder<?> o) Checks if the type is the same, and if the matched states are the same.static BlockState
Returns a temporary BlockState for a given type and string.static BlockState
get
(BlockType type, String state, BlockState defaultState) Returns a temporary BlockState for a given type and string.static BlockState
Returns a temporary BlockState for a given type and string.Get the block type.static BlockState
getFromInternalId
(int combinedId) Deprecated.Magic Numbersstatic BlockState
getFromOrdinal
(int ordinal) Deprecated.final int
Deprecated.int
Get combined id (legacy uses).final int
Deprecated.Deprecated.final int
final char
<V> V
getState
(PropertyKey key) Deprecated.<V> V
Gets the value for the given state.Gets an immutable collection of the states.int
hashCode()
boolean
isAir()
Gets aBaseBlock
from this BlockStateHolder.toBaseBlock
(ITileInput input, int x, int y, int z) toBaseBlock
(LazyReference<com.sk89q.worldedit.util.nbt.CompoundBinaryTag> compoundTag) Gets aBaseBlock
from this BlockStateHolder.Returns an immutableBlockState
from this BlockStateHolder.toMask()
toString()
<V> BlockState
with
(PropertyKey property, V value) Returns a BlockStateHolder with the given state and value applied.<V> BlockState
Returns a BlockState with the given state and value applied.<V> BlockState
withProperties
(BlockState other) withPropertyId
(int propertyId) Magic number (legacy uses).Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.sk89q.worldedit.world.block.BlockStateHolder
getAsString, toBaseBlock, toBaseBlock
Methods inherited from interface com.fastasyncworldedit.core.queue.Filter
appliesChunk, appliesLayer, applyChunk, finishChunk, fork, join
Methods inherited from interface com.sk89q.worldedit.world.NbtValued
getNbt, getNbtReference, hasNbtData, setNbt, setNbtData, setNbtReference
Methods inherited from interface com.sk89q.worldedit.function.pattern.Pattern
apply, applyBlock
Methods inherited from interface com.sk89q.worldedit.blocks.TileEntityBlock
getNbtId
-
Constructor Details
-
BlockState
-
BlockState
-
-
Method Details
-
getFromInternalId
Deprecated.Magic NumbersReturns a temporary BlockState for a given internal id.- Returns:
- BlockState
- Throws:
InputParseException
-
getFromOrdinal
Deprecated. -
get
Returns a temporary BlockState for a given type and string.- Parameters:
state
- String e.g., minecraft:water[level=4]- Returns:
- BlockState
- Throws:
InputParseException
-
get
Returns a temporary BlockState for a given type and string.It's faster if a BlockType is provided compared to parsing the string.
- Parameters:
type
- BlockType e.g., BlockTypes.STONE (or null)state
- String e.g., minecraft:water[level=4]- Returns:
- BlockState
- Throws:
InputParseException
-
get
public static BlockState get(@Nullable BlockType type, String state, BlockState defaultState) throws InputParseException Returns a temporary BlockState for a given type and string.It's faster if a BlockType is provided compared to parsing the string.
- Parameters:
type
- BlockType e.g., BlockTypes.STONE (or null)state
- String e.g., minecraft:water[level=4]- Returns:
- BlockState
- Throws:
InputParseException
-
withPropertyId
Description copied from interface:BlockStateHolder
Magic number (legacy uses).- Specified by:
withPropertyId
in interfaceBlockStateHolder<BlockState>
-
apply
- Specified by:
apply
in interfacePattern
- Throws:
WorldEditException
-
applyBlock
Description copied from interface:Pattern
Return aBaseBlock
for the given position.- Specified by:
applyBlock
in interfaceBlockStateHolder<BlockState>
- Specified by:
applyBlock
in interfacePattern
- Parameters:
position
- the position- Returns:
- a block
-
toMask
-
applyTileEntity
- Specified by:
applyTileEntity
in interfaceBlockStateHolder<BlockState>
-
getInternalPropertiesId
Deprecated.The internal id with no type information.- Specified by:
getInternalPropertiesId
in interfaceBlockStateHolder<BlockState>
-
getInternalBlockTypeId
Deprecated.Description copied from interface:BlockStateHolder
Get type id (legacy uses).- Specified by:
getInternalBlockTypeId
in interfaceBlockStateHolder<BlockState>
-
with
Description copied from interface:BlockStateHolder
Returns a BlockState with the given state and value applied.- Specified by:
with
in interfaceBlockStateHolder<BlockState>
- Parameters:
property
- The statevalue
- The value- Returns:
- The modified state, or same if could not be applied
-
getState
Description copied from interface:BlockStateHolder
Gets the value for the given state.- Specified by:
getState
in interfaceBlockStateHolder<BlockState>
- Parameters:
property
- The state- Returns:
- The value
-
with
Description copied from interface:BlockStateHolder
Returns a BlockStateHolder with the given state and value applied.- Specified by:
with
in interfaceBlockStateHolder<BlockState>
- Parameters:
property
- The property keyvalue
- The value- Returns:
- The modified state, or same if could not be applied
-
withProperties
-
getStates
Description copied from interface:BlockStateHolder
Gets an immutable collection of the states.- Specified by:
getStates
in interfaceBlockStateHolder<BlockState>
- Returns:
- The states
-
getBlockType
Description copied from interface:BlockStateHolder
Get the block type.- Specified by:
getBlockType
in interfaceBlockStateHolder<BlockState>
- Returns:
- The type
-
equalsFuzzy
Description copied from interface:BlockStateHolder
Checks if the type is the same, and if the matched states are the same.- Specified by:
equalsFuzzy
in interfaceBlockStateHolder<BlockState>
- Parameters:
o
- other block- Returns:
- true if equal
-
toImmutableState
Description copied from interface:BlockStateHolder
Returns an immutableBlockState
from this BlockStateHolder.- Specified by:
toImmutableState
in interfaceBlockStateHolder<BlockState>
- Returns:
- A BlockState
-
toBaseBlock
Description copied from interface:BlockStateHolder
Gets aBaseBlock
from this BlockStateHolder.- Specified by:
toBaseBlock
in interfaceBlockStateHolder<BlockState>
- Returns:
- The BaseBlock
-
getState
Deprecated.Description copied from interface:BlockStateHolder
Gets the value for the given state.- Specified by:
getState
in interfaceBlockStateHolder<BlockState>
- Parameters:
key
- The state- Returns:
- The value
-
getNbtData
Deprecated.Description copied from interface:NbtValued
Get the object's NBT data (tile entity data). The returned tag, if modified in any way, should be sent toNbtValued.setNbtData(CompoundTag)
so that the instance knows of the changes. Making changes without callingNbtValued.setNbtData(CompoundTag)
could have unintended consequences.NbtValued.hasNbtData()
must return true if and only if method does not return null.- Specified by:
getNbtData
in interfaceNbtValued
- Returns:
- compound tag, or null
-
toBaseBlock
public BaseBlock toBaseBlock(LazyReference<com.sk89q.worldedit.util.nbt.CompoundBinaryTag> compoundTag) Description copied from interface:BlockStateHolder
Gets aBaseBlock
from this BlockStateHolder.- Specified by:
toBaseBlock
in interfaceBlockStateHolder<BlockState>
- Parameters:
compoundTag
- The NBT Data to apply- Returns:
- The BaseBlock
This must be overridden by new subclasses. See
NonAbstractForCompatibility
for details
-
getInternalId
public int getInternalId()Description copied from interface:BlockStateHolder
Get combined id (legacy uses).- Specified by:
getInternalId
in interfaceBlockStateHolder<BlockState>
-
getMaterial
- Specified by:
getMaterial
in interfaceBlockStateHolder<BlockState>
-
getOrdinal
public final int getOrdinal()- Specified by:
getOrdinal
in interfaceBlockStateHolder<BlockState>
-
getOrdinalChar
public final char getOrdinalChar()- Specified by:
getOrdinalChar
in interfaceBlockStateHolder<BlockState>
-
hashCode
public int hashCode() -
isAir
public boolean isAir() -
toBaseBlock
- Specified by:
toBaseBlock
in interfaceBlockStateHolder<BlockState>
-
toString
-
equals
-