Brushes
Step-by-step instructions on how to make a brush for the Brush Tool:
-
Make a new item modifier for selecting your brush.
Example of a brush item modifier:
[
{
"function": "minecraft:set_nbt",
"tag": "{WorldTool:{Brush:\"myplugin:example\",BrushSettings:{Requires:[\"block\",\"area\"],MaxSize:39}}}"
},
{
"function": "minecraft:set_lore",
"lore": [
{"nbt":"Translation.\"myplugin.lore.selected_brush.example\"","storage": "worldtool:storage","color": "yellow","italic": false},
{"nbt":"Translation.\"lore.selected_block\"","storage": "worldtool:storage","color": "light_purple","italic": false},
{"nbt":"SelectedItem.tag.WorldTool.PrimaryBlock.State.Name", "entity": "@s","italic": false},
"",
{"nbt":"Translation.\"lore.brush.1\"","storage": "worldtool:storage","interpret": true,"italic": false},
{"nbt":"Translation.\"lore.brush.2\"","storage": "worldtool:storage","interpret": true,"italic": false}
],
"entity": "this",
"replace": true
}
]The parts you need to pay attention to are:
- The
Brush
ID. - The
Requires
list, which specifies what the brush needs to use. The available requirements areblock
andarea
. - The first translation in the
"lore"
list.
- The
-
Make a new function for running when your brush is selected.
Example of a brush selection function:
# Called by worldtool:ui_brush/select_brush/menu
# Example of a brush selection function
# This is used to make sure the user is holding the Brush Tool
function worldtool:ui_brush/check_tool
# Call your item modifier
item modify entity @s weapon.mainhand myplugin:example_brush
function worldtool:ui/sound.change_item
# Options you want to change when your brush is selected
item modify entity @s weapon.mainhand worldtool:brush_tool/settings/before_block/off
#(...)
# Go back to the main Brush Tool menu
function worldtool:ui_brush/menu -
Make a new predicate for checking when your brush is selected.
Example of a brush predicate:
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"equipment": {
"mainhand": {
"nbt": "{WorldTool:{Brush:\"myplugin:example\"}}"
}
}
}
} -
Use the
ui_brush/brush_list
hook to display a button for your brush, which when clicked calls the function you made for it. Use the predicate you made to display a grayed out button when the brush is already selected. -
Use the
ui_brush/menu/add_tags
hook to remove or add the settings you want to have available in the menu. The full list of tags is:
wt.setting.brush_size
(Default = available)
wt.setting.hollow
(Default = unavailable)
wt.setting.overwrite
(Default = unavailable)
wt.setting.structure
(Default = unavailable)
wt.setting.before_block
(Default = available)
wt.setting.structure
(Default = unavailable)
wt.setting.structure_rotation
(Default = unavailable)
wt.setting.structure_mirror
(Default = unavailable)
wt.setting.structure_offset
(Default = unavailable)
wt.setting.greenery_rate
(Default = unavailable)
wt.setting.remove_current_greenery
(Default = unavailable)
wt.setting.flat
(Default = unavailable)
wt.setting.axis
(Default = unavailable)
wt.setting.update_block
(Default = available)
wt.brush_selections.normal
(Default = available)
-
Use the
process_start/brush/start
hook to check if your brush is selected with its predicate, and if so, run a function to use the brush. If you want to use a process for it, call theworldtool:process_start/brush/start/normal/start
function and proceed to the next step. If not, this is the end of the instructions. -
Make another function, to set up your brush process.
# Example of a process setup function
# Tell the function that sets up all the processes that everything is alright
scoreboard players set #success worldtool 1
data modify storage worldtool:storage Processes prepend value {DisplayName:'{"nbt":"Translation.\\"myplugin.process.brush.example\\"","storage":"worldtool:storage"}',ID:"myplugin:example",Tags:["myplugin.process.example","wt.no_message"]}
# If you have set up blocks per tick data for this process
data modify storage worldtool:storage Processes[0].BlocksPerTick set from storage worldtool:storage BlocksPerTick.Processes[{ID:"worldtool:paint"}].Value
function worldtool:process_start/brush/start/normal/setup_process/set_process_values -
Use the
process_start/brush/normal_start/processes
hook to check if your brush is selected with its predicate, and if so, run your process setup function. -
Follow these steps to make your process work, and you're all set!