diff options
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics')
18 files changed, 0 insertions, 1889 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 deleted file mode 100755 index dc201fdb..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java +++ /dev/null @@ -1,154 +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 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.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import lombok.Data; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; - -import java.awt.*; -import java.util.*; -import java.util.List; - -@Data -public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker { - private static final long serialVersionUID = 1161593374765852217L; - private OffsetPointSet secretPoint = new OffsetPointSet(); - private List<String> preRequisite = new ArrayList<String>(); - - - @Override - public Set<Action> getAction(String state, DungeonRoom dungeonRoom) { - if (state.equalsIgnoreCase("navigate")) { - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); - - int leastY = Integer.MAX_VALUE; - OffsetPoint thatPt = null; - for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) { - if (offsetPoint.getY() < leastY) { - thatPt = offsetPoint; - leastY = offsetPoint.getY(); - } - } - ActionMoveNearestAir actionMove = new ActionMoveNearestAir(thatPt); - 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(); - } - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); - { - ActionBreakWithSuperBoom actionClick; - preRequisites.add(actionClick = new ActionBreakWithSuperBoom(getRepresentingPoint(dungeonRoom))); - preRequisites = actionClick.getPreRequisite(); - } - { - - int leastY = Integer.MAX_VALUE; - OffsetPoint thatPt = null; - for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) { - if (offsetPoint.getY() < leastY) { - thatPt = offsetPoint; - leastY = offsetPoint.getY(); - } - } - ActionMoveNearestAir actionMove = new ActionMoveNearestAir(thatPt); - 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) { - 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); - - for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) { - RenderUtils.highlightBlock(offsetPoint.getBlockPos(dungeonRoom), color,partialTicks); - } - } - - @Override - public boolean isBlocking(DungeonRoom dungeonRoom) { - for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) { - if (offsetPoint.getBlock(dungeonRoom) != Blocks.air) return true; - } - return false; - } - - public DungeonBreakableWall clone() throws CloneNotSupportedException { - DungeonBreakableWall dungeonSecret = new DungeonBreakableWall(); - dungeonSecret.secretPoint = (OffsetPointSet) secretPoint.clone(); - dungeonSecret.preRequisite = new ArrayList<String>(preRequisite); - return dungeonSecret; - } - - @Override - public String getCurrentState(DungeonRoom dungeonRoom) { - Block b = Blocks.air; - if (!secretPoint.getOffsetPointList().isEmpty()) - b = secretPoint.getOffsetPointList().get(0).getBlock(dungeonRoom); - - return b == Blocks.air ?"open" :"closed"; - } - - @Override - public Set<String> getPossibleStates(DungeonRoom dungeonRoom) { - return isBlocking(dungeonRoom) ? Sets.newHashSet("navigate", "open") : Sets.newHashSet("navigate"); - } - - @Override - public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) { - return Sets.newHashSet("open", "closed"); - } - - @Override - 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 deleted file mode 100755 index e31cc78e..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDoor.java +++ /dev/null @@ -1,129 +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 com.google.common.collect.Sets; -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 lombok.Data; -import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; - -import java.awt.*; -import java.util.List; -import java.util.*; - -@Data -public class DungeonDoor implements DungeonMechanic, RouteBlocker { - private static final long serialVersionUID = -1011605722415475761L; - private OffsetPointSet secretPoint = new OffsetPointSet(); - private List<String> openPreRequisite = new ArrayList<String>(); - private List<String> closePreRequisite = new ArrayList<String>(); - - - @Override - public Set<Action> 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>(); - { - if (state.equalsIgnoreCase("open")) { - for (String str : openPreRequisite) { - if (str.isEmpty()) continue; - ActionChangeState actionChangeState = new ActionChangeState(str.split(":")[0], str.split(":")[1]); - preRequisites.add(actionChangeState); - } - } else { - for (String str : closePreRequisite) { - 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) { - 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); - - for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) { - RenderUtils.highlightBlock(offsetPoint.getBlockPos(dungeonRoom), color,partialTicks); - } - } - - @Override - public boolean isBlocking(DungeonRoom dungeonRoom) { - for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) { - if (offsetPoint.getBlock(dungeonRoom) != Blocks.air) return true; - } - return false; - } - - public DungeonDoor clone() throws CloneNotSupportedException { - DungeonDoor dungeonSecret = new DungeonDoor(); - dungeonSecret.secretPoint = (OffsetPointSet) secretPoint.clone(); - dungeonSecret.openPreRequisite = new ArrayList<String>(openPreRequisite); - dungeonSecret.closePreRequisite = new ArrayList<String>(closePreRequisite); - return dungeonSecret; - } - - @Override - public String getCurrentState(DungeonRoom dungeonRoom) { - return isBlocking(dungeonRoom) ?"closed":"open"; - } - - - @Override - public Set<String> getPossibleStates(DungeonRoom dungeonRoom) { - String currentStatus = getCurrentState(dungeonRoom); - if (currentStatus.equalsIgnoreCase("closed")) - return Collections.singleton("open"); - else if (currentStatus.equalsIgnoreCase("open")) - return Collections.singleton("closed"); - return Collections.emptySet(); - } - @Override - public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) { - return Sets.newHashSet("open", "closed"); - } - - @Override - public OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom) { - int leastY = Integer.MAX_VALUE; - OffsetPoint thatPt = null; - for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) { - if (offsetPoint.getY() < leastY) { - thatPt = offsetPoint; - leastY = offsetPoint.getY(); - } - } - return thatPt; - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java deleted file mode 100755 index 876764be..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonDummy.java +++ /dev/null @@ -1,105 +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 com.google.common.collect.Sets; -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; -import lombok.Data; -import net.minecraft.util.BlockPos; - -import java.awt.*; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -@Data -public class DungeonDummy implements DungeonMechanic { - private static final long serialVersionUID = -8449664812034435765L; - 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>(); - if (state.equalsIgnoreCase("navigate")){ - ActionMove actionMove = new ActionMove(secretPoint); - preRequisites.add(actionMove); - preRequisites = actionMove.getPreRequisite(); - } else if (state.equalsIgnoreCase("click")) { - ActionClick actionClick = new ActionClick(secretPoint); - 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("D-"+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 DungeonDummy clone() throws CloneNotSupportedException { - DungeonDummy dungeonSecret = new DungeonDummy(); - 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", "click"); - } - @Override - public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) { - return Sets.newHashSet("no-state","navigate,click"); - } - @Override - 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 deleted file mode 100755 index c5270a9c..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java +++ /dev/null @@ -1,102 +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 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; -import net.minecraft.util.BlockPos; - -import java.awt.*; -import java.util.List; -import java.util.*; - -@Data -public class DungeonFairySoul implements DungeonMechanic { - private static final long serialVersionUID = 156412742320519783L; - 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(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 deleted file mode 100755 index 8796bccb..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonJournal.java +++ /dev/null @@ -1,98 +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 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.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import lombok.Data; -import net.minecraft.util.BlockPos; - -import java.awt.*; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -@Data -public class DungeonJournal implements DungeonMechanic { - private static final long serialVersionUID = 4117372070037496743L; - 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>(); - { - 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("J-"+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 DungeonJournal clone() throws CloneNotSupportedException { - DungeonJournal dungeonSecret = new DungeonJournal(); - 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(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 deleted file mode 100755 index 6d50ae78..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java +++ /dev/null @@ -1,130 +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 com.google.common.collect.Sets; -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; -import lombok.Data; -import net.minecraft.util.BlockPos; - -import java.awt.*; -import java.util.List; -import java.util.*; - -@Data -public class DungeonLever implements DungeonMechanic { - private OffsetPoint leverPoint = new OffsetPoint(0,0,0); - private List<String> preRequisite = new ArrayList<String>(); - private String triggering = ""; - - @Override - public Set<Action> 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>(); - ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint(dungeonRoom)); - 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>(); - if (!state.equalsIgnoreCase(getCurrentState(dungeonRoom))){ - ActionClick actionClick; - preRequisites.add(actionClick = new ActionClick(leverPoint)); - preRequisites = actionClick.getPreRequisite(); - } - { - ActionMove actionMove = new ActionMove(leverPoint); - 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 = getLeverPoint().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); - } - - public DungeonLever clone() throws CloneNotSupportedException { - DungeonLever dungeonSecret = new DungeonLever(); - dungeonSecret.leverPoint = (OffsetPoint) leverPoint.clone(); - dungeonSecret.triggering = triggering; - dungeonSecret.preRequisite = new ArrayList<String>(preRequisite); - return dungeonSecret; - } - - - @Override - public String getCurrentState(DungeonRoom dungeonRoom) { - if (triggering == null) triggering = "null"; - DungeonMechanic mechanic = dungeonRoom.getMechanics().get(triggering); - if (mechanic == null) - { - return "undeterminable"; - } else { - String state = mechanic.getCurrentState(dungeonRoom); - if ("open".equalsIgnoreCase(state)) { - return "triggered"; - } else { - return "untriggered"; - } - } - } - - @Override - public Set<String> getPossibleStates(DungeonRoom dungeonRoom) { - String currentStatus = getCurrentState(dungeonRoom); - if (currentStatus.equalsIgnoreCase("untriggered")) - return Sets.newHashSet("navigate", "triggered"); - else if (currentStatus.equalsIgnoreCase("triggered")) - return Sets.newHashSet("navigate","untriggered"); - return Sets.newHashSet("navigate"); - } - @Override - public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) { - return Sets.newHashSet("triggered", "untriggered"); - } - @Override - 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 deleted file mode 100755 index 54cac356..00000000 --- a/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/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonNPC.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonNPC.java deleted file mode 100755 index 6007421f..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonNPC.java +++ /dev/null @@ -1,107 +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 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; -import net.minecraft.util.BlockPos; - -import java.awt.*; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -@Data -public class DungeonNPC implements DungeonMechanic { - private static final long serialVersionUID = -89487601113028763L; - 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 DungeonNPC clone() throws CloneNotSupportedException { - DungeonNPC dungeonSecret = new DungeonNPC(); - 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(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 deleted file mode 100755 index 92634c00..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayDoor.java +++ /dev/null @@ -1,134 +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 com.google.common.collect.Sets; -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 lombok.Data; -import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; - -import java.awt.*; -import java.util.List; -import java.util.*; - -@Data -public class DungeonOnewayDoor implements DungeonMechanic, RouteBlocker { - private static final long serialVersionUID = -1810891721127873330L; - private OffsetPointSet secretPoint = new OffsetPointSet(); - private List<String> preRequisite = new ArrayList<String>(); - - - @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(dungeonRoom)); - 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(); - } - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); - { - 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) { - 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); - - for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) { - RenderUtils.highlightBlock(offsetPoint.getBlockPos(dungeonRoom), color,partialTicks); - } - } - - @Override - public boolean isBlocking(DungeonRoom dungeonRoom) { - for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) { - if (offsetPoint.getBlock(dungeonRoom) != Blocks.air) return true; - } - return false; - } - - public DungeonOnewayDoor clone() throws CloneNotSupportedException { - DungeonOnewayDoor dungeonSecret = new DungeonOnewayDoor(); - dungeonSecret.secretPoint = (OffsetPointSet) secretPoint.clone(); - dungeonSecret.preRequisite = new ArrayList<String>(preRequisite); - return dungeonSecret; - } - - @Override - public String getCurrentState(DungeonRoom dungeonRoom) { - return isBlocking(dungeonRoom) ?"closed":"open"; - } - - - @Override - public Set<String> getPossibleStates(DungeonRoom dungeonRoom) { - String currentStatus = getCurrentState(dungeonRoom); - if (currentStatus.equalsIgnoreCase("closed")) - return Sets.newHashSet("navigate", "open"); - return Sets.newHashSet("navigate"); - } - @Override - public Set<String> getTotalPossibleStates(DungeonRoom dungeonRoom) { - return Sets.newHashSet("open", "closed"); - } - - - @Override - public OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom) { - int leastY = Integer.MAX_VALUE; - OffsetPoint thatPt = null; - for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) { - if (offsetPoint.getY() < leastY) { - thatPt = offsetPoint; - leastY = offsetPoint.getY(); - } - } - return thatPt; - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java deleted file mode 100755 index 00c876c5..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonOnewayLever.java +++ /dev/null @@ -1,129 +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 com.google.common.collect.Sets; -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; -import lombok.Data; -import net.minecraft.util.BlockPos; - -import java.awt.*; -import java.util.*; -import java.util.List; - -@Data -public class DungeonOnewayLever implements DungeonMechanic { - private static final long serialVersionUID = -3203171200265540652L; - private OffsetPoint leverPoint = new OffsetPoint(0,0,0); - private List<String> preRequisite = new ArrayList<String>(); - private String triggering = ""; - - @Override - public Set<Action> 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>(); - ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint(dungeonRoom)); - 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>(); - { - ActionClick actionClick; - preRequisites.add(actionClick = new ActionClick(leverPoint)); - preRequisites = actionClick.getPreRequisite(); - } - { - ActionMove actionMove = new ActionMove(leverPoint); - 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 = getLeverPoint().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); - } - - public DungeonOnewayLever clone() throws CloneNotSupportedException { - DungeonOnewayLever dungeonSecret = new DungeonOnewayLever(); - dungeonSecret.leverPoint = (OffsetPoint) leverPoint.clone(); - dungeonSecret.triggering = triggering; - dungeonSecret.preRequisite = new ArrayList<String>(preRequisite); - return dungeonSecret; - } - - - @Override - public String getCurrentState(DungeonRoom dungeonRoom) { - if (triggering == null) triggering = "null"; - DungeonMechanic mechanic = dungeonRoom.getMechanics().get(triggering); - if (mechanic == null) - { - return "undeterminable"; - } else { - String state = mechanic.getCurrentState(dungeonRoom); - if ("open".equalsIgnoreCase(state)) { - return "triggered"; - } else { - return "untriggered"; - } - } - } - - @Override - public Set<String> getPossibleStates(DungeonRoom dungeonRoom) { - String currentStatus = getCurrentState(dungeonRoom); - if (currentStatus.equalsIgnoreCase("untriggered")) - 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 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 deleted file mode 100755 index 1542513d..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java +++ /dev/null @@ -1,132 +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 com.google.common.collect.Sets; -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; -import lombok.Data; -import net.minecraft.util.BlockPos; - -import java.awt.*; -import java.util.*; -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 List<String> preRequisite = new ArrayList<String>(); - private String triggering = ""; - - @Override - public Set<Action> 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>(); - ActionMoveNearestAir actionMove = new ActionMoveNearestAir(getRepresentingPoint(dungeonRoom)); - 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(); - - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); - 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); - } - } - 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); - } - - public DungeonPressurePlate clone() throws CloneNotSupportedException { - DungeonPressurePlate dungeonSecret = new DungeonPressurePlate(); - dungeonSecret.platePoint = (OffsetPoint) platePoint.clone(); - dungeonSecret.triggering = triggering; - dungeonSecret.preRequisite = new ArrayList<String>(preRequisite); - return dungeonSecret; - } - - - @Override - public String getCurrentState(DungeonRoom dungeonRoom) { - if (triggering == null) triggering = "null"; - DungeonMechanic mechanic = dungeonRoom.getMechanics().get(triggering); - if (mechanic == null) - { - return "undeterminable"; - } else { - String state = mechanic.getCurrentState(dungeonRoom); - if ("open".equalsIgnoreCase(state)) { - return "triggered"; - } else { - return "untriggered"; - } - } - } - - @Override - public Set<String> getPossibleStates(DungeonRoom dungeonRoom) { - String currentStatus = getCurrentState(dungeonRoom); - if (currentStatus.equalsIgnoreCase("triggered")) - return Sets.newHashSet("navigate", "untriggered"); - else if (currentStatus.equalsIgnoreCase("untriggered")) - 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/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java deleted file mode 100644 index 5ff85a13..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java +++ /dev/null @@ -1,99 +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 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 lombok.Getter; -import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; - -import java.awt.*; -import java.util.HashSet; -import java.util.Set; - -public class DungeonRoomDoor implements DungeonMechanic { - @Getter - private final DungeonDoor doorfinder; - private OffsetPoint offsetPoint; - - 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)); - } 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 (offsetPoint == null) { - offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition()); - } - } - - @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; - } - - @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); - } - - @Override - public String getCurrentState(DungeonRoom dungeonRoom) { - return doorfinder.getType().isKeyRequired() ? "key" : "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 offsetPoint; - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java deleted file mode 100755 index 5914be15..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java +++ /dev/null @@ -1,239 +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 com.google.common.collect.Sets; -import kr.syeyoung.dungeonsguide.dungeon.DungeonActionManager; -import kr.syeyoung.dungeonsguide.dungeon.actions.*; -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.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.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.List; - -@Data -public class DungeonSecret implements DungeonMechanic { - private static final long serialVersionUID = 8784808599222706537L; - - 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); - 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); - } else { - dungeonRoom.getRoomContext().put("c-"+pos.toString(), 1); - } - } - } else if (secretType == SecretType.ESSENCE) { - BlockPos pos = secretPoint.getBlockPos(dungeonRoom); - IBlockState blockState = dungeonRoom.getContext().getWorld().getBlockState(pos); - if (blockState.getBlock() == Blocks.skull) { - dungeonRoom.getRoomContext().put("e-"+pos.toString(), true); - } - } else if (secretType == SecretType.ITEM_DROP) { - Vec3 pos = new Vec3(secretPoint.getBlockPos(dungeonRoom)); - Vec3 player = Minecraft.getMinecraft().thePlayer.getPositionVector(); - if (player.squareDistanceTo(pos) < 16) { - Vec3 vec3 = pos.subtract(player).normalize(); - 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); - if (!NodeProcessorDungeonRoom.isValidBlock(blockState)) - return; - } - dungeonRoom.getRoomContext().put("i-" + pos, true); - } - } - } - - 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; - - if (blockState.getBlock() == Blocks.air) { - return SecretStatus.DEFINITELY_NOT; - } else if (blockState.getBlock() != Blocks.chest && blockState.getBlock() != Blocks.trapped_chest) { - return SecretStatus.ERROR; - } else { - TileEntityChest chest = (TileEntityChest) dungeonRoom.getContext().getWorld().getTileEntity(pos); - if (chest.numPlayersUsing > 0) { - return SecretStatus.FOUND; - } else{ - return SecretStatus.CREATED; - } - } - } else if (secretType == SecretType.ESSENCE) { - BlockPos pos = secretPoint.getBlockPos(dungeonRoom); - IBlockState blockState = dungeonRoom.getContext().getWorld().getBlockState(pos); - if (blockState.getBlock() == Blocks.skull) { - dungeonRoom.getRoomContext().put("e-"+pos.toString(), true); - return SecretStatus.DEFINITELY_NOT; - } else { - 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) { - return SecretStatus.FOUND; - } - } - return SecretStatus.NOT_SURE; - } else { - Vec3 pos = new Vec3(secretPoint.getBlockPos(dungeonRoom)); - if (dungeonRoom.getRoomContext().containsKey("i-"+ pos)) - return SecretStatus.FOUND; - Vec3 player = Minecraft.getMinecraft().thePlayer.getPositionVector(); - if (player.squareDistanceTo(pos) < 16) { - Vec3 vec3 = pos.subtract(player).normalize(); - 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); - if (!NodeProcessorDungeonRoom.isValidBlock(blockState)) - return SecretStatus.NOT_SURE; - } - dungeonRoom.getRoomContext().put("i-" + pos, true); - } - return SecretStatus.NOT_SURE; - } - } - - @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(dungeonRoom)); - 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"); - if (state.equals("found") && getSecretStatus(dungeonRoom) == SecretStatus.FOUND) return new HashSet<>(); - Set<Action> base; - Set<Action> preRequisites = base = new HashSet<Action>(); - 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.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); - } - } - 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); - } - - public enum SecretType { - BAT, CHEST, ITEM_DROP, ESSENCE - } - - @AllArgsConstructor - @Getter - public enum SecretStatus { - DEFINITELY_NOT("definitely_not"), NOT_SURE("not_sure"), CREATED("created"), FOUND("found"), ERROR("error"); - - private final String stateName; - } - - public DungeonSecret clone() throws CloneNotSupportedException { - DungeonSecret dungeonSecret = new DungeonSecret(); - dungeonSecret.secretPoint = (OffsetPoint) secretPoint.clone(); - dungeonSecret.secretType = secretType; - dungeonSecret.preRequisite = new ArrayList<String>(preRequisite); - return dungeonSecret; - } - - - @Override - public String getCurrentState(DungeonRoom dungeonRoom) { - return getSecretStatus(dungeonRoom).getStateName(); - } - - @Override - public Set<String> getPossibleStates(DungeonRoom dungeonRoom) { - SecretStatus status = getSecretStatus(dungeonRoom); - 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/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java deleted file mode 100755 index 24bc0d84..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java +++ /dev/null @@ -1,134 +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 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.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import lombok.Data; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; - -import java.awt.*; -import java.util.*; -import java.util.List; - -@Data -public class DungeonTomb implements DungeonMechanic, RouteBlocker { - private static final long serialVersionUID = -7347076019472222115L; - private OffsetPointSet secretPoint = new OffsetPointSet(); - private List<String> preRequisite = new ArrayList<String>(); - - - @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(dungeonRoom)); - 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(); - } - 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); - } - } - return base; - } - - @Override - public void highlight(Color color, String name, DungeonRoom dungeonRoom, float partialTicks) { - 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); - - for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) { - RenderUtils.highlightBlock(offsetPoint.getBlockPos(dungeonRoom), color,partialTicks); - } - } - - @Override - public boolean isBlocking(DungeonRoom dungeonRoom) { - for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) { - if (offsetPoint.getBlock(dungeonRoom) != Blocks.air) return true; - } - return false; - } - - public DungeonTomb clone() throws CloneNotSupportedException { - DungeonTomb dungeonSecret = new DungeonTomb(); - dungeonSecret.secretPoint = (OffsetPointSet) secretPoint.clone(); - dungeonSecret.preRequisite = new ArrayList<String>(preRequisite); - return dungeonSecret; - } - - @Override - public String getCurrentState(DungeonRoom dungeonRoom) { - Block b = Blocks.air; - if (!secretPoint.getOffsetPointList().isEmpty()) - b = secretPoint.getOffsetPointList().get(0).getBlock(dungeonRoom); - 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"); - } - - - @Override - 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/mechanics/RouteBlocker.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/RouteBlocker.java deleted file mode 100755 index 391bda2e..00000000 --- a/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/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateArmorStand.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateArmorStand.java deleted file mode 100755 index 79b20725..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateArmorStand.java +++ /dev/null @@ -1,45 +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.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()); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateBat.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateBat.java deleted file mode 100755 index d9339011..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateBat.java +++ /dev/null @@ -1,44 +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.predicates; - -import com.google.common.base.Predicate; -import net.minecraft.entity.Entity; -import net.minecraft.entity.passive.EntityBat; -import org.jetbrains.annotations.Nullable; - - -public class PredicateBat implements Predicate<Entity> { - - public static final PredicateBat INSTANCE = new PredicateBat(); - - @Override - public boolean apply(@Nullable Entity input) { - return input instanceof EntityBat; - } - - @Override - public int hashCode() { - return 0; - } - @Override - public boolean equals(Object o) { - return o == this || o != null && (o.getClass() == this.getClass()); - } -} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateSuperBoom.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateSuperBoom.java deleted file mode 100755 index b3e27ded..00000000 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateSuperBoom.java +++ /dev/null @@ -1,43 +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.predicates; - -import com.google.common.base.Predicate; -import net.minecraft.item.ItemStack; -import org.jetbrains.annotations.Nullable; - -public class PredicateSuperBoom implements Predicate<ItemStack> { - - public static final PredicateSuperBoom INSTANCE = new PredicateSuperBoom(); - - @Override - public boolean apply(@Nullable ItemStack input) { - return false; - } - - @Override - public int hashCode() { - return 0; - } - - @Override - public boolean equals(Object o) { - return o == this || o != null && (o.getClass() == this.getClass()); - } -} |