aboutsummaryrefslogtreecommitdiff
path: root/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics
diff options
context:
space:
mode:
Diffstat (limited to 'mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics')
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java45
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java16
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java40
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java83
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonJournal.java17
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java17
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java40
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonNPC.java67
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java22
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java17
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java52
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java49
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java136
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java91
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/RouteBlocker.java25
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/dunegonmechanic/DungeonMechanic.java40
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/dunegonmechanic/RouteBlocker.java25
17 files changed, 399 insertions, 383 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java
index 9f11cde9..64d4dc0b 100755
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java
@@ -1,32 +1,31 @@
/*
- * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
- * Copyright (C) 2021 cyoung06
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2021 cyoung06
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
*
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
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.ActionBreakWithSuperBoom;
-import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState;
-import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMoveNearestAir;
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.*;
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 kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.RouteBlocker;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic;
+import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils;
import lombok.Data;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
@@ -44,10 +43,10 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker {
@Override
- public Set<Action> getAction(String state, DungeonRoom dungeonRoom) {
+ public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) {
if (state.equalsIgnoreCase("navigate")) {
- Set<Action> base;
- Set<Action> preRequisites = base = new HashSet<Action>();
+ Set<AbstractAction> base;
+ Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>();
int leastY = Integer.MAX_VALUE;
OffsetPoint thatPt = null;
@@ -72,8 +71,8 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker {
if (!isBlocking(dungeonRoom)) {
return Collections.emptySet();
}
- Set<Action> base;
- Set<Action> preRequisites = base = new HashSet<Action>();
+ Set<AbstractAction> base;
+ Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>();
{
ActionBreakWithSuperBoom actionClick;
preRequisites.add(actionClick = new ActionBreakWithSuperBoom(getRepresentingPoint(dungeonRoom)));
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java
index 79ab6fcf..4cf779c4 100755
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java
@@ -19,12 +19,14 @@
package kr.syeyoung.dungeonsguide.dungeon.mechanics;
import com.google.common.collect.Sets;
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.AbstractAction;
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.roomfinder.DungeonRoom;
-import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionChangeState;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.RouteBlocker;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic;
+import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils;
import lombok.Data;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
@@ -42,11 +44,11 @@ public class DungeonDoor implements DungeonMechanic, RouteBlocker {
@Override
- public Set<Action> getAction(String state, DungeonRoom dungeonRoom) {
+ public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) {
if (!("open".equalsIgnoreCase(state) || "closed".equalsIgnoreCase(state))) throw new IllegalArgumentException(state+" is not valid state for door");
if (state.equalsIgnoreCase(getCurrentState(dungeonRoom))) return Collections.emptySet();
- Set<Action> base;
- Set<Action> preRequisites = base = new HashSet<Action>();
+ Set<AbstractAction> base;
+ Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>();
{
if (state.equalsIgnoreCase("open")) {
for (String str : openPreRequisite) {
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java
index 79f079c1..60ca1b3a 100755
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java
@@ -1,31 +1,29 @@
/*
- * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
- * Copyright (C) 2021 cyoung06
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2021 cyoung06
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
*
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
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.mod.dungeon.actions.*;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
-import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
-import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic;
+import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils;
import lombok.Data;
import net.minecraft.util.BlockPos;
@@ -43,10 +41,10 @@ public class DungeonDummy implements DungeonMechanic {
@Override
- public Set<Action> getAction(String state, DungeonRoom dungeonRoom) {
+ public Set<AbstractAction> 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>();
+ Set<AbstractAction> base;
+ Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>();
if (state.equalsIgnoreCase("navigate")){
ActionMove actionMove = new ActionMove(secretPoint);
preRequisites.add(actionMove);
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java
index 1c110bb5..0bbecfbd 100755
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java
@@ -1,38 +1,43 @@
/*
- * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
- * Copyright (C) 2021 cyoung06
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2021 cyoung06
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
*
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
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.mod.dungeon.actions.AbstractAction;
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionChangeState;
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionInteract;
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionMove;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic;
import kr.syeyoung.dungeonsguide.dungeon.mechanics.predicates.PredicateArmorStand;
-import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
-import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils;
import lombok.Data;
+import net.minecraft.entity.Entity;
import net.minecraft.util.BlockPos;
import java.awt.*;
+import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
-import java.util.*;
+import java.util.Set;
+import java.util.function.Predicate;
@Data
public class DungeonFairySoul implements DungeonMechanic {
@@ -42,27 +47,25 @@ public class DungeonFairySoul implements DungeonMechanic {
@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);
+ public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) {
+ if (!"navigate".equalsIgnoreCase(state))
+ throw new IllegalArgumentException(state + " is not valid state for secret");
+
+ Set<AbstractAction> base = new HashSet<>();
+ ActionInteract actionClick = new ActionInteract(secretPoint);
+ actionClick.setPredicate((Predicate<Entity>) PredicateArmorStand.INSTANCE);
+ actionClick.setRadius(3);
+ base.add(actionClick);
+
+ base = actionClick.getPreRequisite();
+ ActionMove actionMove = new ActionMove(secretPoint);
+ base.add(actionMove);
+ base = actionMove.getPreRequisite();
+
+ for (String str : preRequisite) {
+ if (!str.isEmpty()) {
+ String[] split = str.split(":");
+ base.add(new ActionChangeState(split[0], split[1]));
}
}
return base;
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonJournal.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonJournal.java
index f0edc4a6..897fad3d 100755
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonJournal.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonJournal.java
@@ -19,12 +19,13 @@
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.ActionMove;
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.AbstractAction;
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionChangeState;
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionMove;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
-import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
-import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic;
+import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils;
import lombok.Data;
import net.minecraft.util.BlockPos;
@@ -42,10 +43,10 @@ public class DungeonJournal implements DungeonMechanic {
@Override
- public Set<Action> getAction(String state, DungeonRoom dungeonRoom) {
+ public Set<AbstractAction> 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>();
+ Set<AbstractAction> base;
+ Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>();
{
ActionMove actionMove = new ActionMove(secretPoint);
preRequisites.add(actionMove);
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java
index 5bc1f650..a27bd833 100755
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java
@@ -19,10 +19,11 @@
package kr.syeyoung.dungeonsguide.dungeon.mechanics;
import com.google.common.collect.Sets;
-import kr.syeyoung.dungeonsguide.dungeon.actions.*;
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.*;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
-import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
-import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic;
+import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils;
import lombok.Data;
import net.minecraft.util.BlockPos;
@@ -37,11 +38,11 @@ public class DungeonLever implements DungeonMechanic {
private String triggering = "";
@Override
- public Set<Action> getAction(String state, DungeonRoom dungeonRoom) {
+ public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) {
if (state.equals(getCurrentState(dungeonRoom))) return Collections.emptySet();
if (state.equalsIgnoreCase("navigate")) {
- Set<Action> base;
- Set<Action> preRequisites = base = new HashSet<Action>();
+ Set<AbstractAction> base;
+ Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>();
ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint(dungeonRoom));
preRequisites.add(actionMove);
preRequisites = actionMove.getPreRequisite();
@@ -54,8 +55,8 @@ public class DungeonLever implements DungeonMechanic {
}
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>();
+ Set<AbstractAction> base;
+ Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>();
if (!state.equalsIgnoreCase(getCurrentState(dungeonRoom))){
ActionClick actionClick;
preRequisites.add(actionClick = new ActionClick(leverPoint));
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java
deleted file mode 100755
index 677a5489..00000000
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
- * Copyright (C) 2021 cyoung06
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.dungeon.mechanics;
-
-import kr.syeyoung.dungeonsguide.dungeon.actions.Action;
-import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
-import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
-
-import java.awt.*;
-import java.io.Serializable;
-import java.util.Set;
-
-public interface DungeonMechanic extends Serializable {
- Set<Action> getAction(String state, DungeonRoom dungeonRoom);
-
- void highlight(Color color, String name, DungeonRoom dungeonRoom, float partialTicks);
-
- String getCurrentState(DungeonRoom dungeonRoom);
-
- Set<String> getPossibleStates(DungeonRoom dungeonRoom);
- Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom);
-
- OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom);
-}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonNPC.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonNPC.java
index e1fc4bfc..4eed8f27 100755
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonNPC.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonNPC.java
@@ -19,15 +19,17 @@
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.mod.dungeon.actions.AbstractAction;
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionChangeState;
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionInteract;
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionMove;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic;
import kr.syeyoung.dungeonsguide.dungeon.mechanics.predicates.PredicateArmorStand;
-import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
-import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils;
import lombok.Data;
+import net.minecraft.entity.Entity;
import net.minecraft.util.BlockPos;
import java.awt.*;
@@ -35,36 +37,35 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import java.util.function.Predicate;
@Data
public class DungeonNPC implements DungeonMechanic {
private static final long serialVersionUID = -89487601113028763L;
- private OffsetPoint secretPoint = new OffsetPoint(0,0,0);
+ 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);
+ public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) {
+ if (!"navigate".equalsIgnoreCase(state))
+ throw new IllegalArgumentException(state + " is not valid state for secret");
+
+ Set<AbstractAction> base = new HashSet<>();
+ ActionInteract actionClick = new ActionInteract(secretPoint);
+ actionClick.setPredicate((Predicate<Entity>) PredicateArmorStand.INSTANCE);
+ actionClick.setRadius(3);
+ base.add(actionClick);
+
+ base = actionClick.getPreRequisite();
+ ActionMove actionMove = new ActionMove(secretPoint);
+ base.add(actionMove);
+ base = actionMove.getPreRequisite();
+
+ for (String str : preRequisite) {
+ if (!str.isEmpty()) {
+ String[] split = str.split(":");
+ base.add(new ActionChangeState(split[0], split[1]));
}
}
return base;
@@ -73,9 +74,9 @@ public class DungeonNPC implements DungeonMechanic {
@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);
+ 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);
}
@@ -96,10 +97,12 @@ public class DungeonNPC implements DungeonMechanic {
public Set<String> getPossibleStates(DungeonRoom dungeonRoom) {
return Sets.newHashSet("navigate");
}
+
@Override
public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) {
- return Sets.newHashSet("no-state","navigate");
+ return Sets.newHashSet("no-state", "navigate");
}
+
@Override
public OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom) {
return secretPoint;
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java
index b97f84d0..af4b8f65 100755
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java
@@ -19,13 +19,15 @@
package kr.syeyoung.dungeonsguide.dungeon.mechanics;
import com.google.common.collect.Sets;
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.AbstractAction;
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.ActionMoveNearestAir;
-import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
-import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionChangeState;
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.ActionMoveNearestAir;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.RouteBlocker;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic;
+import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils;
import lombok.Data;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
@@ -42,10 +44,10 @@ public class DungeonOnewayDoor implements DungeonMechanic, RouteBlocker {
@Override
- public Set<Action> getAction(String state, DungeonRoom dungeonRoom) {
+ public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) {
if (state.equalsIgnoreCase("navigate")) {
- Set<Action> base;
- Set<Action> preRequisites = base = new HashSet<Action>();
+ Set<AbstractAction> base;
+ Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>();
ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint(dungeonRoom));
preRequisites.add(actionMove);
preRequisites = actionMove.getPreRequisite();
@@ -60,8 +62,8 @@ public class DungeonOnewayDoor implements DungeonMechanic, RouteBlocker {
if (!isBlocking(dungeonRoom)) {
return Collections.emptySet();
}
- Set<Action> base;
- Set<Action> preRequisites = base = new HashSet<Action>();
+ Set<AbstractAction> base;
+ Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>();
{
for (String str : preRequisite) {
if (str.isEmpty()) continue;
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java
index 8403efca..f3b641e2 100755
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java
@@ -19,10 +19,11 @@
package kr.syeyoung.dungeonsguide.dungeon.mechanics;
import com.google.common.collect.Sets;
-import kr.syeyoung.dungeonsguide.dungeon.actions.*;
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.*;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
-import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
-import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic;
+import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils;
import lombok.Data;
import net.minecraft.util.BlockPos;
@@ -38,11 +39,11 @@ public class DungeonOnewayLever implements DungeonMechanic {
private String triggering = "";
@Override
- public Set<Action> getAction(String state, DungeonRoom dungeonRoom) {
+ public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) {
if (state.equals(getCurrentState(dungeonRoom))) return Collections.emptySet();
if (state.equalsIgnoreCase("navigate")) {
- Set<Action> base;
- Set<Action> preRequisites = base = new HashSet<Action>();
+ Set<AbstractAction> base;
+ Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>();
ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint(dungeonRoom));
preRequisites.add(actionMove);
preRequisites = actionMove.getPreRequisite();
@@ -54,8 +55,8 @@ public class DungeonOnewayLever implements DungeonMechanic {
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>();
+ Set<AbstractAction> base;
+ Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>();
{
ActionClick actionClick;
preRequisites.add(actionClick = new ActionClick(leverPoint));
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java
index 8d79d924..936dc00c 100755
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java
@@ -19,10 +19,11 @@
package kr.syeyoung.dungeonsguide.dungeon.mechanics;
import com.google.common.collect.Sets;
-import kr.syeyoung.dungeonsguide.dungeon.actions.*;
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.*;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
-import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
-import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic;
+import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils;
import lombok.Data;
import net.minecraft.util.BlockPos;
@@ -33,16 +34,16 @@ import java.util.List;
@Data
public class DungeonPressurePlate implements DungeonMechanic {
private static final long serialVersionUID = 7450034718355390645L;
- private OffsetPoint platePoint = new OffsetPoint(0,0,0);
+ private OffsetPoint platePoint = new OffsetPoint(0, 0, 0);
private List<String> preRequisite = new ArrayList<String>();
private String triggering = "";
@Override
- public Set<Action> getAction(String state, DungeonRoom dungeonRoom) {
+ public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) {
if (state.equals(getCurrentState(dungeonRoom))) return Collections.emptySet();
if (state.equalsIgnoreCase("navigate")) {
- Set<Action> base;
- Set<Action> preRequisites = base = new HashSet<Action>();
+ Set<AbstractAction> base;
+ Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>();
ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint(dungeonRoom));
preRequisites.add(actionMove);
preRequisites = actionMove.getPreRequisite();
@@ -53,37 +54,35 @@ public class DungeonPressurePlate implements DungeonMechanic {
}
return base;
}
- if (!("triggered".equalsIgnoreCase(state) || "untriggered".equalsIgnoreCase(state))) throw new IllegalArgumentException(state+" is not valid state for secret");
+ 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();
- Set<Action> base;
- Set<Action> preRequisites = base = new HashSet<Action>();
+ Set<AbstractAction> base;
+ Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>();
if ("triggered".equalsIgnoreCase(state)) {
ActionDropItem actionClick;
preRequisites.add(actionClick = new ActionDropItem(platePoint));
preRequisites = actionClick.getPreRequisite();
}
- {
- ActionMove actionMove = new ActionMove(platePoint);
- 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);
- }
+ ActionMove actionMove = new ActionMove(platePoint);
+ 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 = getPlatePoint().getBlockPos(dungeonRoom);
- 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);
+ 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);
}
public DungeonPressurePlate clone() throws CloneNotSupportedException {
@@ -99,8 +98,7 @@ public class DungeonPressurePlate implements DungeonMechanic {
public String getCurrentState(DungeonRoom dungeonRoom) {
if (triggering == null) triggering = "null";
DungeonMechanic mechanic = dungeonRoom.getMechanics().get(triggering);
- if (mechanic == null)
- {
+ if (mechanic == null) {
return "undeterminable";
} else {
String state = mechanic.getCurrentState(dungeonRoom);
@@ -121,10 +119,12 @@ public class DungeonPressurePlate implements DungeonMechanic {
return Sets.newHashSet("navigate", "triggered");
return Sets.newHashSet("navigate");
}
+
@Override
public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) {
return Sets.newHashSet("triggered", "untriggered");
}
+
@Override
public OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom) {
return platePoint;
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java
index 6b0d58f8..9a3bedcc 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java
@@ -19,12 +19,13 @@
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.mod.dungeon.actions.AbstractAction;
+import kr.syeyoung.dungeonsguide.mod.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 kr.syeyoung.dungeonsguide.mod.dungeon.doorfinder.DungeonDoor;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic;
+import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils;
import lombok.Getter;
import net.minecraft.util.BlockPos;
@@ -40,15 +41,15 @@ public class DungeonRoomDoor implements DungeonMechanic {
public DungeonRoomDoor(DungeonRoom dungeonRoom, DungeonDoor doorfinder) {
this.doorfinder = doorfinder;
if (doorfinder.isZDir()) {
- if (dungeonRoom.canAccessAbsolute(doorfinder.getPosition().add(0,0,2)))
- offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition().add(0,0,2));
- else if (dungeonRoom.canAccessAbsolute(doorfinder.getPosition().add(0,0,-2)))
- offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition().add(0,0,-2));
+ if (dungeonRoom.canAccessAbsolute(doorfinder.getPosition().add(0, 0, 2)))
+ offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition().add(0, 0, 2));
+ else if (dungeonRoom.canAccessAbsolute(doorfinder.getPosition().add(0, 0, -2)))
+ offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition().add(0, 0, -2));
} else {
- if (dungeonRoom.canAccessAbsolute(doorfinder.getPosition().add(2,0,0)))
- offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition().add(2,0,0));
- else if (dungeonRoom.canAccessAbsolute(doorfinder.getPosition().add(-2,0,0)))
- offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition().add(-2,0,0));
+ if (dungeonRoom.canAccessAbsolute(doorfinder.getPosition().add(2, 0, 0)))
+ offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition().add(2, 0, 0));
+ else if (dungeonRoom.canAccessAbsolute(doorfinder.getPosition().add(-2, 0, 0)))
+ offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition().add(-2, 0, 0));
}
if (offsetPoint == null) {
offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition());
@@ -56,24 +57,20 @@ public class DungeonRoomDoor implements DungeonMechanic {
}
@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(offsetPoint);
- preRequisites.add(actionMove);
- preRequisites = actionMove.getPreRequisite();
- }
- return base;
+ public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) {
+ if (!"navigate".equalsIgnoreCase(state))
+ throw new IllegalArgumentException(state + " is not valid state for secret");
+ Set<AbstractAction> preRequisites = new HashSet<>();
+ preRequisites.add(new ActionMove(offsetPoint));
+ return preRequisites;
}
@Override
public void highlight(Color color, String name, DungeonRoom dungeonRoom, float partialTicks) {
BlockPos pos = offsetPoint.getBlockPos(dungeonRoom);
- 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);
+ 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
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java
index b03d5b3a..48ec30f6 100755
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java
@@ -1,70 +1,78 @@
/*
- * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
- * Copyright (C) 2021 cyoung06
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2021 cyoung06
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
*
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package kr.syeyoung.dungeonsguide.dungeon.mechanics;
import com.google.common.collect.Sets;
-import kr.syeyoung.dungeonsguide.dungeon.actions.*;
+import kr.syeyoung.dungeonsguide.mod.DungeonsGuide;
+import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonActionContext;
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.*;
import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
-import kr.syeyoung.dungeonsguide.dungeon.DungeonActionManager;
-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.utils.RenderUtils;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic;
+import kr.syeyoung.dungeonsguide.mod.dungeon.pathfinding.NodeProcessorDungeonRoom;
+import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
+import net.minecraft.entity.passive.EntityBat;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.BlockPos;
import net.minecraft.util.Vec3;
import java.awt.*;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
@Data
public class DungeonSecret implements DungeonMechanic {
private static final long serialVersionUID = 8784808599222706537L;
- private OffsetPoint secretPoint = new OffsetPoint(0,0,0);
+ private OffsetPoint secretPoint = new OffsetPoint(0, 0, 0);
private SecretType secretType = SecretType.CHEST;
private List<String> preRequisite = new ArrayList<String>();
public void tick(DungeonRoom dungeonRoom) {
if (secretType == SecretType.CHEST) {
BlockPos pos = secretPoint.getBlockPos(dungeonRoom);
- IBlockState blockState = dungeonRoom.getContext().getWorld().getBlockState(pos);
+ IBlockState blockState = DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(pos);
if (blockState.getBlock() == Blocks.chest || blockState.getBlock() == Blocks.trapped_chest) {
TileEntityChest chest = (TileEntityChest) dungeonRoom.getContext().getWorld().getTileEntity(pos);
- if (chest.numPlayersUsing > 0) {
- dungeonRoom.getRoomContext().put("c-"+pos.toString(), 2);
+ if(chest != null){
+ if (chest.numPlayersUsing > 0) {
+ dungeonRoom.getRoomContext().put("c-" + pos.toString(), 2);
+ } else {
+ dungeonRoom.getRoomContext().put("c-" + pos.toString(), 1);
+ }
} else {
- dungeonRoom.getRoomContext().put("c-"+pos.toString(), 1);
+ System.out.println("Expected TileEntityChest at " + pos + " to not be null");
}
}
} else if (secretType == SecretType.ESSENCE) {
BlockPos pos = secretPoint.getBlockPos(dungeonRoom);
- IBlockState blockState = dungeonRoom.getContext().getWorld().getBlockState(pos);
+ IBlockState blockState = DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(pos);
if (blockState.getBlock() == Blocks.skull) {
- dungeonRoom.getRoomContext().put("e-"+pos.toString(), true);
+ dungeonRoom.getRoomContext().put("e-" + pos.toString(), true);
}
} else if (secretType == SecretType.ITEM_DROP) {
Vec3 pos = new Vec3(secretPoint.getBlockPos(dungeonRoom));
@@ -74,7 +82,7 @@ public class DungeonSecret implements DungeonMechanic {
for (int i = 0; i < player.distanceTo(pos); i++) {
Vec3 vec = player.addVector(vec3.xCoord * i, vec3.yCoord * i, vec3.zCoord * i);
BlockPos bpos = new BlockPos(vec);
- IBlockState blockState = dungeonRoom.getContext().getWorld().getBlockState(bpos);
+ IBlockState blockState = DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(bpos);
if (!NodeProcessorDungeonRoom.isValidBlock(blockState))
return;
}
@@ -86,9 +94,9 @@ public class DungeonSecret implements DungeonMechanic {
public SecretStatus getSecretStatus(DungeonRoom dungeonRoom) {
if (secretType == SecretType.CHEST) {
BlockPos pos = secretPoint.getBlockPos(dungeonRoom);
- IBlockState blockState = dungeonRoom.getContext().getWorld().getBlockState(pos);
- if (dungeonRoom.getRoomContext().containsKey("c-"+pos.toString()))
- return ((int)dungeonRoom.getRoomContext().get("c-"+pos.toString()) == 2 || blockState.getBlock() == Blocks.air) ? SecretStatus.FOUND : SecretStatus.CREATED;
+ IBlockState blockState = DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(pos);
+ if (dungeonRoom.getRoomContext().containsKey("c-" + pos.toString()))
+ return ((int) dungeonRoom.getRoomContext().get("c-" + pos.toString()) == 2 || blockState.getBlock() == Blocks.air) ? SecretStatus.FOUND : SecretStatus.CREATED;
if (blockState.getBlock() == Blocks.air) {
return SecretStatus.DEFINITELY_NOT;
@@ -98,33 +106,33 @@ public class DungeonSecret implements DungeonMechanic {
TileEntityChest chest = (TileEntityChest) dungeonRoom.getContext().getWorld().getTileEntity(pos);
if (chest.numPlayersUsing > 0) {
return SecretStatus.FOUND;
- } else{
+ } else {
return SecretStatus.CREATED;
}
}
} else if (secretType == SecretType.ESSENCE) {
BlockPos pos = secretPoint.getBlockPos(dungeonRoom);
- IBlockState blockState = dungeonRoom.getContext().getWorld().getBlockState(pos);
+ IBlockState blockState = DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(pos);
if (blockState.getBlock() == Blocks.skull) {
- dungeonRoom.getRoomContext().put("e-"+pos.toString(), true);
+ dungeonRoom.getRoomContext().put("e-" + pos.toString(), true);
return SecretStatus.DEFINITELY_NOT;
} else {
- if (dungeonRoom.getRoomContext().containsKey("e-"+pos.toString()))
+ if (dungeonRoom.getRoomContext().containsKey("e-" + pos.toString()))
return SecretStatus.FOUND;
return SecretStatus.NOT_SURE;
}
} else if (secretType == SecretType.BAT) {
Vec3 spawn = new Vec3(secretPoint.getBlockPos(dungeonRoom));
- for (Integer killed : DungeonActionManager.getKilleds()) {
- if (DungeonActionManager.getSpawnLocation().get(killed) == null) continue;
- if (DungeonActionManager.getSpawnLocation().get(killed).squareDistanceTo(spawn) < 100) {
+ for (Integer killed : DungeonActionContext.getKilleds()) {
+ if (DungeonActionContext.getSpawnLocation().get(killed) == null) continue;
+ if (DungeonActionContext.getSpawnLocation().get(killed).squareDistanceTo(spawn) < 100) {
return SecretStatus.FOUND;
}
}
return SecretStatus.NOT_SURE;
} else {
Vec3 pos = new Vec3(secretPoint.getBlockPos(dungeonRoom));
- if (dungeonRoom.getRoomContext().containsKey("i-"+ pos))
+ if (dungeonRoom.getRoomContext().containsKey("i-" + pos))
return SecretStatus.FOUND;
Vec3 player = Minecraft.getMinecraft().thePlayer.getPositionVector();
if (player.squareDistanceTo(pos) < 16) {
@@ -132,7 +140,7 @@ public class DungeonSecret implements DungeonMechanic {
for (int i = 0; i < player.distanceTo(pos); i++) {
Vec3 vec = player.addVector(vec3.xCoord * i, vec3.yCoord * i, vec3.zCoord * i);
BlockPos bpos = new BlockPos(vec);
- IBlockState blockState = dungeonRoom.getContext().getWorld().getBlockState(bpos);
+ IBlockState blockState = DungeonsGuide.getDungeonsGuide().getBlockCache().getBlockState(bpos);
if (!NodeProcessorDungeonRoom.isValidBlock(blockState))
return SecretStatus.NOT_SURE;
}
@@ -143,10 +151,10 @@ public class DungeonSecret implements DungeonMechanic {
}
@Override
- public Set<Action> getAction(String state, DungeonRoom dungeonRoom) {
+ public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) {
if (state.equalsIgnoreCase("navigate")) {
- Set<Action> base;
- Set<Action> preRequisites = base = new HashSet<Action>();
+ Set<AbstractAction> base;
+ Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>();
ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint(dungeonRoom));
preRequisites.add(actionMove);
preRequisites = actionMove.getPreRequisite();
@@ -157,43 +165,43 @@ public class DungeonSecret implements DungeonMechanic {
}
return base;
}
- if (!"found".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for secret");
+ if (!"found".equalsIgnoreCase(state))
+ throw new IllegalArgumentException(state + " is not valid state for secret");
if (state.equals("found") && getSecretStatus(dungeonRoom) == SecretStatus.FOUND) return new HashSet<>();
- Set<Action> base;
- Set<Action> preRequisites = base = new HashSet<Action>();
+ Set<AbstractAction> base;
+ Set<AbstractAction> preRequisites = base = new HashSet<AbstractAction>();
if (secretType == SecretType.CHEST || secretType == SecretType.ESSENCE) {
ActionClick actionClick;
preRequisites.add(actionClick = new ActionClick(secretPoint));
preRequisites = actionClick.getPreRequisite();
} else if (secretType == SecretType.BAT) {
- ActionKill actionKill;
- preRequisites.add(actionKill = new ActionKill(secretPoint));
- actionKill.setPredicate(PredicateBat.INSTANCE);
+ ActionKill actionKill = new ActionKill(secretPoint);
+ preRequisites.add(actionKill);
+ actionKill.setPredicate(EntityBat.class::isInstance);
actionKill.setRadius(10);
preRequisites = actionKill.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);
- }
+
+ 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(getSecretType().name(), pos.getX() +0.5f, pos.getY()+0.75f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks);
- RenderUtils.drawTextAtWorld(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);
+ RenderUtils.highlightBlock(pos, color, partialTicks);
+ RenderUtils.drawTextAtWorld(getSecretType().name(), pos.getX() + 0.5f, pos.getY() + 0.75f, pos.getZ() + 0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks);
+ RenderUtils.drawTextAtWorld(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 enum SecretType {
@@ -228,10 +236,12 @@ public class DungeonSecret implements DungeonMechanic {
if (status == SecretStatus.FOUND) return Sets.newHashSet("navigate");
else return Sets.newHashSet("found", "navigate");
}
+
@Override
public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) {
return Sets.newHashSet("found"/*, "definitely_not", "not_sure", "created", "error"*/);
}
+
@Override
public OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom) {
return secretPoint;
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java
index e4dc79cb..b14ffaf3 100755
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java
@@ -1,32 +1,31 @@
/*
- * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
- * Copyright (C) 2021 cyoung06
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2021 cyoung06
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
*
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
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.ActionBreakWithSuperBoom;
-import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState;
-import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMoveNearestAir;
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.*;
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 kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.RouteBlocker;
+import kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic.DungeonMechanic;
+import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils;
import lombok.Data;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
@@ -40,14 +39,14 @@ import java.util.List;
public class DungeonTomb implements DungeonMechanic, RouteBlocker {
private static final long serialVersionUID = -7347076019472222115L;
private OffsetPointSet secretPoint = new OffsetPointSet();
- private List<String> preRequisite = new ArrayList<String>();
+ private List<String> preRequisite = new ArrayList<>();
@Override
- public Set<Action> getAction(String state, DungeonRoom dungeonRoom) {
+ public Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom) {
if (state.equalsIgnoreCase("navigate")) {
- Set<Action> base;
- Set<Action> preRequisites = base = new HashSet<Action>();
+ Set<AbstractAction> base;
+ Set<AbstractAction> preRequisites = base = new HashSet<>();
ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint(dungeonRoom));
preRequisites.add(actionMove);
preRequisites = actionMove.getPreRequisite();
@@ -58,29 +57,28 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker {
}
return base;
}
- if (!"open".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for tomb");
+ if (!"open".equalsIgnoreCase(state)) {
+ throw new IllegalArgumentException(state + " is not valid state for tomb");
+ }
if (!isBlocking(dungeonRoom)) {
return Collections.emptySet();
}
- Set<Action> base;
- Set<Action> preRequisites = base = new HashSet<Action>();
- {
- ActionBreakWithSuperBoom actionClick;
- preRequisites.add(actionClick = new ActionBreakWithSuperBoom(secretPoint.getOffsetPointList().get(0)));
- preRequisites = actionClick.getPreRequisite();
- }
- {
- ActionMoveNearestAir actionMove = new ActionMoveNearestAir(secretPoint.getOffsetPointList().get(0));
- 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);
- }
+ Set<AbstractAction> base;
+ Set<AbstractAction> preRequisites = base = new HashSet<>();
+
+ ActionBreakWithSuperBoom actionClick = new ActionBreakWithSuperBoom(secretPoint.getOffsetPointList().get(0));
+ preRequisites.add(actionClick);
+ preRequisites = actionClick.getPreRequisite();
+
+ ActionMoveNearestAir actionMove = new ActionMoveNearestAir(secretPoint.getOffsetPointList().get(0));
+ 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;
}
@@ -89,11 +87,11 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker {
if (secretPoint.getOffsetPointList().isEmpty()) return;
OffsetPoint firstpt = secretPoint.getOffsetPointList().get(0);
BlockPos pos = firstpt.getBlockPos(dungeonRoom);
- 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);
+ 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);
for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) {
- RenderUtils.highlightBlock(offsetPoint.getBlockPos(dungeonRoom), color,partialTicks);
+ RenderUtils.highlightBlock(offsetPoint.getBlockPos(dungeonRoom), color, partialTicks);
}
}
@@ -108,7 +106,7 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker {
public DungeonTomb clone() throws CloneNotSupportedException {
DungeonTomb dungeonSecret = new DungeonTomb();
dungeonSecret.secretPoint = (OffsetPointSet) secretPoint.clone();
- dungeonSecret.preRequisite = new ArrayList<String>(preRequisite);
+ dungeonSecret.preRequisite = new ArrayList<>(preRequisite);
return dungeonSecret;
}
@@ -117,13 +115,14 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker {
Block b = Blocks.air;
if (!secretPoint.getOffsetPointList().isEmpty())
b = secretPoint.getOffsetPointList().get(0).getBlock(dungeonRoom);
- return b == Blocks.air ?"open" :"closed";
+ return b == Blocks.air ? "open" : "closed";
}
@Override
public Set<String> getPossibleStates(DungeonRoom dungeonRoom) {
return isBlocking(dungeonRoom) ? Sets.newHashSet("open", "navigate") : Sets.newHashSet("navigate");
}
+
@Override
public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) {
return Sets.newHashSet("open", "closed");
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/RouteBlocker.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/RouteBlocker.java
deleted file mode 100755
index e12d1269..00000000
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/RouteBlocker.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
- * Copyright (C) 2021 cyoung06
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.dungeon.mechanics;
-
-import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
-
-public interface RouteBlocker {
- boolean isBlocking(DungeonRoom dungeonRoom);
-}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/dunegonmechanic/DungeonMechanic.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/dunegonmechanic/DungeonMechanic.java
new file mode 100755
index 00000000..9aa18701
--- /dev/null
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/dunegonmechanic/DungeonMechanic.java
@@ -0,0 +1,40 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2021 cyoung06
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic;
+
+import kr.syeyoung.dungeonsguide.mod.dungeon.actions.AbstractAction;
+import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
+import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom;
+
+import java.awt.*;
+import java.io.Serializable;
+import java.util.Set;
+
+public interface DungeonMechanic extends Serializable {
+ Set<AbstractAction> getAction(String state, DungeonRoom dungeonRoom);
+
+ void highlight(Color color, String name, DungeonRoom dungeonRoom, float partialTicks);
+
+ String getCurrentState(DungeonRoom dungeonRoom);
+
+ Set<String> getPossibleStates(DungeonRoom dungeonRoom);
+ Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom);
+
+ OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom);
+}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/dunegonmechanic/RouteBlocker.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/dunegonmechanic/RouteBlocker.java
new file mode 100755
index 00000000..faad723a
--- /dev/null
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/dunegonmechanic/RouteBlocker.java
@@ -0,0 +1,25 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2021 cyoung06
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.dungeon.mechanics.dunegonmechanic;
+
+import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom;
+
+public interface RouteBlocker {
+ boolean isBlocking(DungeonRoom dungeonRoom);
+}