diff options
author | syeyoung <cyong06@naver.com> | 2021-02-11 14:52:11 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-02-11 14:52:11 +0900 |
commit | 55d27afb28fee28bf374c1ce73fac6f04400a276 (patch) | |
tree | 72f88b5cdc1ea2dadcd4d6aa767b502f0f6f826d /src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics | |
parent | dc10bc94b98a7b252af22e6a3c3f7f035ab4b231 (diff) | |
download | Skyblock-Dungeons-Guide-55d27afb28fee28bf374c1ce73fac6f04400a276.tar.gz Skyblock-Dungeons-Guide-55d27afb28fee28bf374c1ce73fac6f04400a276.tar.bz2 Skyblock-Dungeons-Guide-55d27afb28fee28bf374c1ce73fac6f04400a276.zip |
navigation
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics')
9 files changed, 226 insertions, 26 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java index b2577371..9b32802f 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java @@ -24,6 +24,20 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker { @Override public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { + if (state.equalsIgnoreCase("navigate")) { + Set<Action> base; + Set<Action> preRequisites = base = new HashSet<Action>(); + ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint()); + preRequisites.add(actionMove); + preRequisites = actionMove.getPreRequisite(); + for (String str : preRequisite) { + if (str.isEmpty()) continue; + ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); + preRequisites.add(actionChangeState); + } + return base; + } + if (!"open".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for breakable wall"); if (!isBlocking(dungeonRoom)) { return Collections.emptySet(); @@ -89,7 +103,7 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker { @Override public Set<String> getPossibleStates(DungeonRoom dungeonRoom) { - return isBlocking(dungeonRoom) ? Collections.singleton("open") : Collections.<String>emptySet(); + return isBlocking(dungeonRoom) ? Sets.newHashSet("navigate", "open") : Sets.newHashSet("navigate"); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java new file mode 100755 index 00000000..5f619089 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java @@ -0,0 +1,89 @@ +package kr.syeyoung.dungeonsguide.dungeon.mechanics; + +import com.google.common.collect.Sets; +import kr.syeyoung.dungeonsguide.dungeon.actions.*; +import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.predicates.PredicateArmorStand; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.predicates.PredicateBat; +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.Getter; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.util.BlockPos; + +import java.awt.*; +import java.util.List; +import java.util.*; + +@Data +public class DungeonFairySoul implements DungeonMechanic { + private OffsetPoint secretPoint = new OffsetPoint(0,0,0); + private List<String> preRequisite = new ArrayList<String>(); + + + @Override + public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { + if (!"navigate".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for secret"); + Set<Action> base; + Set<Action> preRequisites = base = new HashSet<Action>(); + { + ActionInteract actionClick= new ActionInteract(secretPoint); + actionClick.setPredicate(PredicateArmorStand.INSTANCE); + actionClick.setRadius(3); + preRequisites.add(actionClick); + preRequisites = actionClick.getPreRequisite(); + } + { + ActionMove actionMove = new ActionMove(secretPoint); + preRequisites.add(actionMove); + preRequisites = actionMove.getPreRequisite(); + } + { + for (String str : preRequisite) { + if (str.isEmpty()) continue; + ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); + preRequisites.add(actionChangeState); + } + } + return base; + } + + @Override + public void highlight(Color color, String name, DungeonRoom dungeonRoom, float partialTicks) { + BlockPos pos = getSecretPoint().getBlockPos(dungeonRoom); + RenderUtils.highlightBlock(pos, color,partialTicks); + RenderUtils.drawTextAtWorld("F-"+name, pos.getX() +0.5f, pos.getY()+0.375f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); + RenderUtils.drawTextAtWorld(getCurrentState(dungeonRoom), pos.getX() +0.5f, pos.getY()+0f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); + } + + + public DungeonFairySoul clone() throws CloneNotSupportedException { + DungeonFairySoul dungeonSecret = new DungeonFairySoul(); + dungeonSecret.secretPoint = (OffsetPoint) secretPoint.clone(); + dungeonSecret.preRequisite = new ArrayList<String>(preRequisite); + return dungeonSecret; + } + + + @Override + public String getCurrentState(DungeonRoom dungeonRoom) { + return "no-state"; + } + + @Override + public Set<String> getPossibleStates(DungeonRoom dungeonRoom) { + return Sets.newHashSet("navigate"); + } + @Override + public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) { + return Sets.newHashSet("no-state","navigate"); + } + @Override + public OffsetPoint getRepresentingPoint() { + return secretPoint; + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java index a87d21fc..787208cc 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java @@ -1,11 +1,8 @@ package kr.syeyoung.dungeonsguide.dungeon.mechanics; import com.google.common.collect.Sets; +import kr.syeyoung.dungeonsguide.dungeon.actions.*; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionClick; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMove; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Data; @@ -23,6 +20,20 @@ public class DungeonLever implements DungeonMechanic { @Override public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { + if (state.equalsIgnoreCase("navigate")) { + Set<Action> base; + Set<Action> preRequisites = base = new HashSet<Action>(); + ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint()); + preRequisites.add(actionMove); + preRequisites = actionMove.getPreRequisite(); + for (String str : preRequisite) { + if (str.isEmpty()) continue; + ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); + preRequisites.add(actionChangeState); + } + return base; + } + if (!("triggered".equalsIgnoreCase(state) || "untriggered".equalsIgnoreCase(state))) throw new IllegalArgumentException(state+" is not valid state for secret"); Set<Action> base; Set<Action> preRequisites = base = new HashSet<Action>(); @@ -84,10 +95,10 @@ public class DungeonLever implements DungeonMechanic { public Set<String> getPossibleStates(DungeonRoom dungeonRoom) { String currentStatus = getCurrentState(dungeonRoom); if (currentStatus.equalsIgnoreCase("untriggered")) - return Collections.singleton("triggered"); + return Sets.newHashSet("navigate", "triggered"); else if (currentStatus.equalsIgnoreCase("triggered")) - return Collections.singleton("untriggered"); - return Collections.emptySet(); + return Sets.newHashSet("navigate","untriggered"); + return Sets.newHashSet("navigate"); } @Override public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java index ca7ca9e3..2e279b64 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java @@ -26,6 +26,19 @@ public class DungeonOnewayDoor implements DungeonMechanic, RouteBlocker { @Override public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { + if (state.equalsIgnoreCase("navigate")) { + Set<Action> base; + Set<Action> preRequisites = base = new HashSet<Action>(); + ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint()); + preRequisites.add(actionMove); + preRequisites = actionMove.getPreRequisite(); + for (String str : preRequisite) { + if (str.isEmpty()) continue; + ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); + preRequisites.add(actionChangeState); + } + return base; + } if (!("open".equalsIgnoreCase(state))) throw new IllegalArgumentException(state+" is not valid state for door"); if (!isBlocking(dungeonRoom)) { return Collections.emptySet(); @@ -80,8 +93,8 @@ public class DungeonOnewayDoor implements DungeonMechanic, RouteBlocker { public Set<String> getPossibleStates(DungeonRoom dungeonRoom) { String currentStatus = getCurrentState(dungeonRoom); if (currentStatus.equalsIgnoreCase("closed")) - return Collections.singleton("open"); - return Collections.emptySet(); + return Sets.newHashSet("navigate", "open"); + return Sets.newHashSet("navigate"); } @Override public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java index dc9b6fcb..926c989d 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java @@ -1,10 +1,7 @@ package kr.syeyoung.dungeonsguide.dungeon.mechanics; import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionClick; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMove; +import kr.syeyoung.dungeonsguide.dungeon.actions.*; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.utils.RenderUtils; @@ -23,6 +20,19 @@ public class DungeonOnewayLever implements DungeonMechanic { @Override public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { + if (state.equalsIgnoreCase("navigate")) { + Set<Action> base; + Set<Action> preRequisites = base = new HashSet<Action>(); + ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint()); + preRequisites.add(actionMove); + preRequisites = actionMove.getPreRequisite(); + for (String str : preRequisite) { + if (str.isEmpty()) continue; + ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); + preRequisites.add(actionChangeState); + } + return base; + } if (!("triggered".equalsIgnoreCase(state))) throw new IllegalArgumentException(state+" is not valid state for secret"); Set<Action> base; Set<Action> preRequisites = base = new HashSet<Action>(); @@ -84,8 +94,8 @@ public class DungeonOnewayLever implements DungeonMechanic { public Set<String> getPossibleStates(DungeonRoom dungeonRoom) { String currentStatus = getCurrentState(dungeonRoom); if (currentStatus.equalsIgnoreCase("untriggered")) - return Collections.singleton("triggered"); - return Collections.emptySet(); + return Sets.newHashSet("navigate", "triggered"); + return Sets.newHashSet("navigate"); } @Override public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java index 2677bc3b..3574c8c9 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java @@ -1,10 +1,7 @@ package kr.syeyoung.dungeonsguide.dungeon.mechanics; import com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionDropItem; -import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMove; +import kr.syeyoung.dungeonsguide.dungeon.actions.*; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.utils.RenderUtils; @@ -23,6 +20,19 @@ public class DungeonPressurePlate implements DungeonMechanic { @Override public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { + if (state.equalsIgnoreCase("navigate")) { + Set<Action> base; + Set<Action> preRequisites = base = new HashSet<Action>(); + ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint()); + preRequisites.add(actionMove); + preRequisites = actionMove.getPreRequisite(); + for (String str : preRequisite) { + if (str.isEmpty()) continue; + ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); + preRequisites.add(actionChangeState); + } + return base; + } if (!("triggered".equalsIgnoreCase(state) || "untriggered".equalsIgnoreCase(state))) throw new IllegalArgumentException(state+" is not valid state for secret"); if (state.equalsIgnoreCase(getCurrentState(dungeonRoom))) return Collections.emptySet(); @@ -86,10 +96,10 @@ public class DungeonPressurePlate implements DungeonMechanic { public Set<String> getPossibleStates(DungeonRoom dungeonRoom) { String currentStatus = getCurrentState(dungeonRoom); if (currentStatus.equalsIgnoreCase("triggered")) - return Collections.singleton("untriggered"); + return Sets.newHashSet("navigate", "untriggered"); else if (currentStatus.equalsIgnoreCase("untriggered")) - return Collections.singleton("triggered"); - return Collections.emptySet(); + return Sets.newHashSet("navigate", "triggered"); + return Sets.newHashSet("navigate"); } @Override public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java index c12c066e..958cd286 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java @@ -47,6 +47,19 @@ public class DungeonSecret implements DungeonMechanic { @Override public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { + if (state.equalsIgnoreCase("navigate")) { + Set<Action> base; + Set<Action> preRequisites = base = new HashSet<Action>(); + ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint()); + preRequisites.add(actionMove); + preRequisites = actionMove.getPreRequisite(); + for (String str : preRequisite) { + if (str.isEmpty()) continue; + ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); + preRequisites.add(actionChangeState); + } + return base; + } if (!"found".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for secret"); Set<Action> base; Set<Action> preRequisites = base = new HashSet<Action>(); @@ -114,8 +127,8 @@ public class DungeonSecret implements DungeonMechanic { @Override public Set<String> getPossibleStates(DungeonRoom dungeonRoom) { SecretStatus status = getSecretStatus(dungeonRoom); - if (status == SecretStatus.FOUND) return Collections.emptySet(); - else return Collections.singleton("found"); + if (status == SecretStatus.FOUND) return Sets.newHashSet("navigate"); + else return Sets.newHashSet("found", "navigate"); } @Override public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java index 26f8f5f9..0f84d164 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java @@ -24,6 +24,19 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker { @Override public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { + if (state.equalsIgnoreCase("navigate")) { + Set<Action> base; + Set<Action> preRequisites = base = new HashSet<Action>(); + ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint()); + preRequisites.add(actionMove); + preRequisites = actionMove.getPreRequisite(); + for (String str : preRequisite) { + if (str.isEmpty()) continue; + ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); + preRequisites.add(actionChangeState); + } + return base; + } if (!"open".equalsIgnoreCase(state)) throw new IllegalArgumentException(state+" is not valid state for tomb"); if (!isBlocking(dungeonRoom)) { return Collections.emptySet(); @@ -88,7 +101,7 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker { @Override public Set<String> getPossibleStates(DungeonRoom dungeonRoom) { - return isBlocking(dungeonRoom) ? Collections.singleton("open") : Collections.<String>emptySet(); + return isBlocking(dungeonRoom) ? Sets.newHashSet("open", "navigate") : Sets.newHashSet("navigate"); } @Override public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateArmorStand.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateArmorStand.java new file mode 100755 index 00000000..d0f7b0fb --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateArmorStand.java @@ -0,0 +1,27 @@ +package kr.syeyoung.dungeonsguide.dungeon.mechanics.predicates; + +import com.google.common.base.Predicate; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.entity.passive.EntityBat; +import org.jetbrains.annotations.Nullable; + + +public class PredicateArmorStand implements Predicate<Entity> { + + public static final PredicateArmorStand INSTANCE = new PredicateArmorStand(); + + @Override + public boolean apply(@Nullable Entity input) { + return input instanceof EntityArmorStand; + } + + @Override + public int hashCode() { + return 0; + } + @Override + public boolean equals(Object o) { + return o == this || o != null && (o.getClass() == this.getClass()); + } +} |