aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/dungeon
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-02-11 14:52:11 +0900
committersyeyoung <cyong06@naver.com>2021-02-11 14:52:11 +0900
commit55d27afb28fee28bf374c1ce73fac6f04400a276 (patch)
tree72f88b5cdc1ea2dadcd4d6aa767b502f0f6f826d /src/main/java/kr/syeyoung/dungeonsguide/dungeon
parentdc10bc94b98a7b252af22e6a3c3f7f035ab4b231 (diff)
downloadSkyblock-Dungeons-Guide-55d27afb28fee28bf374c1ce73fac6f04400a276.tar.gz
Skyblock-Dungeons-Guide-55d27afb28fee28bf374c1ce73fac6f04400a276.tar.bz2
Skyblock-Dungeons-Guide-55d27afb28fee28bf374c1ce73fac6f04400a276.zip
navigation
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/AbstractAction.java6
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/Action.java2
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionChangeState.java5
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionInteract.java62
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java16
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java89
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java25
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java17
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java22
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java24
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java17
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java15
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateArmorStand.java27
13 files changed, 301 insertions, 26 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/AbstractAction.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/AbstractAction.java
index 16cd7ab0..85897a9b 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/AbstractAction.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/AbstractAction.java
@@ -1,6 +1,7 @@
package kr.syeyoung.dungeonsguide.dungeon.actions;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
@@ -26,6 +27,11 @@ public abstract class AbstractAction implements Action {
}
@Override
+ public void onLivingInteract(DungeonRoom dungeonRoom, PlayerInteractEntityEvent event) {
+
+ }
+
+ @Override
public void onTick(DungeonRoom dungeonRoom) {
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/Action.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/Action.java
index 496439b8..fc77c192 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/Action.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/Action.java
@@ -1,6 +1,7 @@
package kr.syeyoung.dungeonsguide.dungeon.actions;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
@@ -10,6 +11,7 @@ public interface Action {
Set<Action> getPreRequisites(DungeonRoom dungeonRoom);
void onPlayerInteract(DungeonRoom dungeonRoom, PlayerInteractEvent event);
+ void onLivingInteract(DungeonRoom dungeonRoom, PlayerInteractEntityEvent event);
void onLivingDeath(DungeonRoom dungeonRoom, LivingDeathEvent event);
void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks);
void onRenderScreen(DungeonRoom dungeonRoom, float partialTicks);
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionChangeState.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionChangeState.java
index 0a897ddd..fb1b76d7 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionChangeState.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionChangeState.java
@@ -1,5 +1,6 @@
package kr.syeyoung.dungeonsguide.dungeon.actions;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonFairySoul;
import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic;
import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonSecret;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
@@ -39,10 +40,14 @@ public class ActionChangeState extends AbstractAction{
@Override
public boolean isComplete(DungeonRoom dungeonRoom) {
DungeonMechanic mechanic = dungeonRoom.getDungeonRoomInfo().getMechanics().get(mechanicName);
+ if (state.equalsIgnoreCase("navigate"))
+ return true;
if (mechanic== null)
return false;
if (mechanic instanceof DungeonSecret && ((DungeonSecret) mechanic).getSecretType() != DungeonSecret.SecretType.CHEST)
return true;
+ if (mechanic instanceof DungeonFairySoul)
+ return true;
return mechanic.getCurrentState(dungeonRoom).equalsIgnoreCase(state);
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionInteract.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionInteract.java
new file mode 100755
index 00000000..b3be996a
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionInteract.java
@@ -0,0 +1,62 @@
+package kr.syeyoung.dungeonsguide.dungeon.actions;
+
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
+import kr.syeyoung.dungeonsguide.dungeon.EntitySpawnManager;
+import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
+import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.events.PlayerInteractEntityEvent;
+import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import lombok.Data;
+import net.minecraft.entity.Entity;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.Vec3;
+
+import java.awt.*;
+import java.util.HashSet;
+import java.util.Set;
+
+@Data
+public class ActionInteract extends AbstractAction {
+ private Set<Action> preRequisite = new HashSet<Action>();
+ private OffsetPoint target;
+ private Predicate<Entity> predicate = Predicates.alwaysFalse();
+ private int radius;
+
+ public ActionInteract(OffsetPoint target) {
+ this.target = target;
+ }
+
+ @Override
+ public Set<Action> getPreRequisites(DungeonRoom dungeonRoom) {
+ return preRequisite;
+ }
+
+ @Override
+ public boolean isComplete(DungeonRoom dungeonRoom) {
+ return interacted;
+ }
+
+ private boolean interacted = false;
+ @Override
+ public void onLivingInteract(DungeonRoom dungeonRoom, PlayerInteractEntityEvent event) {
+ if (interacted) return;
+
+ Vec3 spawnLoc = EntitySpawnManager.getSpawnLocation().get(event.getEntity().getEntityId());
+ if (spawnLoc == null) return;
+ if (target.getBlockPos(dungeonRoom).distanceSq(spawnLoc.xCoord, spawnLoc.yCoord, spawnLoc.zCoord) > radius * radius) return;
+ if (!predicate.apply(event.getEntity())) return;
+ interacted = true;
+ }
+ @Override
+ public void onRenderWorld(DungeonRoom dungeonRoom, float partialTicks) {
+ BlockPos pos = target.getBlockPos(dungeonRoom);
+ RenderUtils.highlightBlock(pos, new Color(0, 255,255,50),partialTicks, true);
+ RenderUtils.drawTextAtWorld("Interact", pos.getX() + 0.5f, pos.getY() + 0.3f, pos.getZ() + 0.5f, 0xFFFFFF00, 0.02f, false, false, partialTicks);
+ }
+
+ @Override
+ public String toString() {
+ return "InteractEntity\n- target: "+target.toString()+"\n- radius: "+radius+"\n- predicate: "+(predicate == null ? "null" : predicate.getClass().getSimpleName());
+ }
+}
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 b2577371..9b32802f 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java
@@ -24,6 +24,20 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker {
@Override
public Set<Action> getAction(String state, DungeonRoom dungeonRoom) {
+ if (state.equalsIgnoreCase("navigate")) {
+ Set<Action> base;
+ Set<Action> preRequisites = base = new HashSet<Action>();
+ ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint());
+ preRequisites.add(actionMove);
+ preRequisites = actionMove.getPreRequisite();
+ for (String str : preRequisite) {
+ if (str.isEmpty()) continue;
+ ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]);
+ preRequisites.add(actionChangeState);
+ }
+ return base;
+ }
+
if (!"open".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for breakable wall");
if (!isBlocking(dungeonRoom)) {
return Collections.emptySet();
@@ -89,7 +103,7 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker {
@Override
public Set<String> getPossibleStates(DungeonRoom dungeonRoom) {
- return isBlocking(dungeonRoom) ? Collections.singleton("open") : Collections.<String>emptySet();
+ return isBlocking(dungeonRoom) ? Sets.newHashSet("navigate", "open") : Sets.newHashSet("navigate");
}
@Override
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java
new file mode 100755
index 00000000..5f619089
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java
@@ -0,0 +1,89 @@
+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.mechanics.predicates.PredicateArmorStand;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.predicates.PredicateBat;
+import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.Getter;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.init.Blocks;
+import net.minecraft.tileentity.TileEntityChest;
+import net.minecraft.util.BlockPos;
+
+import java.awt.*;
+import java.util.List;
+import java.util.*;
+
+@Data
+public class DungeonFairySoul implements DungeonMechanic {
+ private OffsetPoint secretPoint = new OffsetPoint(0,0,0);
+ private List<String> preRequisite = new ArrayList<String>();
+
+
+ @Override
+ public Set<Action> getAction(String state, DungeonRoom dungeonRoom) {
+ if (!"navigate".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for secret");
+ Set<Action> base;
+ Set<Action> preRequisites = base = new HashSet<Action>();
+ {
+ ActionInteract actionClick= new ActionInteract(secretPoint);
+ actionClick.setPredicate(PredicateArmorStand.INSTANCE);
+ actionClick.setRadius(3);
+ preRequisites.add(actionClick);
+ preRequisites = actionClick.getPreRequisite();
+ }
+ {
+ ActionMove actionMove = new ActionMove(secretPoint);
+ preRequisites.add(actionMove);
+ preRequisites = actionMove.getPreRequisite();
+ }
+ {
+ for (String str : preRequisite) {
+ if (str.isEmpty()) continue;
+ ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]);
+ preRequisites.add(actionChangeState);
+ }
+ }
+ return base;
+ }
+
+ @Override
+ public void highlight(Color color, String name, DungeonRoom dungeonRoom, float partialTicks) {
+ BlockPos pos = getSecretPoint().getBlockPos(dungeonRoom);
+ RenderUtils.highlightBlock(pos, color,partialTicks);
+ RenderUtils.drawTextAtWorld("F-"+name, pos.getX() +0.5f, pos.getY()+0.375f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks);
+ RenderUtils.drawTextAtWorld(getCurrentState(dungeonRoom), pos.getX() +0.5f, pos.getY()+0f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks);
+ }
+
+
+ public DungeonFairySoul clone() throws CloneNotSupportedException {
+ DungeonFairySoul dungeonSecret = new DungeonFairySoul();
+ dungeonSecret.secretPoint = (OffsetPoint) secretPoint.clone();
+ dungeonSecret.preRequisite = new ArrayList<String>(preRequisite);
+ return dungeonSecret;
+ }
+
+
+ @Override
+ public String getCurrentState(DungeonRoom dungeonRoom) {
+ return "no-state";
+ }
+
+ @Override
+ public Set<String> getPossibleStates(DungeonRoom dungeonRoom) {
+ return Sets.newHashSet("navigate");
+ }
+ @Override
+ public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) {
+ return Sets.newHashSet("no-state","navigate");
+ }
+ @Override
+ public OffsetPoint getRepresentingPoint() {
+ return secretPoint;
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java
index a87d21fc..787208cc 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java
@@ -1,11 +1,8 @@
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.actions.Action;
-import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState;
-import kr.syeyoung.dungeonsguide.dungeon.actions.ActionClick;
-import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMove;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Data;
@@ -23,6 +20,20 @@ public class DungeonLever implements DungeonMechanic {
@Override
public Set<Action> getAction(String state, DungeonRoom dungeonRoom) {
+ if (state.equalsIgnoreCase("navigate")) {
+ Set<Action> base;
+ Set<Action> preRequisites = base = new HashSet<Action>();
+ ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint());
+ preRequisites.add(actionMove);
+ preRequisites = actionMove.getPreRequisite();
+ for (String str : preRequisite) {
+ if (str.isEmpty()) continue;
+ ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]);
+ preRequisites.add(actionChangeState);
+ }
+ return base;
+ }
+
if (!("triggered".equalsIgnoreCase(state) || "untriggered".equalsIgnoreCase(state))) throw new IllegalArgumentException(state+" is not valid state for secret");
Set<Action> base;
Set<Action> preRequisites = base = new HashSet<Action>();
@@ -84,10 +95,10 @@ public class DungeonLever implements DungeonMechanic {
public Set<String> getPossibleStates(DungeonRoom dungeonRoom) {
String currentStatus = getCurrentState(dungeonRoom);
if (currentStatus.equalsIgnoreCase("untriggered"))
- return Collections.singleton("triggered");
+ return Sets.newHashSet("navigate", "triggered");
else if (currentStatus.equalsIgnoreCase("triggered"))
- return Collections.singleton("untriggered");
- return Collections.emptySet();
+ return Sets.newHashSet("navigate","untriggered");
+ return Sets.newHashSet("navigate");
}
@Override
public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java
index ca7ca9e3..2e279b64 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java
@@ -26,6 +26,19 @@ public class DungeonOnewayDoor implements DungeonMechanic, RouteBlocker {
@Override
public Set<Action> getAction(String state, DungeonRoom dungeonRoom) {
+ if (state.equalsIgnoreCase("navigate")) {
+ Set<Action> base;
+ Set<Action> preRequisites = base = new HashSet<Action>();
+ ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint());
+ preRequisites.add(actionMove);
+ preRequisites = actionMove.getPreRequisite();
+ for (String str : preRequisite) {
+ if (str.isEmpty()) continue;
+ ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]);
+ preRequisites.add(actionChangeState);
+ }
+ return base;
+ }
if (!("open".equalsIgnoreCase(state))) throw new IllegalArgumentException(state+" is not valid state for door");
if (!isBlocking(dungeonRoom)) {
return Collections.emptySet();
@@ -80,8 +93,8 @@ public class DungeonOnewayDoor implements DungeonMechanic, RouteBlocker {
public Set<String> getPossibleStates(DungeonRoom dungeonRoom) {
String currentStatus = getCurrentState(dungeonRoom);
if (currentStatus.equalsIgnoreCase("closed"))
- return Collections.singleton("open");
- return Collections.emptySet();
+ return Sets.newHashSet("navigate", "open");
+ return Sets.newHashSet("navigate");
}
@Override
public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java
index dc9b6fcb..926c989d 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.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.ActionClick;
-import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMove;
+import 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;
@@ -23,6 +20,19 @@ public class DungeonOnewayLever implements DungeonMechanic {
@Override
public Set<Action> getAction(String state, DungeonRoom dungeonRoom) {
+ if (state.equalsIgnoreCase("navigate")) {
+ Set<Action> base;
+ Set<Action> preRequisites = base = new HashSet<Action>();
+ ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint());
+ preRequisites.add(actionMove);
+ preRequisites = actionMove.getPreRequisite();
+ for (String str : preRequisite) {
+ if (str.isEmpty()) continue;
+ ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]);
+ preRequisites.add(actionChangeState);
+ }
+ return base;
+ }
if (!("triggered".equalsIgnoreCase(state))) throw new IllegalArgumentException(state+" is not valid state for secret");
Set<Action> base;
Set<Action> preRequisites = base = new HashSet<Action>();
@@ -84,8 +94,8 @@ public class DungeonOnewayLever implements DungeonMechanic {
public Set<String> getPossibleStates(DungeonRoom dungeonRoom) {
String currentStatus = getCurrentState(dungeonRoom);
if (currentStatus.equalsIgnoreCase("untriggered"))
- return Collections.singleton("triggered");
- return Collections.emptySet();
+ return Sets.newHashSet("navigate", "triggered");
+ return Sets.newHashSet("navigate");
}
@Override
public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java
index 2677bc3b..3574c8c9 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.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.ActionDropItem;
-import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMove;
+import 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;
@@ -23,6 +20,19 @@ public class DungeonPressurePlate implements DungeonMechanic {
@Override
public Set<Action> getAction(String state, DungeonRoom dungeonRoom) {
+ if (state.equalsIgnoreCase("navigate")) {
+ Set<Action> base;
+ Set<Action> preRequisites = base = new HashSet<Action>();
+ ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint());
+ preRequisites.add(actionMove);
+ preRequisites = actionMove.getPreRequisite();
+ for (String str : preRequisite) {
+ if (str.isEmpty()) continue;
+ ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]);
+ preRequisites.add(actionChangeState);
+ }
+ return base;
+ }
if (!("triggered".equalsIgnoreCase(state) || "untriggered".equalsIgnoreCase(state))) throw new IllegalArgumentException(state+" is not valid state for secret");
if (state.equalsIgnoreCase(getCurrentState(dungeonRoom))) return Collections.emptySet();
@@ -86,10 +96,10 @@ public class DungeonPressurePlate implements DungeonMechanic {
public Set<String> getPossibleStates(DungeonRoom dungeonRoom) {
String currentStatus = getCurrentState(dungeonRoom);
if (currentStatus.equalsIgnoreCase("triggered"))
- return Collections.singleton("untriggered");
+ return Sets.newHashSet("navigate", "untriggered");
else if (currentStatus.equalsIgnoreCase("untriggered"))
- return Collections.singleton("triggered");
- return Collections.emptySet();
+ return Sets.newHashSet("navigate", "triggered");
+ return Sets.newHashSet("navigate");
}
@Override
public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) {
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 c12c066e..958cd286 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java
@@ -47,6 +47,19 @@ public class DungeonSecret implements DungeonMechanic {
@Override
public Set<Action> getAction(String state, DungeonRoom dungeonRoom) {
+ if (state.equalsIgnoreCase("navigate")) {
+ Set<Action> base;
+ Set<Action> preRequisites = base = new HashSet<Action>();
+ ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint());
+ preRequisites.add(actionMove);
+ preRequisites = actionMove.getPreRequisite();
+ for (String str : preRequisite) {
+ if (str.isEmpty()) continue;
+ ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]);
+ preRequisites.add(actionChangeState);
+ }
+ return base;
+ }
if (!"found".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for secret");
Set<Action> base;
Set<Action> preRequisites = base = new HashSet<Action>();
@@ -114,8 +127,8 @@ public class DungeonSecret implements DungeonMechanic {
@Override
public Set<String> getPossibleStates(DungeonRoom dungeonRoom) {
SecretStatus status = getSecretStatus(dungeonRoom);
- if (status == SecretStatus.FOUND) return Collections.emptySet();
- else return Collections.singleton("found");
+ if (status == SecretStatus.FOUND) return Sets.newHashSet("navigate");
+ else return Sets.newHashSet("found", "navigate");
}
@Override
public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) {
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 26f8f5f9..0f84d164 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java
@@ -24,6 +24,19 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker {
@Override
public Set<Action> getAction(String state, DungeonRoom dungeonRoom) {
+ if (state.equalsIgnoreCase("navigate")) {
+ Set<Action> base;
+ Set<Action> preRequisites = base = new HashSet<Action>();
+ ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint());
+ preRequisites.add(actionMove);
+ preRequisites = actionMove.getPreRequisite();
+ for (String str : preRequisite) {
+ if (str.isEmpty()) continue;
+ ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]);
+ preRequisites.add(actionChangeState);
+ }
+ return base;
+ }
if (!"open".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for tomb");
if (!isBlocking(dungeonRoom)) {
return Collections.emptySet();
@@ -88,7 +101,7 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker {
@Override
public Set<String> getPossibleStates(DungeonRoom dungeonRoom) {
- return isBlocking(dungeonRoom) ? Collections.singleton("open") : Collections.<String>emptySet();
+ return isBlocking(dungeonRoom) ? Sets.newHashSet("open", "navigate") : Sets.newHashSet("navigate");
}
@Override
public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateArmorStand.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateArmorStand.java
new file mode 100755
index 00000000..d0f7b0fb
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateArmorStand.java
@@ -0,0 +1,27 @@
+package kr.syeyoung.dungeonsguide.dungeon.mechanics.predicates;
+
+import com.google.common.base.Predicate;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.item.EntityArmorStand;
+import net.minecraft.entity.passive.EntityBat;
+import org.jetbrains.annotations.Nullable;
+
+
+public class PredicateArmorStand implements Predicate<Entity> {
+
+ public static final PredicateArmorStand INSTANCE = new PredicateArmorStand();
+
+ @Override
+ public boolean apply(@Nullable Entity input) {
+ return input instanceof EntityArmorStand;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+ @Override
+ public boolean equals(Object o) {
+ return o == this || o != null && (o.getClass() == this.getClass());
+ }
+}