mirror of
https://github.com/KAMKEEL/CustomNPC-Plus-API.git
synced 2026-11-15 17:14:44 +00:00
Cleaned API ActionManager
This commit is contained in:
1 parent
655011f5e5
commit
f1be19748f
3 files changed
+1
-121
No files matched your search
@@ -1,69 +0,0 @@
|
||||
package noppes.npcs.api;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public interface IAction {
|
||||
|
||||
/**
|
||||
* @return number of times the function passed has been called upon
|
||||
*/
|
||||
int getCount();
|
||||
|
||||
/**
|
||||
* @return number of ticks since action starting
|
||||
*/
|
||||
int getDuration();
|
||||
|
||||
String getName();
|
||||
|
||||
int getMaxDuration();
|
||||
|
||||
/**
|
||||
* @param done set to true to end action
|
||||
*/
|
||||
void setDone(boolean done);
|
||||
|
||||
boolean isDone();
|
||||
|
||||
/**
|
||||
* Allows the storage of objects that might be needed within the action.
|
||||
* Equivalent to npc.getTempData().
|
||||
* All data deleted on action ending
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
void addData(String key, Object value);
|
||||
|
||||
Object getData(String key);
|
||||
|
||||
int getUpdateEveryXTick();
|
||||
|
||||
/**
|
||||
* @param X calls upon the function passed every X ticks
|
||||
*/
|
||||
void setUpdateEveryXTick(int X);
|
||||
|
||||
/**
|
||||
* @return number of ticks to elapse before starting action
|
||||
*/
|
||||
int getStartAfterTicks();
|
||||
|
||||
/**
|
||||
* Creates a new IAction. allows for instant daisy-chaining without having to go through npc.getActionManager() again
|
||||
*
|
||||
* @param name
|
||||
* @param maxDuration
|
||||
* @param startAfterTicks
|
||||
* @param action
|
||||
* @return
|
||||
*/
|
||||
IAction create(String name, int maxDuration, int startAfterTicks, Consumer<IAction> action);
|
||||
|
||||
/**
|
||||
* Schedules newAction right after this one, skipping the line of everything after
|
||||
*
|
||||
* @param newAction
|
||||
*/
|
||||
void scheduleAfter(IAction newAction);
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package noppes.npcs.api;
|
||||
|
||||
import java.util.Queue;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public interface IActionManager {
|
||||
/**
|
||||
* @param name
|
||||
* @param maxDuration once maxDuration is reached the action ends
|
||||
* @param action function to invoke as long as this action is active
|
||||
* @param startAfterTicks number of ticks to elapse before starting action
|
||||
* @return
|
||||
*/
|
||||
IAction createAction(String name, int maxDuration, int startAfterTicks, Consumer<IAction> action);
|
||||
|
||||
/**
|
||||
* Starts ActionManager (paused by default)
|
||||
*/
|
||||
void start();
|
||||
|
||||
/**
|
||||
* stops ActionManager
|
||||
*/
|
||||
void stop();
|
||||
|
||||
void addScheduledAction(IAction action);
|
||||
|
||||
void addScheduledAction(String name, int maxDuration, int startAfterTicks, Consumer<IAction> action);
|
||||
|
||||
/**
|
||||
* @param index to add action at in the actionQueue
|
||||
* @param action
|
||||
*/
|
||||
void addScheduledActionAt(int index, IAction action);
|
||||
|
||||
/**
|
||||
* @param after The action to add toSchedule after
|
||||
* @param toSchedule
|
||||
*/
|
||||
void scheduleActionAfter(IAction after, IAction toSchedule);
|
||||
|
||||
/**
|
||||
* @param action
|
||||
* @return action's index in the actionQueue
|
||||
*/
|
||||
int getActionIndex(IAction action);
|
||||
|
||||
IAction getCurrentAction();
|
||||
|
||||
Queue<IAction> getActionQueue();
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import noppes.npcs.api.IActionManager;
|
||||
import noppes.npcs.api.IPos;
|
||||
import noppes.npcs.api.ITimers;
|
||||
import noppes.npcs.api.entity.data.IModelData;
|
||||
import noppes.npcs.api.handler.IActionManager;
|
||||
import noppes.npcs.api.handler.IOverlayHandler;
|
||||
import noppes.npcs.api.handler.data.IAnimationData;
|
||||
import noppes.npcs.api.handler.data.IDialog;
|
||||
|
||||
Reference in new issue
Block a user