aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/roomprocessor')
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/roomprocessor/ProcessorFactory.java1
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorButtonSolver.java112
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorBonzo.java5
3 files changed, 113 insertions, 5 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/ProcessorFactory.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/ProcessorFactory.java
index 6574c170..6415eb6f 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/ProcessorFactory.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/ProcessorFactory.java
@@ -26,6 +26,7 @@ public class ProcessorFactory {
static {
registerRoomProcessor("default", new GeneralRoomProcessor.Generator());
+ registerRoomProcessor("button_5", new RoomProcessorButtonSolver.Generator());
registerRoomProcessor("puzzle_water_solver", new RoomProcessorWaterPuzzle.Generator());
registerRoomProcessor("puzzle_teleport_solver", new RoomProcessorTeleportMazeSolver.Generator());
registerRoomProcessor("puzzle_riddle_solver", new RoomProcessorRiddle.Generator());
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorButtonSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorButtonSolver.java
new file mode 100644
index 00000000..92bd9edb
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorButtonSolver.java
@@ -0,0 +1,112 @@
+package kr.syeyoung.dungeonsguide.roomprocessor;
+
+import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet;
+import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.IChatComponent;
+import net.minecraftforge.event.entity.player.PlayerInteractEvent;
+
+import java.awt.*;
+import java.util.Arrays;
+
+public class RoomProcessorButtonSolver extends GeneralRoomProcessor {
+ public RoomProcessorButtonSolver(DungeonRoom dungeonRoom) {
+ super(dungeonRoom);
+
+ OffsetPointSet ops = (OffsetPointSet) dungeonRoom.getDungeonRoomInfo().getProperties().get("buttons");
+ if (ops == null) {
+ bugged = true;
+ return;
+ }
+
+ buttons = new BlockPos[12];
+ woods = new BlockPos[12];
+ for (int i = 0; i < ops.getOffsetPointList().size(); i++) {
+ buttons[i] = ops.getOffsetPointList().get(i).getBlockPos(dungeonRoom);
+ woods[i] = buttons[i].add(0,-1,0);
+ }
+ }
+
+ private boolean bugged;
+
+ private BlockPos[] buttons;
+ private BlockPos[] woods;
+
+ private long clicked;
+ private int clickedButton = -1;
+
+ private int[] result = new int[12];
+
+ @Override
+ public void onInteractBlock(PlayerInteractEvent event) {
+ super.onInteractBlock(event);
+ if (bugged) return;
+
+ if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) return;
+ for (int i = 0; i < buttons.length; i++) {
+ if (event.pos.equals(buttons[i])) {
+ clicked = System.currentTimeMillis();
+ clickedButton = i;
+ return;
+ }
+ }
+ }
+
+ @Override
+ public void chatReceived(IChatComponent chat) {
+ super.chatReceived(chat);
+ if (bugged) return;
+
+ if (clickedButton == -1) return;
+ if (clicked + 500 < System.currentTimeMillis()) return;
+
+ String msg = chat.getFormattedText();
+ if (msg.equals("§r§cThis button doesn't seem to do anything...§r")) {
+ result[clickedButton] = -1;
+ clickedButton = -1;
+ } else if (msg.equals("§r§aThis button seems connected to something§r")) {
+ Arrays.fill(result, -1);
+ if (clickedButton % 4 != 0) result[clickedButton - 1] = 1;
+ if (clickedButton % 4 != 3) result[clickedButton + 1] = 1;
+ clickedButton = -1;
+ } else if (msg.equals("§r§aClick! you Hear the sound of a door opening§r")) {
+ Arrays.fill(result, -1);
+ result[clickedButton] = 2;
+ clickedButton = -1;
+ }
+ }
+
+ @Override
+ public void drawWorld(float partialTicks) {
+ super.drawWorld(partialTicks);
+ if (bugged) return;
+ if (Minecraft.getMinecraft().thePlayer.getPosition().distanceSq(woods[6]) > 100) return;
+
+
+ for (int i = 0; i < woods.length; i++) {
+ int data = result[i];
+ BlockPos pos = woods[i];
+
+ if (data == 0) {
+ RenderUtils.highlightBlock(pos, new Color(0, 255, 255, 50), partialTicks, false);
+ } else if (data == -1) {
+ RenderUtils.highlightBlock(pos, new Color(255, 0, 0, 50), partialTicks, false);
+ } else if (data == 1) {
+ RenderUtils.highlightBlock(pos, new Color(0, 255, 0, 50), partialTicks, false);
+ } else if (data == 2) {
+ RenderUtils.highlightBlock(pos, new Color(0, 255, 0, 100), partialTicks, false);
+ }
+ }
+ }
+
+ public static class Generator implements RoomProcessorGenerator<RoomProcessorButtonSolver> {
+ @Override
+ public RoomProcessorButtonSolver createNew(DungeonRoom dungeonRoom) {
+ RoomProcessorButtonSolver defaultRoomProcessor = new RoomProcessorButtonSolver(dungeonRoom);
+ return defaultRoomProcessor;
+ }
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorBonzo.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorBonzo.java
index a7efef0c..05722565 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorBonzo.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorBonzo.java
@@ -15,11 +15,6 @@ public class BossfightProcessorBonzo extends GeneralBossfightProcessor {
.signatureMsg("§r§c[BOSS] Bonzo §r§f: Gratz for making it this far, but I’m basically unbeatable.§r")
.nextPhase("fight-1").build()
);
- /*
- * §r§cThis button doesn't seem to do anything...§r
- * §r§aThis button seems connected to something§r
- * §r§aClick! you Hear the sound of a door opening§r
- * */
addPhase(GeneralBossfightProcessor.PhaseData.builder()
.phase("fight-1")