Package baritone.api.selection
Interface ISelectionManager
public interface ISelectionManager
The selection manager handles setting Baritone's selections. You can set the selection here, as well as retrieving
the current selection.
-
Method Summary
Modifier and TypeMethodDescriptionaddSelection(ISelection selection) Adds a new selection.addSelection(BetterBlockPos pos1, BetterBlockPos pos2) Adds a newISelectionconstructed from the given block positions.contract(ISelection selection, net.minecraft.core.Direction direction, int blocks) Replaces the specifiedISelectionwith one contracted in the specified direction by the specified number of blocks.expand(ISelection selection, net.minecraft.core.Direction direction, int blocks) Replaces the specifiedISelectionwith one expanded in the specified direction by the specified number of blocks.This method will always return the last selection.For anything expecting only one selection, this method is provided.Removes all selections.removeSelection(ISelection selection) Removes the selection from the current selections.shift(ISelection selection, net.minecraft.core.Direction direction, int blocks) Replaces the specifiedISelectionwith one shifted in the specified direction by the specified number of blocks.
-
Method Details
-
addSelection
Adds a new selection. The added selection is returned.- Parameters:
selection- The new selection to add.
-
addSelection
Adds a newISelectionconstructed from the given block positions. The new selection is returned.- Parameters:
pos1- One corner of the selectionpos2- The new corner of the selection
-
removeSelection
Removes the selection from the current selections.- Parameters:
selection- The selection to remove.- Returns:
- The removed selection.
-
removeAllSelections
Removes all selections.- Returns:
- The selections that were removed, sorted from oldest to newest..
-
getSelections
- Returns:
- The current selections, sorted from oldest to newest.
-
getOnlySelection
For anything expecting only one selection, this method is provided. However, to enforce multi-selection support, this method will only return a selection if there is ONLY one.- Returns:
- The only selection, or null if there isn't only one.
-
getLastSelection
This method will always return the last selection. ONLY use this if you want to, for example, modify the most recent selection based on user input. ALWAYS usegetOnlySelection()or, ideally,getSelections()for retrieving the content of selections.- Returns:
- The last selection, or null if it doesn't exist.
-
expand
Replaces the specifiedISelectionwith one expanded in the specified direction by the specified number of blocks. Returns the new selection.- Parameters:
selection- The selection to expand.direction- The direction to expand the selection.blocks- How many blocks to expand it.- Returns:
- The new selection, expanded as specified.
-
contract
Replaces the specifiedISelectionwith one contracted in the specified direction by the specified number of blocks.Note that, for example, if the direction specified is UP, the bottom of the selection will be shifted up. If it is DOWN, the top of the selection will be shifted down.
- Parameters:
selection- The selection to contract.direction- The direction to contract the selection.blocks- How many blocks to contract it.- Returns:
- The new selection, contracted as specified.
-
shift
Replaces the specifiedISelectionwith one shifted in the specified direction by the specified number of blocks. This moves the whole selection.- Parameters:
selection- The selection to shift.direction- The direction to shift the selection.blocks- How many blocks to shift it.- Returns:
- The new selection, shifted as specified.
-