Blockbench
NativeGlobals
Global Variable
Type: See types
Provides access to global Javascript/DOM variables that are overwritten by Blockbench's own variables
Blockbench
Namespace
Property | Type | Description |
---|---|---|
platform | "web" or "win32" or "darwin" or "linux" | |
version | string | Blockbench version number |
queries | See types or undefined | URL queries when opened as web app using a link that contained queries |
openTime | Date | Time when Blockbench was opened |
reload()
Reloads the Blockbench window
isNewerThan( version )
checks if Blockbench is newer than the specified version
Arguments:
version
: string - semver string
Returns: boolean
isOlderThan( version )
checks if Blockbench is older than the specified version
Arguments:
version
: string - semver string
Returns: boolean
getIconNode( icon[, color] )
Resolves an icon string as a HTML element
Arguments:
icon
: string - Material Icons, Fontawesome or custom icon stringcolor
: string (Optional) - CSS color
Returns: HTMLElement
showQuickMessage( message[, time] )
Shows a passing message in the middle of the screen
Arguments:
message
: string - Messagetime
: number (Optional) - Time in miliseconds that the message stays up
showStatusMessage( message[, time] )
Arguments:
message
: stringtime
: number (Optional)
setStatusBarText( [text] )
Arguments:
text
: string (Optional)
setCursorTooltip( [text] )
Display a tooltip displaying a custom text that appears next to and follows the mouse cursor
Arguments:
text
: string (Optional) - The text to display. Line breaks are supported. Leave empty to hide the tooltip.
setProgress( progress[, time, bar] )
Set the value of a progress bar
Arguments:
progress
: number - Progress of the bar between 0 and 1time
: number (Optional) - Time over which the bar is animated, in milisecondsbar
: string (Optional) - ID of the bar element. If omitted, the main status bar will be selected
showMessageBox( options[, callback] )
Opens a message box
Arguments:
options
: MessageBoxOptionsconfirm
: number (Optional) - Index of the confirm button within the buttons arraycancel
: number (Optional) - Index of the cancel button within the buttons arraybuttons
: Array of string (Optional)translateKey
: string (Optional)title
: string (Optional)message
: string (Optional)icon
: string (Optional)width
: number (Optional)commands
: See types (Optional) - Display a list of actions to do in the dialog. When clicked, the message box closes with the string ID of the command as first argument.checkboxes
: See types (Optional) - Adds checkboxes to the bottom of the message box
callback
: See types (Optional)
textPrompt( title, value, callback )
Arguments:
title
: stringvalue
: stringcallback
: See types
showToastMessage()
todo
Returns: Deletable
openLink( link )
Opens the specified link in the browser or in a new tab
Arguments:
link
: string
notification( title, text[, icon] )
Shows a system notification
Arguments:
title
: string - Titletext
: string - Texticon
: string (Optional) - Url or data url pointing to an icon. Defaults to Blockbench icon
addFlag( flag )
Arguments:
flag
: string
removeFlag( flag )
Arguments:
flag
: string
hasFlag( flag )
Arguments:
flag
: string
Returns: boolean
dispatchEvent( event_name[, data] )
Dispatches a Blockbench event.
If you're using TypeScript, You can call this with the type param
Blockbench.dispatchEvent<EventName>(...)
Arguments:
event_name
: Edata
: any (Optional)
addListener( event_names, callback )
Adds a listener to a Blockbench event.
If you're using TypeScript, You can call this with the type param
Blockbench.addListener<EventName>(...)
Arguments:
on( event_names, callback )
Adds a listener to a Blockbench event.
If you're using TypeScript, You can call this with the type param
Blockbench.on<EventName>(...)
Arguments:
removeListener( event_names, callback )
Removes a listener from a Blockbench event.
If you're using TypeScript, You can call this with the type param
Blockbench.removeListener<EventName>(...)
Arguments:
findFileFromContent( base_directories, options, check_file )
Find a file in a directory, based on content. Optimized by prioritizing files with certain names.
Arguments:
base_directories
: Array of string - Base directories to search inoptions
: FindFileFromContentOptions - Optionscheck_file
: CheckFileCallback - Function that runs on every file to check if the file is a match. If the function returns anything truthy, that result is returned by the main function.
Returns: false
or any
read( files[, options, callback] )
Reads the content from the specified files. Desktop app only.
Arguments:
files
: Array of stringoptions
: ReadOptions (Optional)callback
: See types (Optional)
read( files[, options, callback] )
Reads the content from the specified files. Desktop app only.
Arguments:
files
: Array of stringoptions
: ReadOptions (Optional)callback
: See types (Optional)
readFile( files[, options, callback] )
Reads the content from the specified files. Desktop app only.
Arguments:
files
: Array of stringoptions
: ReadOptions (Optional)callback
: See types (Optional)
readFile( files[, options, callback] )
Reads the content from the specified files. Desktop app only.
Arguments:
files
: Array of stringoptions
: ReadOptions (Optional)callback
: See types (Optional)
writeFile( file_path, options[, callback] )
Writes a file to the file system. Desktop app only.
Arguments:
file_path
: stringoptions
: WriteOptionscallback
: See types (Optional)
writeFile( file_path, options[, callback] )
Writes a file to the file system. Desktop app only.
Arguments:
file_path
: stringoptions
: WriteOptionscontent
: string or ArrayBuffer (Optional)savetype
: WriteType or See types (Optional)custom_writer
: Function (Optional)
callback
: See types (Optional)
pickDirectory( options )
Pick a directory. Desktop app only.
Arguments:
options
: PickDirOptions
Returns: string or undefined
pickDirectory( options )
Pick a directory. Desktop app only.
Arguments:
options
: PickDirOptionsstartpath
: string (Optional) - Location where the file dialog starts offresource_id
: string (Optional) - The resource identifier group, used to allow the file dialog (open and save) to remember where it was last usedtitle
: string (Optional) - Window title for the file picker
Returns: any
import( options[, callback] )
@ts-ignore
Arguments:
options
: ImportOptionscallback
: See types (Optional)
Returns: any
export( options[, callback] )
Arguments:
options
: ExportOptionscallback
: See types (Optional)
Returns: any
addDragHandler( id, options[, callback] )
Arguments:
id
: stringoptions
: DragHandlerOptionscallback
: See types (Optional)
Returns: Deletable
addDragHandler( id, options[, callback] )
Adds a drag handler that handles dragging and dropping files into Blockbench
Arguments:
id
: stringoptions
: DragHandlerOptionsreadtype
: ReadType or See types (Optional)errorbox
: boolean (Optional)extensions
: Array of string or See types - Allowed file extensionscondition
: ConditionResolvable (Optional) - Whether or not to enable the drag handlerelement
: string or HTMLElement or See types (Optional) - Drop target elementpropagate
: boolean (Optional) - If true, the drop will work on all child elements of the specified element
callback
: See types (Optional)
Returns: Deletable
removeDragHandler( id )
Arguments:
id
: string
removeDragHandler( id )
Arguments:
id
: string
showToastNotification( options )
Arguments:
options
: ToastNotificationOptionstext
: stringicon
: string (Optional)expire
: number (Optional)color
: string (Optional)click
: See types (Optional)
Returns: Deletable
addCSS( css )
Arguments:
css
: string
addCSS( css )
Adds custom CSS code to Blockbench, globally. Returns an object that is deletable
Arguments:
css
: string - CSS string
Returns: Deletable
FindFileFromContentOptions
Interface
CheckFileCallback
Type alias
Outliner
Variable
OutlinerNode
Variable
OutlinerElement
Variable
Group
Variable
Cube
Variable
Mesh
Variable
Locator
Variable
NullObject
Variable
TextureMesh
Variable
Face
Variable
CubeFace
Variable
MeshFace
Variable
NodePreviewController
Variable
Collection
Variable
Animator
Variable
Timeline
Variable
AnimationItem
Variable
Animation
Variable
AnimationController
Variable
Keyframe
Variable
KeyframeDataPoint
Variable
BoneAnimator
Variable
NullObjectAnimator
Variable
EffectAnimator
Variable
TimelineMarker
Variable
Panel
Variable
Mode
Variable
Dialog
Variable
Setting
Variable
Plugin
Variable
Preview
Variable
Toolbar
Variable
Language
Variable
Painter
Variable
Screencam
Variable
Settings
Variable
TextureAnimator
Variable
Toolbox
Variable
BarItems
Variable
BarItem
Variable
Action
Variable
Tool
Variable
Toggle
Variable
Widget
Variable
BarSelect
Variable
BarSlider
Variable
BarText
Variable
NumSlider
Variable
ColorPicker
Variable
Keybind
Variable
KeybindItem
Variable
Menu
Variable
BarMenu
Variable
ResizeLine
Variable
ModelProject
Variable
ModelFormat
Variable
Codec
Variable
DisplaySlot
Variable
Reusable
Variable
Texture
Variable