public class BaseBlock extends java.lang.Object implements BlockStateHolder<BaseBlock>, TileEntityBlock
An instance of this block contains all the information needed to accurately reproduce the block, provided that the instance was made correctly. In some implementations, it may not be possible to get a snapshot of blocks correctly, so, for example, the NBT data for a block may be missing.
Modifier | Constructor and Description |
---|---|
protected |
BaseBlock(BlockState blockState)
Construct a block with a state.
|
protected |
BaseBlock(BlockState state,
CompoundTag nbtData)
Deprecated.
|
protected |
BaseBlock(BlockState state,
LazyReference<com.sk89q.worldedit.util.nbt.CompoundBinaryTag> nbtData)
Construct a block with the given ID, data value and NBT data structure.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o)
Checks whether the type ID and data value are equal.
|
boolean |
equalsFuzzy(BlockStateHolder<?> o)
Checks if the type is the same, and if the matched states are the same.
|
BlockType |
getBlockType()
Get the block type.
|
java.lang.String |
getNbtId()
Return the name of the title entity ID.
|
LazyReference<com.sk89q.worldedit.util.nbt.CompoundBinaryTag> |
getNbtReference()
Get the object's NBT data (tile entity data).
|
<V> V |
getState(Property<V> property)
Gets the State for this Block.
|
java.util.Map<Property<?>,java.lang.Object> |
getStates()
Gets a map of state to state values.
|
int |
hashCode() |
void |
setNbtReference(LazyReference<com.sk89q.worldedit.util.nbt.CompoundBinaryTag> nbtData)
Set the object's NBT data (tile entity data).
|
BaseBlock |
toBaseBlock()
Gets a
BaseBlock from this BlockStateHolder. |
BaseBlock |
toBaseBlock(LazyReference<com.sk89q.worldedit.util.nbt.CompoundBinaryTag> compoundTag)
Gets a
BaseBlock from this BlockStateHolder. |
BlockState |
toImmutableState()
Returns an immutable
BlockState from this BlockStateHolder. |
java.lang.String |
toString() |
<V> BaseBlock |
with(Property<V> property,
V value)
Returns a BlockState with the given state and value applied.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
applyBlock, getAsString, toBaseBlock, toBaseBlock
getNbt, getNbtData, hasNbtData, setNbt, setNbtData
protected BaseBlock(BlockState blockState)
blockState
- The blockstate@Deprecated protected BaseBlock(BlockState state, CompoundTag nbtData)
state
- The block statenbtData
- NBT data, which must be providedprotected BaseBlock(BlockState state, LazyReference<com.sk89q.worldedit.util.nbt.CompoundBinaryTag> nbtData)
state
- The block statenbtData
- NBT data, which must be providedpublic java.util.Map<Property<?>,java.lang.Object> getStates()
getStates
in interface BlockStateHolder<BaseBlock>
public BlockType getBlockType()
BlockStateHolder
getBlockType
in interface BlockStateHolder<BaseBlock>
public <V> BaseBlock with(Property<V> property, V value)
BlockStateHolder
with
in interface BlockStateHolder<BaseBlock>
property
- The statevalue
- The valuepublic <V> V getState(Property<V> property)
getState
in interface BlockStateHolder<BaseBlock>
property
- The state to get the value forpublic java.lang.String getNbtId()
TileEntityBlock
getNbtId
in interface TileEntityBlock
@Nullable public LazyReference<com.sk89q.worldedit.util.nbt.CompoundBinaryTag> getNbtReference()
NbtValued
This only needs to be used if you don't want to immediately resolve the data.
Otherwise, you probably want NbtValued.getNbt()
.
getNbtReference
in interface NbtValued
public void setNbtReference(@Nullable LazyReference<com.sk89q.worldedit.util.nbt.CompoundBinaryTag> nbtData)
NbtValued
setNbtReference
in interface NbtValued
nbtData
- NBT data, or null if no datapublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public boolean equalsFuzzy(BlockStateHolder<?> o)
equalsFuzzy
in interface BlockStateHolder<BaseBlock>
o
- other blockpublic BlockState toImmutableState()
BlockStateHolder
BlockState
from this BlockStateHolder.toImmutableState
in interface BlockStateHolder<BaseBlock>
public BaseBlock toBaseBlock()
BlockStateHolder
BaseBlock
from this BlockStateHolder.toBaseBlock
in interface BlockStateHolder<BaseBlock>
public BaseBlock toBaseBlock(LazyReference<com.sk89q.worldedit.util.nbt.CompoundBinaryTag> compoundTag)
BlockStateHolder
BaseBlock
from this BlockStateHolder.toBaseBlock
in interface BlockStateHolder<BaseBlock>
compoundTag
- The NBT Data to applypublic int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object