Class ConfigurationScreen.UndoManager
java.lang.Object
net.neoforged.neoforge.client.gui.ConfigurationScreen.UndoManager
- Enclosing class:
ConfigurationScreen
A class representing an undo/redo buffer.
Every undo step is represented as 2 actions, one to initially execute when the step is added and to redo after an undo, and one to execute to undo the step. Both get a captured parameter to make defining them inline or reusing the code portion easier.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<ConfigurationScreen.UndoManager.Step<?>> private final List<ConfigurationScreen.UndoManager.Step<?>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> voidvoidadd(List<ConfigurationScreen.UndoManager.Step<?>> steps) voidadd(ConfigurationScreen.UndoManager.Step<?>... steps) private voidadd(ConfigurationScreen.UndoManager.Step<?> step, boolean execute) <T> voidaddNoExecute(Consumer<T> run, T newValue, Consumer<T> undo, T oldValue) booleancanRedo()booleancanUndo()voidredo()voidundo()
-
Field Details
-
undos
-
redos
-
-
Constructor Details
-
UndoManager
public UndoManager()
-
-
Method Details
-
undo
public void undo() -
redo
public void redo() -
add
-
step
public <T> ConfigurationScreen.UndoManager.Step<T> step(Consumer<T> run, T newValue, Consumer<T> undo, T oldValue) -
add
-
addNoExecute
-
add
-
add
-
canUndo
public boolean canUndo() -
canRedo
public boolean canRedo()
-