aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/dungeon
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-02-27 00:55:04 +0900
committersyeyoung <cyong06@naver.com>2021-02-27 00:57:04 +0900
commit740c141be9abb13b7b54389a408b082570945153 (patch)
tree09654da24efbee43f9a175fec025c011d5d6d950 /src/main/java/kr/syeyoung/dungeonsguide/dungeon
parent4c8212e74781dfa09c0036e94ceaf150e31da9d4 (diff)
downloadSkyblock-Dungeons-Guide-740c141be9abb13b7b54389a408b082570945153.tar.gz
Skyblock-Dungeons-Guide-740c141be9abb13b7b54389a408b082570945153.tar.bz2
Skyblock-Dungeons-Guide-740c141be9abb13b7b54389a408b082570945153.zip
massive refactor
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon')
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionChangeState.java4
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/tree/ActionRoute.java2
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java5
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java5
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java3
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java8
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonJournal.java4
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java6
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java2
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonNPC.java2
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java6
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java6
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java6
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java63
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java7
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java5
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java14
17 files changed, 103 insertions, 45 deletions
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 82e87425..9a883cb8 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionChangeState.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionChangeState.java
@@ -28,7 +28,7 @@ public class ActionChangeState extends AbstractAction{
public Set<Action> getPreRequisites(DungeonRoom dungeonRoom) {
Set<Action> set = new HashSet<Action>();
set.addAll(preRequisite2);
- DungeonMechanic mechanic = dungeonRoom.getDungeonRoomInfo().getMechanics().get(mechanicName);
+ DungeonMechanic mechanic = dungeonRoom.getMechanics().get(mechanicName);
if (mechanic!= null)
set.addAll(mechanic.getAction(state, dungeonRoom));
return set;
@@ -40,7 +40,7 @@ public class ActionChangeState extends AbstractAction{
@Override
public boolean isComplete(DungeonRoom dungeonRoom) {
- DungeonMechanic mechanic = dungeonRoom.getDungeonRoomInfo().getMechanics().get(mechanicName);
+ DungeonMechanic mechanic = dungeonRoom.getMechanics().get(mechanicName);
if (state.equalsIgnoreCase("navigate"))
return true;
if (mechanic== null)
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 49026db9..d5c99c8a 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
@@ -71,7 +71,7 @@ public class ActionRoute {
current.onTick(dungeonRoom);
- if (dungeonRoom.getDungeonRoomInfo().getMechanics().get(mechanic).getCurrentState(dungeonRoom).equals(state)) {
+ if (dungeonRoom.getMechanics().get(mechanic).getCurrentState(dungeonRoom).equals(state)) {
this.current = actions.size() - 1;
}
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 5fa994e0..1587393c 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java
@@ -4,7 +4,6 @@ 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.mechanics.predicates.PredicateSuperBoom;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Data;
@@ -55,7 +54,7 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker {
Set<Action> preRequisites = base = new HashSet<Action>();
{
ActionBreakWithSuperBoom actionClick;
- preRequisites.add(actionClick = new ActionBreakWithSuperBoom(getRepresentingPoint()));
+ preRequisites.add(actionClick = new ActionBreakWithSuperBoom(getRepresentingPoint(dungeonRoom)));
preRequisites = actionClick.getPreRequisite();
}
{
@@ -130,7 +129,7 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker {
}
@Override
- public OffsetPoint getRepresentingPoint() {
+ public OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom) {
return secretPoint.getOffsetPointList().size() == 0 ? null : secretPoint.getOffsetPointList().get(secretPoint.getOffsetPointList().size() / 2);
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java
index 443e8bbd..9c16a481 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java
@@ -5,9 +5,6 @@ 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;
import lombok.Data;
@@ -99,7 +96,7 @@ public class DungeonDoor implements DungeonMechanic, RouteBlocker {
}
@Override
- public OffsetPoint getRepresentingPoint() {
+ public OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom) {
int leastY = Integer.MAX_VALUE;
OffsetPoint thatPt = null;
for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java
index 3fe6ef46..139e32a2 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java
@@ -3,7 +3,6 @@ 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.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Data;
@@ -81,7 +80,7 @@ public class DungeonDummy implements DungeonMechanic {
return Sets.newHashSet("no-state","navigate,click");
}
@Override
- public OffsetPoint getRepresentingPoint() {
+ public OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom) {
return secretPoint;
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java
index 5f619089..3b8e6a5c 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java
@@ -4,15 +4,9 @@ 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.*;
@@ -83,7 +77,7 @@ public class DungeonFairySoul implements DungeonMechanic {
return Sets.newHashSet("no-state","navigate");
}
@Override
- public OffsetPoint getRepresentingPoint() {
+ public OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom) {
return secretPoint;
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonJournal.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonJournal.java
index 3993d0d7..5d5a5776 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonJournal.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonJournal.java
@@ -3,10 +3,8 @@ 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.ActionInteract;
import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMove;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
-import kr.syeyoung.dungeonsguide.dungeon.mechanics.predicates.PredicateArmorStand;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Data;
@@ -75,7 +73,7 @@ public class DungeonJournal implements DungeonMechanic {
return Sets.newHashSet("no-state","navigate");
}
@Override
- public OffsetPoint getRepresentingPoint() {
+ public OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom) {
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 7dd69af3..86ae7a6a 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java
@@ -24,7 +24,7 @@ public class DungeonLever implements DungeonMechanic {
if (state.equalsIgnoreCase("navigate")) {
Set<Action> base;
Set<Action> preRequisites = base = new HashSet<Action>();
- ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint());
+ ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint(dungeonRoom));
preRequisites.add(actionMove);
preRequisites = actionMove.getPreRequisite();
for (String str : preRequisite) {
@@ -78,7 +78,7 @@ public class DungeonLever implements DungeonMechanic {
@Override
public String getCurrentState(DungeonRoom dungeonRoom) {
if (triggering == null) triggering = "null";
- DungeonMechanic mechanic = dungeonRoom.getDungeonRoomInfo().getMechanics().get(triggering);
+ DungeonMechanic mechanic = dungeonRoom.getMechanics().get(triggering);
if (mechanic == null)
{
return "undeterminable";
@@ -106,7 +106,7 @@ public class DungeonLever implements DungeonMechanic {
return Sets.newHashSet("triggered", "untriggered");
}
@Override
- public OffsetPoint getRepresentingPoint() {
+ public OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom) {
return leverPoint;
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java
index 7dd91ae6..ab790e9b 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java
@@ -18,5 +18,5 @@ public interface DungeonMechanic extends Serializable {
Set<String> getPossibleStates(DungeonRoom dungeonRoom);
Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom);
- OffsetPoint getRepresentingPoint();
+ OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom);
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonNPC.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonNPC.java
index 086f3d11..ea1f7aa5 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonNPC.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonNPC.java
@@ -82,7 +82,7 @@ public class DungeonNPC implements DungeonMechanic {
return Sets.newHashSet("no-state","navigate");
}
@Override
- public OffsetPoint getRepresentingPoint() {
+ public OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom) {
return secretPoint;
}
}
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 803f7c5b..80a9beed 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java
@@ -5,9 +5,7 @@ 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;
import lombok.Data;
@@ -29,7 +27,7 @@ public class DungeonOnewayDoor implements DungeonMechanic, RouteBlocker {
if (state.equalsIgnoreCase("navigate")) {
Set<Action> base;
Set<Action> preRequisites = base = new HashSet<Action>();
- ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint());
+ ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint(dungeonRoom));
preRequisites.add(actionMove);
preRequisites = actionMove.getPreRequisite();
for (String str : preRequisite) {
@@ -103,7 +101,7 @@ public class DungeonOnewayDoor implements DungeonMechanic, RouteBlocker {
@Override
- public OffsetPoint getRepresentingPoint() {
+ public OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom) {
int leastY = Integer.MAX_VALUE;
OffsetPoint thatPt = null;
for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) {
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 bddfa231..bac4d7e3 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java
@@ -24,7 +24,7 @@ public class DungeonOnewayLever implements DungeonMechanic {
if (state.equalsIgnoreCase("navigate")) {
Set<Action> base;
Set<Action> preRequisites = base = new HashSet<Action>();
- ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint());
+ ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint(dungeonRoom));
preRequisites.add(actionMove);
preRequisites = actionMove.getPreRequisite();
for (String str : preRequisite) {
@@ -77,7 +77,7 @@ public class DungeonOnewayLever implements DungeonMechanic {
@Override
public String getCurrentState(DungeonRoom dungeonRoom) {
if (triggering == null) triggering = "null";
- DungeonMechanic mechanic = dungeonRoom.getDungeonRoomInfo().getMechanics().get(triggering);
+ DungeonMechanic mechanic = dungeonRoom.getMechanics().get(triggering);
if (mechanic == null)
{
return "undeterminable";
@@ -104,7 +104,7 @@ public class DungeonOnewayLever implements DungeonMechanic {
}
@Override
- public OffsetPoint getRepresentingPoint() {
+ public OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom) {
return leverPoint;
}
}
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 79ef4bda..75231eff 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java
@@ -24,7 +24,7 @@ public class DungeonPressurePlate implements DungeonMechanic {
if (state.equalsIgnoreCase("navigate")) {
Set<Action> base;
Set<Action> preRequisites = base = new HashSet<Action>();
- ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint());
+ ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint(dungeonRoom));
preRequisites.add(actionMove);
preRequisites = actionMove.getPreRequisite();
for (String str : preRequisite) {
@@ -79,7 +79,7 @@ public class DungeonPressurePlate implements DungeonMechanic {
@Override
public String getCurrentState(DungeonRoom dungeonRoom) {
if (triggering == null) triggering = "null";
- DungeonMechanic mechanic = dungeonRoom.getDungeonRoomInfo().getMechanics().get(triggering);
+ DungeonMechanic mechanic = dungeonRoom.getMechanics().get(triggering);
if (mechanic == null)
{
return "undeterminable";
@@ -107,7 +107,7 @@ public class DungeonPressurePlate implements DungeonMechanic {
return Sets.newHashSet("triggered", "untriggered");
}
@Override
- public OffsetPoint getRepresentingPoint() {
+ public OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom) {
return platePoint;
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java
new file mode 100644
index 00000000..83b5388a
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java
@@ -0,0 +1,63 @@
+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.ActionMove;
+import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
+import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonDoor;
+import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import net.minecraft.util.BlockPos;
+
+import java.awt.*;
+import java.util.HashSet;
+import java.util.Set;
+
+public class DungeonRoomDoor implements DungeonMechanic {
+ private DungeonDoor doorfinder;
+
+ public DungeonRoomDoor(DungeonDoor doorfinder) {
+ this.doorfinder = doorfinder;
+ }
+
+ @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>();
+ {
+ ActionMove actionMove = new ActionMove(new OffsetPoint(dungeonRoom, doorfinder.getPosition()));
+ preRequisites.add(actionMove);
+ preRequisites = actionMove.getPreRequisite();
+ }
+ return base;
+ }
+
+ @Override
+ public void highlight(Color color, String name, DungeonRoom dungeonRoom, float partialTicks) {
+ BlockPos pos = doorfinder.getPosition();
+ RenderUtils.highlightBlock(pos, color,partialTicks);
+ RenderUtils.drawTextAtWorld(name, pos.getX() +0.5f, pos.getY()+0.75f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks);
+ RenderUtils.drawTextAtWorld(getCurrentState(dungeonRoom), pos.getX() +0.5f, pos.getY()+0.25f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks);
+ }
+
+ @Override
+ public String getCurrentState(DungeonRoom dungeonRoom) {
+ return doorfinder.isRequiresKey() ? doorfinder.isOpened() ? "key-open" : "key-closed" : "normal";
+ }
+
+ @Override
+ public Set<String> getPossibleStates(DungeonRoom dungeonRoom) {
+ return Sets.newHashSet("navigate");
+ }
+
+ @Override
+ public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) {
+ return Sets.newHashSet("key-open", "key-closed", "normal");
+ }
+
+ @Override
+ public OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom) {
+ return new OffsetPoint(dungeonRoom, doorfinder.getPosition());
+ }
+}
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 05a2a7c1..f2c93624 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java
@@ -7,7 +7,6 @@ import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
import kr.syeyoung.dungeonsguide.dungeon.mechanics.predicates.PredicateBat;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.pathfinding.NodeProcessorDungeonRoom;
-import kr.syeyoung.dungeonsguide.roomedit.panes.SecretEditPane;
import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -18,8 +17,6 @@ import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.BlockPos;
import net.minecraft.util.Vec3;
-import net.minecraft.util.Vec3i;
-import net.minecraft.util.Vector3d;
import java.awt.*;
import java.util.*;
@@ -92,7 +89,7 @@ public class DungeonSecret implements DungeonMechanic {
if (state.equalsIgnoreCase("navigate")) {
Set<Action> base;
Set<Action> preRequisites = base = new HashSet<Action>();
- ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint());
+ ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint(dungeonRoom));
preRequisites.add(actionMove);
preRequisites = actionMove.getPreRequisite();
for (String str : preRequisite) {
@@ -177,7 +174,7 @@ public class DungeonSecret implements DungeonMechanic {
return Sets.newHashSet("found"/*, "definitely_not", "not_sure", "created", "error"*/);
}
@Override
- public OffsetPoint getRepresentingPoint() {
+ public OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom) {
return secretPoint;
}
}
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 0f84d164..2a17bbc8 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java
@@ -4,7 +4,6 @@ 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.mechanics.predicates.PredicateSuperBoom;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import lombok.Data;
@@ -27,7 +26,7 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker {
if (state.equalsIgnoreCase("navigate")) {
Set<Action> base;
Set<Action> preRequisites = base = new HashSet<Action>();
- ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint());
+ ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint(dungeonRoom));
preRequisites.add(actionMove);
preRequisites = actionMove.getPreRequisite();
for (String str : preRequisite) {
@@ -110,7 +109,7 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker {
@Override
- public OffsetPoint getRepresentingPoint() {
+ public OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom) {
return secretPoint.getOffsetPointList().size() == 0 ? null : secretPoint.getOffsetPointList().get(0);
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java
index 05eb09e9..def02c91 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java
@@ -6,6 +6,8 @@ import kr.syeyoung.dungeonsguide.dungeon.MapProcessor;
import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo;
import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonDoor;
import kr.syeyoung.dungeonsguide.dungeon.events.DungeonStateChangeEvent;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonRoomDoor;
import kr.syeyoung.dungeonsguide.pathfinding.NodeProcessorDungeonRoom;
import kr.syeyoung.dungeonsguide.roomprocessor.ProcessorFactory;
import kr.syeyoung.dungeonsguide.roomprocessor.RoomProcessor;
@@ -45,6 +47,18 @@ public class DungeonRoom {
private int totalSecrets = -1;
private RoomState currentState = RoomState.DISCOVERED;
+ private Map<String, DungeonMechanic> cached = null;
+ public Map<String, DungeonMechanic> getMechanics() {
+ if (cached == null) {
+ cached = new HashMap<String, DungeonMechanic>(dungeonRoomInfo.getMechanics());
+ int index = 0;
+ for (DungeonDoor door : doors) {
+ if (door.isExist()) cached.put((door.isRequiresKey() ? "withergate" : "gate")+"-"+(++index), new DungeonRoomDoor(door));
+ }
+ }
+ return cached;
+ }
+
public void setCurrentState(RoomState currentState) {
context.createEvent(new DungeonStateChangeEvent(unitPoints.get(0), dungeonRoomInfo.getName(), this.currentState, currentState));
this.currentState = currentState;