Interface BlockSnapshot

    • Method Detail

      • withState

        BlockSnapshot withState​(BlockState blockState)
        Creates a copy of the BlockSnapshot with the provided BlockState. Any additional data associated with a BlockEntity or custom data may be lost.

        Note: all custom data, including implementation detailed data relating to any and all BlockEntity instances that was included in this snapshot will NOT copy over to the new snapshot.

        blockState - The block state
        The new snapshot
      • restore

        boolean restore​(boolean force,
                        BlockChangeFlag flag)
        Restores the BlockSnapshot to the ServerLocation stored within the snapshot. If the ServerLocation 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 BlockTypes 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.
        True if the restore was successful, false otherwise
      • creator

        java.util.Optional<java.util.UUID> creator()
        Gets the UUID, if available, of the user who created this BlockSnapshot.
        The UUID if available
      • notifier

        java.util.Optional<java.util.UUID> notifier()
        Gets the UUID, if available, of the user who last notified this BlockSnapshot.
        The UUID if available
      • createArchetype

        java.util.Optional<BlockEntityArchetype> createArchetype()
        Creates a new BlockEntityArchetype for use with Schematics and placing the archetype in multiple locations.

        If this blocksnapshot does not contain a block entity then this will return Optional.empty().

        The created archetype for re-creating this block entity