diff options
author | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-12-14 18:06:15 +0900 |
---|---|---|
committer | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-12-14 18:06:15 +0900 |
commit | 219f145634b856fdeb35faafa91dbaeeb4b328e2 (patch) | |
tree | 796a5244a582d7593f7d41f2cd86f5cfb46bd349 /src | |
parent | d4881007dbf02c7080eae8176a43a71ff5738045 (diff) | |
download | Skyblock-Dungeons-Guide-219f145634b856fdeb35faafa91dbaeeb4b328e2.tar.gz Skyblock-Dungeons-Guide-219f145634b856fdeb35faafa91dbaeeb4b328e2.tar.bz2 Skyblock-Dungeons-Guide-219f145634b856fdeb35faafa91dbaeeb4b328e2.zip |
mechanics
Diffstat (limited to 'src')
7 files changed, 194 insertions, 5 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 75364b36..6afb976f 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonBreakableWall.java @@ -10,6 +10,7 @@ import kr.syeyoung.dungeonsguide.dungeon.mechanics.predicates.PredicateSuperBoom 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; @@ -56,7 +57,8 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker { if (secretPoint.getOffsetPointList().isEmpty()) return; OffsetPoint firstpt = secretPoint.getOffsetPointList().get(0); BlockPos pos = firstpt.getBlockPos(dungeonRoom); - RenderUtils.drawTextAtWorld(name, pos.getX() +0.5f, pos.getY()+0f, pos.getZ()+0.5f, 0xFF000000, 2f, true, false, partialTicks); + RenderUtils.drawTextAtWorld(name, pos.getX() +0.5f, pos.getY()+0.25f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); + RenderUtils.drawTextAtWorld(getCurrentState(dungeonRoom), pos.getX() +0.5f, pos.getY()+0.75f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) { RenderUtils.highlightBlock(offsetPoint.getBlockPos(dungeonRoom), color,partialTicks); @@ -77,4 +79,13 @@ public class DungeonBreakableWall implements DungeonMechanic, RouteBlocker { 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 ?"broken" :"blocking"; + } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java new file mode 100644 index 00000000..a7662831 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonLever.java @@ -0,0 +1,79 @@ +package kr.syeyoung.dungeonsguide.dungeon.mechanics; + +import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.action.*; +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 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 (!("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>(); + { + 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) { + 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) { + + DungeonMechanic mechanic = dungeonRoom.getDungeonRoomInfo().getMechanics().get(triggering); + if (mechanic == null) + { + return "undeterminable"; + } else { + String state = mechanic.getCurrentState(dungeonRoom); + if ("broken".equalsIgnoreCase(state)) { + return "triggered"; + } else { + return "untriggered"; + } + } + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java index 851803ef..232af04b 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonMechanic.java @@ -10,4 +10,6 @@ public interface DungeonMechanic { Set<Action> getAction(String state, DungeonRoom dungeonRoom); void highlight(Color color, String name, DungeonRoom dungeonRoom, float partialTicks); + + String getCurrentState(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 new file mode 100644 index 00000000..0b68f855 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonPressurePlate.java @@ -0,0 +1,79 @@ +package kr.syeyoung.dungeonsguide.dungeon.mechanics; + +import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.action.*; +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 DungeonPressurePlate implements DungeonMechanic { + 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 (!("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 ("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) { + 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) { + + DungeonMechanic mechanic = dungeonRoom.getDungeonRoomInfo().getMechanics().get(triggering); + if (mechanic == null) + { + return "undeterminable"; + } else { + String state = mechanic.getCurrentState(dungeonRoom); + if ("broken".equalsIgnoreCase(state)) { + return "triggered"; + } else { + return "untriggered"; + } + } + } +} 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 c1c717e0..90adb774 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonSecret.java @@ -8,6 +8,7 @@ import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.roomedit.EditingContext; import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Data; +import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.passive.EntityBat; @@ -82,8 +83,9 @@ public class DungeonSecret implements DungeonMechanic { 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()+1f, pos.getZ()+0.5f, 0xFF000000, 2f, true, false, partialTicks); - RenderUtils.drawTextAtWorld(name, pos.getX() +0.5f, pos.getY()+0f, pos.getZ()+0.5f, 0xFF000000, 2f, true, false, 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 static enum SecretType { @@ -101,4 +103,10 @@ public class DungeonSecret implements DungeonMechanic { dungeonSecret.preRequisite = new ArrayList<String>(preRequisite); return dungeonSecret; } + + + @Override + public String getCurrentState(DungeonRoom dungeonRoom) { + return getSecretStatus(dungeonRoom).name(); + } } 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 55b79e59..6ae34a71 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonTomb.java @@ -9,6 +9,7 @@ import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.roomedit.EditingContext; import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Data; +import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.passive.EntityBat; @@ -60,7 +61,8 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker { if (secretPoint.getOffsetPointList().isEmpty()) return; OffsetPoint firstpt = secretPoint.getOffsetPointList().get(0); BlockPos pos = firstpt.getBlockPos(dungeonRoom); - RenderUtils.drawTextAtWorld(name, pos.getX() +0.5f, pos.getY()+0f, pos.getZ()+0.5f, 0xFF000000, 2f, true, false, partialTicks); + RenderUtils.drawTextAtWorld(name, pos.getX() +0.5f, pos.getY()+0.5f, pos.getZ()+0.25f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); + RenderUtils.drawTextAtWorld(getCurrentState(dungeonRoom), pos.getX() +0.5f, pos.getY()+0.75f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); for (OffsetPoint offsetPoint : secretPoint.getOffsetPointList()) { RenderUtils.highlightBlock(offsetPoint.getBlockPos(dungeonRoom), color,partialTicks); @@ -81,4 +83,12 @@ public class DungeonTomb implements DungeonMechanic, RouteBlocker { 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 ?"broken" :"blocking"; + } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/SecretEditPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/SecretEditPane.java index 33dcdc00..8ee6e116 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/SecretEditPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/SecretEditPane.java @@ -59,7 +59,7 @@ public class SecretEditPane extends MPanel implements DynamicEditor { @Override public void run() { DungeonRoomInfo dungeonRoomInfo = dungeonRoom.getDungeonRoomInfo(); - dungeonRoomInfo.getProperties().clear(); + dungeonRoomInfo.getMechanics().clear(); for (MParameter parameter : parameters) { Parameter real = parameter.getParameter(); |