Package com.sk89q.worldedit.world.block
Class BaseBlock
java.lang.Object
com.sk89q.worldedit.world.block.BaseBlock
- All Implemented Interfaces:
TileEntityBlock
,Pattern
,BlockStateHolder<BaseBlock>
,NbtValued
- Direct Known Subclasses:
LegacyBaseBlockWrapper
Represents a "snapshot" of a block with NBT Data.
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.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BaseBlock
(BlockState blockState) Construct a block with a state.protected
BaseBlock
(BlockState state, CompoundTag nbtData) Deprecated.protected
BaseBlock
(BlockState state, LazyReference<org.enginehub.linbus.tree.LinCompoundTag> nbtData) Construct a block with the given ID, data value and NBT data structure. -
Method Summary
Modifier and TypeMethodDescriptionboolean
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.Get the block type.getNbtId()
Return the name of the title entity ID.LazyReference<org.enginehub.linbus.tree.LinCompoundTag>
Get the object's NBT data (tile entity data).<V> V
Gets the State for this Block.Gets a map of state to state values.int
hashCode()
void
setNbtReference
(LazyReference<org.enginehub.linbus.tree.LinCompoundTag> nbtData) Set the object's NBT data (tile entity data).Gets aBaseBlock
from this BlockStateHolder.toBaseBlock
(LazyReference<org.enginehub.linbus.tree.LinCompoundTag> compoundTag) Gets aBaseBlock
from this BlockStateHolder.Returns an immutableBlockState
from this BlockStateHolder.toString()
<V> BaseBlock
Returns a BlockState with the given state and value applied.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
applyBlock, getAsString, toBaseBlock, toBaseBlock
Methods inherited from interface com.sk89q.worldedit.world.NbtValued
getNbt, getNbtData, hasNbtData, setNbt, setNbtData
-
Constructor Details
-
BaseBlock
Construct a block with a state.- Parameters:
blockState
- The blockstate
-
BaseBlock
Deprecated.Construct a block with the given ID, data value and NBT data structure.- Parameters:
state
- The block statenbtData
- NBT data, which must be provided
-
BaseBlock
protected BaseBlock(BlockState state, LazyReference<org.enginehub.linbus.tree.LinCompoundTag> nbtData) Construct a block with the given ID, data value and NBT data structure.- Parameters:
state
- The block statenbtData
- NBT data, which must be provided
-
-
Method Details
-
getStates
Gets a map of state to state values.- Specified by:
getStates
in interfaceBlockStateHolder<BaseBlock>
- Returns:
- The state map
-
getBlockType
Description copied from interface:BlockStateHolder
Get the block type.- Specified by:
getBlockType
in interfaceBlockStateHolder<BaseBlock>
- Returns:
- The type
-
with
Description copied from interface:BlockStateHolder
Returns a BlockState with the given state and value applied.- Specified by:
with
in interfaceBlockStateHolder<BaseBlock>
- Parameters:
property
- The statevalue
- The value- Returns:
- The modified state, or same if could not be applied
-
getState
Gets the State for this Block.- Specified by:
getState
in interfaceBlockStateHolder<BaseBlock>
- Parameters:
property
- The state to get the value for- Returns:
- The state value
-
getNbtId
Description copied from interface:TileEntityBlock
Return the name of the title entity ID.- Specified by:
getNbtId
in interfaceTileEntityBlock
- Returns:
- tile entity ID, non-null string
-
getNbtReference
Description copied from interface:NbtValued
Get the object's NBT data (tile entity data).This only needs to be used if you don't want to immediately resolve the data. Otherwise, you probably want
NbtValued.getNbt()
.Note: This method may be non-null while
NbtValued.getNbt()
returnsnull
. Do NOT rely on this method to determine whether the object has NBT data.- Specified by:
getNbtReference
in interfaceNbtValued
- Returns:
- compound tag, or null
-
setNbtReference
public void setNbtReference(@Nullable LazyReference<org.enginehub.linbus.tree.LinCompoundTag> nbtData) Description copied from interface:NbtValued
Set the object's NBT data (tile entity data).- Specified by:
setNbtReference
in interfaceNbtValued
- Parameters:
nbtData
- NBT data, or null if no data
-
equals
Checks whether the type ID and data value are equal. -
equalsFuzzy
Checks if the type is the same, and if the matched states are the same.- Specified by:
equalsFuzzy
in interfaceBlockStateHolder<BaseBlock>
- 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<BaseBlock>
- Returns:
- A BlockState
-
toBaseBlock
Description copied from interface:BlockStateHolder
Gets aBaseBlock
from this BlockStateHolder.- Specified by:
toBaseBlock
in interfaceBlockStateHolder<BaseBlock>
- Returns:
- The BaseBlock
-
toBaseBlock
Description copied from interface:BlockStateHolder
Gets aBaseBlock
from this BlockStateHolder.- Specified by:
toBaseBlock
in interfaceBlockStateHolder<BaseBlock>
- Parameters:
compoundTag
- The NBT Data to apply- Returns:
- The BaseBlock
-
hashCode
public int hashCode() -
toString
-