diff options
author | syeyoung <cyong06@naver.com> | 2021-02-10 19:50:58 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-02-10 19:50:58 +0900 |
commit | 8d81f25a74af028357f33c4a44f73fc929ad5338 (patch) | |
tree | e34cb9006b5bb1fcbda209d17e966f040e705ac0 /src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree | |
parent | b6a7d4231a245a4d0ba772761319bd180c44944d (diff) | |
download | Skyblock-Dungeons-Guide-8d81f25a74af028357f33c4a44f73fc929ad5338.tar.gz Skyblock-Dungeons-Guide-8d81f25a74af028357f33c4a44f73fc929ad5338.tar.bz2 Skyblock-Dungeons-Guide-8d81f25a74af028357f33c4a44f73fc929ad5338.zip |
AY PATHFINDER GO BRRRRR
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree')
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionRoute.java | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionRoute.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionRoute.java index b60b8fb0..7e074009 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionRoute.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionRoute.java @@ -1,19 +1,38 @@ package kr.syeyoung.dungeonsguide.dungeon.actions.tree; import kr.syeyoung.dungeonsguide.dungeon.actions.Action; +import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState; +import kr.syeyoung.dungeonsguide.dungeon.actions.ActionComplete; +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import lombok.Getter; +import net.minecraftforge.event.entity.living.LivingDeathEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; import java.util.List; public class ActionRoute { @Getter + private String mechanic; + @Getter + private String state; + + @Getter private int current; @Getter private List<Action> actions; - public ActionRoute(ActionTree tree) { + private DungeonRoom dungeonRoom; + + public ActionRoute(DungeonRoom dungeonRoom, String mechanic, String state) { + this.mechanic = mechanic; + this.state = state; + + ActionChangeState actionChangeState = new ActionChangeState(mechanic, state); + ActionTree tree= ActionTree.buildActionTree(actionChangeState, dungeonRoom); actions = ActionTreeUtil.linearifyActionTree(tree); + actions.add(new ActionComplete()); current = 0; + this.dungeonRoom = dungeonRoom; } public Action next() { @@ -31,4 +50,27 @@ public class ActionRoute { public Action getCurrentAction() { return actions.get(current); } + + + + public void onPlayerInteract(PlayerInteractEvent event) { + getCurrentAction().onPlayerInteract(dungeonRoom, event); + } + public void onLivingDeath(LivingDeathEvent event) { + getCurrentAction().onLivingDeath(dungeonRoom, event); + } + public void onRenderWorld(float partialTicks) { + getCurrentAction().onRenderWorld(dungeonRoom, partialTicks); + }; + public void onRenderScreen(float partialTicks) { + getCurrentAction().onRenderScreen(dungeonRoom, partialTicks); + }; + public void onTick() { + Action current = getCurrentAction(); + + current.onTick(dungeonRoom); + + if (current.isComplete(dungeonRoom)) + next(); + } } |