mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 20:44:08 +00:00
Animation Data Store (for cross event/frame data handling)
This commit is contained in:
1 parent
a33acee117
commit
68681931f8
2 files changed
+17
-1
No files matched your search
@@ -12,6 +12,8 @@ import noppes.npcs.constants.EnumAnimationPart;
|
||||
import noppes.npcs.controllers.AnimationController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@@ -35,6 +37,8 @@ public class Animation implements IAnimation {
|
||||
//Client-sided
|
||||
public boolean paused;
|
||||
|
||||
protected final Map<String, Object> dataStore = new HashMap<>();
|
||||
|
||||
public Consumer<Animation> onAnimationStart;
|
||||
public BiConsumer<Integer, Animation> onAnimationFrame;
|
||||
public Consumer<Animation> onAnimationEnd;
|
||||
@@ -180,6 +184,18 @@ public class Animation implements IAnimation {
|
||||
return time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasData(String key) {return dataStore.containsKey(key);}
|
||||
|
||||
@Override
|
||||
public Object getData(String key) {return dataStore.get(key);}
|
||||
|
||||
@Override
|
||||
public IAnimation setData(String key, Object v) {dataStore.put(key, v);return this;}
|
||||
|
||||
@Override
|
||||
public IAnimation removeData(String key) {dataStore.remove(key);return this;}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
if (compound.hasKey("ID")) {
|
||||
id = compound.getInteger("ID");
|
||||
|
||||
Reference in new issue
Block a user