Package com.sk89q.worldedit.world.block
Class BaseBlock
java.lang.Object
com.sk89q.worldedit.world.block.BaseBlock
- All Implemented Interfaces:
Filter
,TileEntityBlock
,Pattern
,BlockStateHolder<BaseBlock>
,NbtValued
- Direct Known Subclasses:
BlanketBaseBlock
,MobSpawnerBlock
,SignBlock
,SkullBlock
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
ModifierConstructorDescriptionBaseBlock
(int id, int data) Deprecated.BaseBlock
(BlockState blockState) Construct a block with a state.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.Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionboolean
apply
(Extent extent, BlockVector3 get, BlockVector3 set) void
applyTileEntity
(OutputExtent output, int x, int y, int z) boolean
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.int
Get type id (legacy uses).int
Get combined id (legacy uses).int
Get the block data (legacy uses).getNbtId()
Return the name of the title entity ID.LazyReference<com.sk89q.worldedit.util.nbt.CompoundBinaryTag>
Get the object's NBT data (tile entity data).int
final char
static BlockState
getState
(int id, int data) <V> V
getState
(PropertyKey property) Gets the value for the given state.<V> V
Gets the State for this Block.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).Gets aBaseBlock
from this BlockStateHolder.toBaseBlock
(LazyReference<com.sk89q.worldedit.util.nbt.CompoundBinaryTag> compoundTag) Gets aBaseBlock
from this BlockStateHolder.Returns an immutableBlockState
from this BlockStateHolder.toString()
<V> BaseBlock
with
(PropertyKey property, V value) Returns a BlockStateHolder with the given state and value applied.<V> BaseBlock
Returns a BlockState with the given state and value applied.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
applyBlock, getAsString, toBaseBlock, 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, getNbtData, hasNbtData, setNbt, setNbtData
Methods inherited from interface com.sk89q.worldedit.function.pattern.Pattern
apply, applyBlock
-
Constructor Details
-
BaseBlock
Deprecated.FAWE deprecation - Just use theBlockType.getDefaultState()
Construct a block with the given type and default data.- Parameters:
blockType
- The block type
-
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<com.sk89q.worldedit.util.nbt.CompoundBinaryTag> 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
-
BaseBlock
Deprecated.Construct a block with the given ID and data value.- Parameters:
id
- ID valuedata
- data value
-
-
Method Details
-
getState
-
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()
.- Specified by:
getNbtReference
in interfaceNbtValued
- Returns:
- compound tag, or null
-
setNbtReference
public void setNbtReference(@Nullable LazyReference<com.sk89q.worldedit.util.nbt.CompoundBinaryTag> 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. -
getInternalId
public int getInternalId()Description copied from interface:BlockStateHolder
Get combined id (legacy uses).- Specified by:
getInternalId
in interfaceBlockStateHolder<BaseBlock>
-
getMaterial
- Specified by:
getMaterial
in interfaceBlockStateHolder<BaseBlock>
-
getOrdinal
public int getOrdinal()- Specified by:
getOrdinal
in interfaceBlockStateHolder<BaseBlock>
-
getOrdinalChar
public final char getOrdinalChar()- Specified by:
getOrdinalChar
in interfaceBlockStateHolder<BaseBlock>
-
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
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<BaseBlock>
- Parameters:
compoundTag
- The NBT Data to apply- Returns:
- The BaseBlock
This must be overridden by new subclasses. See
NonAbstractForCompatibility
for details
-
apply
- Specified by:
apply
in interfacePattern
- Throws:
WorldEditException
-
applyTileEntity
- Specified by:
applyTileEntity
in interfaceBlockStateHolder<BaseBlock>
-
withPropertyId
Description copied from interface:BlockStateHolder
Magic number (legacy uses).- Specified by:
withPropertyId
in interfaceBlockStateHolder<BaseBlock>
-
getInternalBlockTypeId
public int getInternalBlockTypeId()Description copied from interface:BlockStateHolder
Get type id (legacy uses).- Specified by:
getInternalBlockTypeId
in interfaceBlockStateHolder<BaseBlock>
-
getInternalPropertiesId
public int getInternalPropertiesId()Description copied from interface:BlockStateHolder
Get the block data (legacy uses).- Specified by:
getInternalPropertiesId
in interfaceBlockStateHolder<BaseBlock>
-
with
Description copied from interface:BlockStateHolder
Returns a BlockStateHolder with the given state and value applied.- Specified by:
with
in interfaceBlockStateHolder<BaseBlock>
- Parameters:
property
- The property keyvalue
- 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<BaseBlock>
- Parameters:
property
- The state- Returns:
- The value
-
toBlockState
-
hashCode
public int hashCode() -
toString
-
BlockType.getDefaultState()