public interface BlockSnapshot extends LocatableSnapshot<BlockSnapshot>
BlockState
and any extra data that
may be associated with it, including TileEntity
related data.Modifier and Type | Interface and Description |
---|---|
static interface |
BlockSnapshot.Builder |
Modifier and Type | Field and Description |
---|---|
static BlockSnapshot |
NONE
Represents a
BlockSnapshot with the default state of
BlockTypes.AIR and a Location that cannot be determined. |
Modifier and Type | Method and Description |
---|---|
static BlockSnapshot.Builder |
builder()
Creates a
BlockSnapshot.Builder to get BlockSnapshot s. |
Optional<TileEntityArchetype> |
createArchetype()
Creates a new
TileEntityArchetype for use with Schematic s
and placing the archetype in multiple locations. |
Optional<UUID> |
getCreator()
Gets the
UUID , if available, of the user who created this
BlockSnapshot . |
BlockState |
getExtendedState()
Gets the extended
BlockState . |
Optional<UUID> |
getNotifier()
Gets the
UUID , if available, of the user who last notified this
BlockSnapshot . |
BlockState |
getState()
Gets the
BlockState . |
boolean |
restore(boolean force,
BlockChangeFlag flag)
Restores the
BlockSnapshot to the Location stored within
the snapshot. |
BlockSnapshot |
withContainer(DataContainer container)
Creates a copy of the
BlockSnapshot with the provided
DataContainer . |
BlockSnapshot |
withState(BlockState blockState)
Creates a copy of the
BlockSnapshot with the provided
BlockState . |
getLocation, getPosition, getWorldUniqueId, withLocation
getManipulators
getContentVersion, toContainer
getApplicableProperties, getProperty
get, getContainers, getOrCreate, merge, merge, supports, transform, with, with, with, with, without
static final BlockSnapshot NONE
BlockSnapshot
with the default state of
BlockTypes.AIR
and a Location
that cannot be determined.static BlockSnapshot.Builder builder()
BlockSnapshot.Builder
to get BlockSnapshot
s.BlockState getState()
BlockState
.BlockState getExtendedState()
BlockState
. This applies extended properties
that are usually located around the associated BlockType
. Check
BlockState.withExtendedProperties(Location)
for more info.BlockSnapshot withState(BlockState blockState)
BlockSnapshot
with the provided
BlockState
. Any additional data associated with a
TileEntity
or custom data may be lost.
Note: all custom data, including implementation detailed
data relating to any and all TileEntity
instances that
was included in this snapshot will NOT copy over to the new
snapshot.
blockState
- The block stateBlockSnapshot withContainer(DataContainer container)
BlockSnapshot
with the provided
DataContainer
. Note that this is equal to calling
DataBuilder.build(DataView)
. All data is
validated andcontainer
- The data containerboolean restore(boolean force, BlockChangeFlag flag)
BlockSnapshot
to the Location
stored within
the snapshot. If the Location
is not available, the snapshot will
not be restored.
If forced, the state of the block will change its BlockType
to match that of the snapshot then set the state. However, if force is
set to false and the BlockType
s does not match, false will be
returned.
If notifyNeighbors is true, neighboring blocks will be notified of
changes at the restored block location triggering physic updates.
force
- If true, forces block state to be set even if the
BlockType
does not match the snapshot one.flag
- The block change flags to determine whether neighbors are
notified, block physics performed, etc.Optional<UUID> getCreator()
UUID
, if available, of the user who created this
BlockSnapshot
.UUID
if availableOptional<UUID> getNotifier()
UUID
, if available, of the user who last notified this
BlockSnapshot
.UUID
if availableOptional<TileEntityArchetype> createArchetype()
TileEntityArchetype
for use with Schematic
s
and placing the archetype in multiple locations.
If this blocksnapshot does not contain a tile entity then this will
return Optional.empty()
.