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 | |
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')
12 files changed, 114 insertions, 16 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java index b4986736..9ab52808 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionBreakWithSuperBoom.java @@ -34,7 +34,7 @@ public class ActionBreakWithSuperBoom extends AbstractAction { @Override public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) { - RenderUtils.highlightBlock(target.getBlockPos(dungeonRoom), new Color(255, 0,0,255),partialTicks, true); + RenderUtils.highlightBlock(target.getBlockPos(dungeonRoom), new Color(255, 0,0,255),partialTicks, false); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java index d062cdd9..18467809 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClick.java @@ -4,11 +4,13 @@ import com.google.common.base.Predicate; import com.google.common.base.Predicates; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Data; import lombok.EqualsAndHashCode; import net.minecraft.item.ItemStack; import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import java.awt.*; import java.util.HashSet; import java.util.Set; @@ -42,6 +44,11 @@ public class ActionClick extends AbstractAction { clicked = true; } } + @Override + public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) { + RenderUtils.highlightBlock(target.getBlockPos(dungeonRoom), new Color(0, 255,0,50),partialTicks, true); + } + @Override public String toString() { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java index 8fd82501..7a3c99f4 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionClickSet.java @@ -5,11 +5,13 @@ import com.google.common.base.Predicates; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Data; import lombok.EqualsAndHashCode; import net.minecraft.item.ItemStack; import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import java.awt.*; import java.util.HashSet; import java.util.Set; @@ -47,6 +49,13 @@ public class ActionClickSet extends AbstractAction { } @Override + public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) { + for (OffsetPoint offsetPoint : target.getOffsetPointList()) { + RenderUtils.highlightBlock(offsetPoint.getBlockPos(dungeonRoom), new Color(0, 255,0,50),partialTicks, true); + } + } + + @Override public boolean isComplete(DungeonRoom dungeonRoom) { return clicked; } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionComplete.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionComplete.java new file mode 100644 index 00000000..2a47f99b --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionComplete.java @@ -0,0 +1,23 @@ +package kr.syeyoung.dungeonsguide.dungeon.actions; + +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; + +import java.util.Collections; +import java.util.Set; + +public class ActionComplete extends AbstractAction { + @Override + public Set<Action> getPreRequisites(DungeonRoom dungeonRoom) { + return Collections.emptySet(); + } + + @Override + public boolean isComplete(DungeonRoom dungeonRoom) { + return false; + } + + @Override + public String toString() { + return "Completed"; + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java index 9fa87dad..fb86c997 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionDropItem.java @@ -4,6 +4,7 @@ import com.google.common.base.Predicate; import com.google.common.base.Predicates; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Data; import lombok.EqualsAndHashCode; import net.minecraft.entity.item.EntityItem; @@ -11,6 +12,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; +import java.awt.*; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -38,6 +40,10 @@ public class ActionDropItem extends AbstractAction { if (item.size() == 0) return false; return (predicate == null || predicate.apply(item.get(0))); } + @Override + public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) { + RenderUtils.highlightBlock(target.getBlockPos(dungeonRoom), new Color(0, 0,255,50),partialTicks, true); + } @Override public String toString() { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java index 26046201..c43b2568 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionKill.java @@ -6,12 +6,14 @@ import kr.syeyoung.dungeonsguide.dungeon.EntitySpawnManager; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Data; import lombok.EqualsAndHashCode; import net.minecraft.entity.Entity; import net.minecraft.util.Vec3; import net.minecraftforge.event.entity.living.LivingDeathEvent; +import java.awt.*; import java.util.HashSet; import java.util.Set; @@ -47,6 +49,10 @@ public class ActionKill extends AbstractAction { if (!predicate.apply(event.entity)) return; killed = true; } + @Override + public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) { + RenderUtils.highlightBlock(target.getBlockPos(dungeonRoom), new Color(255, 0,0,50),partialTicks, true); + } @Override public String toString() { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java index 0eb1906a..591db2ca 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java @@ -2,9 +2,11 @@ package kr.syeyoung.dungeonsguide.dungeon.actions; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Data; import net.minecraft.client.Minecraft; +import java.awt.*; import java.util.HashSet; import java.util.Set; @@ -27,6 +29,10 @@ public class ActionMove extends AbstractAction { return target.getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()) < 10; } + @Override + public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) { + RenderUtils.highlightBlock(target.getBlockPos(dungeonRoom), new Color(0, 255,255,50),partialTicks, false); + } @Override public String toString() { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java index 52a63dba..fda4cd92 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java @@ -2,9 +2,11 @@ package kr.syeyoung.dungeonsguide.dungeon.actions; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Data; import net.minecraft.client.Minecraft; +import java.awt.*; import java.util.HashSet; import java.util.Set; @@ -26,6 +28,10 @@ public class ActionMoveNearestAir extends AbstractAction { public boolean isComplete(DungeonRoom dungeonRoom) { return target.getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()) < 10; } + @Override + public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) { + RenderUtils.highlightBlock(target.getBlockPos(dungeonRoom), new Color(0, 255,255,50),partialTicks, false); + } @Override public String toString() { 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(); + } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java index a6c1341b..19f711cb 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java @@ -1,12 +1,9 @@ package kr.syeyoung.dungeonsguide.dungeon.mechanics; import com.google.common.collect.Sets; +import kr.syeyoung.dungeonsguide.dungeon.actions.*; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionClickSet; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMoveNearestAir; import kr.syeyoung.dungeonsguide.dungeon.mechanics.predicates.PredicateSuperBoom; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.utils.RenderUtils; @@ -34,9 +31,8 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker { Set<Action> base; Set<Action> preRequisites = base = new HashSet<Action>(); { - ActionClickSet actionClick; - preRequisites.add(actionClick = new ActionClickSet(secretPoint)); - actionClick.setPredicate(PredicateSuperBoom.INSTANCE); + ActionBreakWithSuperBoom actionClick; + preRequisites.add(actionClick = new ActionBreakWithSuperBoom(secretPoint.getOffsetPointList().get(0))); preRequisites = actionClick.getPreRequisite(); } { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java index 610ca94d..4e8d8658 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java @@ -58,6 +58,7 @@ public class DungeonSecret implements DungeonMechanic { ActionKill actionKill; preRequisites.add(actionKill = new ActionKill(secretPoint)); actionKill.setPredicate(PredicateBat.INSTANCE); + actionKill.setRadius(10); preRequisites = actionKill.getPreRequisite(); } { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java index 9b5a84fa..9fad7caf 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java @@ -1,10 +1,7 @@ package kr.syeyoung.dungeonsguide.dungeon.mechanics; import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionClickSet; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMoveNearestAir; +import kr.syeyoung.dungeonsguide.dungeon.actions.*; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; import kr.syeyoung.dungeonsguide.dungeon.mechanics.predicates.PredicateSuperBoom; @@ -34,9 +31,8 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker { Set<Action> base; Set<Action> preRequisites = base = new HashSet<Action>(); { - ActionClickSet actionClick; - preRequisites.add(actionClick = new ActionClickSet(secretPoint)); - actionClick.setPredicate(PredicateSuperBoom.INSTANCE); + ActionBreakWithSuperBoom actionClick; + preRequisites.add(actionClick = new ActionBreakWithSuperBoom(secretPoint.getOffsetPointList().get(0))); preRequisites = actionClick.getPreRequisite(); } { |