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.

        Parameters:
        blockState - The block state
        Returns:
        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.

        Parameters:
        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.
        Returns:
        True if the restore was successful, false otherwise