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
-
Field Summary
Modifier and TypeFieldDescriptionprivate final List
<ConfigurationScreen.UndoManager.Step<?>> private final List
<ConfigurationScreen.UndoManager.Step<?>> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T> void
void
add
(List<ConfigurationScreen.UndoManager.Step<?>> steps) void
add
(ConfigurationScreen.UndoManager.Step<?>... steps) private void
add
(ConfigurationScreen.UndoManager.Step<?> step, boolean execute) <T> void
addNoExecute
(Consumer<T> run, T newValue, Consumer<T> undo, T oldValue) boolean
canRedo()
boolean
canUndo()
void
redo()
void
undo()
-
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()
-