ActionManager refactor + more features

This commit is contained in:
bigguy345 committed 2025-03-13 05:35:55 +02:00
1 parent 0841aab8f8
commit c81e848895
2 files changed
+19 -17

No files matched your search

@@ -19,7 +19,7 @@ public interface IActionManager {
* @param action the consumer defining the action's behavior.
* @return a new IAction instance.
*/
IAction createAction(String name, int maxDuration, int startAfterTicks, Consumer<IAction> action);
IAction create(String name, int maxDuration, int startAfterTicks, Consumer<IAction> action);
/**
* Starts the action manager, enabling the processing of scheduled actions.
@@ -36,7 +36,7 @@ public interface IActionManager {
*
* @param action the action to be scheduled.
*/
void addScheduledAction(IAction action);
void scheduleAction(IAction action);
/**
* Creates and schedules an action with the given parameters.
@@ -46,7 +46,7 @@ public interface IActionManager {
* @param startAfterTicks the delay in ticks before the action starts.
* @param action the consumer defining the action's behavior.
*/
void addScheduledAction(String name, int maxDuration, int startAfterTicks, Consumer<IAction> action);
void scheduleAction(String name, int maxDuration, int startAfterTicks, Consumer<IAction> action);
/**
* Inserts an action into the action queue at the specified index.
@@ -54,15 +54,8 @@ public interface IActionManager {
* @param index the position in the queue where the action should be added.
* @param action the action to insert.
*/
void addScheduledActionAt(int index, IAction action);
void scheduleActionAt(int index, IAction action);
/**
* Schedules an action to be executed immediately after the specified action.
*
* @param after the action after which the new action should run.
* @param toSchedule the action to schedule.
*/
void scheduleActionAfter(IAction after, IAction toSchedule);
/**
* Retrieves the index of the specified action in the action queue.
@@ -70,7 +63,7 @@ public interface IActionManager {
* @param action the action whose index is to be determined.
* @return the index of the action in the queue, or -1 if not found.
*/
int getActionIndex(IAction action);
int getIndex(IAction action);
/**
* Gets the current action (the one at the head of the queue).
+14 -5
View File
@@ -37,10 +37,8 @@ public interface IAction {
/**
* Marks the action as completed or not.
*
* @param done true to mark the action as done, false otherwise.
*/
void setDone(boolean done);
void markDone();
/**
* Checks if the action has been marked as completed.
@@ -97,10 +95,21 @@ public interface IAction {
*/
IAction create(String name, int maxDuration, int startAfterTicks, Consumer<IAction> action);
IAction getNext();
IAction getPrevious();
/**
* Schedules another action to be executed immediately after this action.
*
* @param action the action to schedule after this one.
* @param after the action to schedule after this one.
*/
void scheduleAfter(IAction action);
void scheduleAfter(IAction after);
/**
* Schedules an action to be executed before current action, which pauses current until before finishes.
*
* @param before the action to schedule before this one.
*/
void scheduleBefore(IAction before);
}