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')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBoxSolver.java28
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRiddle.java44
3 files changed, 49 insertions, 25 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java
index 27062e26..117327d1 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java
@@ -80,7 +80,7 @@ public class RoomProcessorBlazeSolver extends GeneralRoomProcessor {
if (next == null) return;
Vec3 pos = next.getPositionEyes(partialTicks);
RenderUtils.drawTextAtWorld("NEXT", (float)pos.xCoord, (float)pos.yCoord, (float)pos.zCoord, 0xFF00ff00, 0.5f, true, false, partialTicks);
- RenderUtils.highlightBlock(next.getPosition(), new Color(0,255,0,50), partialTicks);
+ RenderUtils.highlightBox(next, new Color(0,255,0,50), partialTicks, false);
}
public static class Generator implements RoomProcessorGenerator<RoomProcessorBlazeSolver> {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBoxSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBoxSolver.java
index 43482cce..5d2d479d 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBoxSolver.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBoxSolver.java
@@ -67,22 +67,21 @@ public class RoomProcessorBoxSolver extends GeneralRoomProcessor {
for (Point dir:directions) {
int resX = playerX + dir.x;
int resY = playerY + dir.y;
- if (resX < 0 || resY < 0 || resX >= board[0].length|| resY>=board.length || board[resY][resX] == 2) continue;
-
+ if (resX < 0 || resY < 0 || resX >= board[0].length|| resY>=board.length || (board[resY][resX] > 1 && resY > 0) ||(board[resY][resX] > 3)) continue;
byte[][] copied = new byte[board.length][];
for (int y = 0; y < copied.length; y++)
copied[y] = board[y].clone();
LinkedList<Action> solved = null;
boolean pushed = false;
- copied[playerY][playerX] = 2;
if (board[resY][resX] == 1) {
if (!push(copied, resX, resY, dir.x, dir.y)) {
continue;
}
pushed = true;
solved = solve(copied, playerX, playerY);
- } else if (board[resY][resX] == 0){
+ } else {
+ copied[playerY][playerX] += 2;
solved = solve(copied, resX, resY);
}
if (solved != null) {
@@ -123,16 +122,12 @@ public class RoomProcessorBoxSolver extends GeneralRoomProcessor {
return true;
}
- private int lastPlayerY = 0;
- private Point lastPlayer = null;
-
@Override
public void tick() {
super.tick();
if (bugged) return;
byte[][] currboard = buildCurrentState();
- Point playerPos = getPlayerPos(currboard);
- boolean calculate = lastboard == null || lastPlayerY != Minecraft.getMinecraft().thePlayer.getPosition().getY() || (Minecraft.getMinecraft().thePlayer.getPosition().getY() < 68 && !playerPos.equals(lastPlayer));
+ boolean calculate = lastboard == null;
if (!calculate) {
label:
for (int y = 0; y < 6; y ++) {
@@ -144,18 +139,6 @@ public class RoomProcessorBoxSolver extends GeneralRoomProcessor {
}
}
if (calculate) {
- if (Minecraft.getMinecraft().thePlayer.getPosition().getY() < 68) {
- try {
- LinkedList<Action> semiSolution;
- semiSolution = solve(currboard, playerPos.x, playerPos.y);
- if (semiSolution != null) {
- semiSolution.addFirst(new Move(playerPos.x, playerPos.y));
- solution = semiSolution;
- }
- } catch (Error e) {
- e.printStackTrace();
- }
- } else {
for (int i = 0; i < 7; i++) {
if (currboard[5][i] == 0) {
try {
@@ -169,10 +152,7 @@ public class RoomProcessorBoxSolver extends GeneralRoomProcessor {
}
}
}
- }
}
- lastPlayerY = Minecraft.getMinecraft().thePlayer.getPosition().getY();
- lastPlayer = playerPos;
lastboard = currboard;
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRiddle.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRiddle.java
index a186bce7..3cf87e2f 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRiddle.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRiddle.java
@@ -1,12 +1,21 @@
package kr.syeyoung.dungeonsguide.roomprocessor;
+import com.google.common.base.Predicate;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.roomedit.Parameter;
+import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import kr.syeyoung.dungeonsguide.utils.TextUtils;
+import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
+import net.minecraft.entity.item.EntityArmorStand;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
+import net.minecraft.world.World;
+import org.jetbrains.annotations.Nullable;
+import java.awt.*;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Pattern;
@@ -44,9 +53,44 @@ public class RoomProcessorRiddle extends GeneralRoomProcessor {
}
if (foundMatch) {
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide :::: "+ch2.split(":")[0].trim()+" §fhas the reward!"));
+ final String name = TextUtils.stripColor(ch2.split(":")[0]).replace("[NPC] ","").toLowerCase();
+ final BlockPos low = getDungeonRoom().getMin();
+ final BlockPos high = getDungeonRoom().getMax();
+ World w = getDungeonRoom().getContext().getWorld();
+ System.out.println(name);
+ List<EntityArmorStand> armor = w.getEntities(EntityArmorStand.class, new Predicate<EntityArmorStand>() {
+ @Override
+ public boolean apply(@Nullable EntityArmorStand input) {
+ BlockPos pos = input.getPosition();
+ return low.getX() < pos.getX() && pos.getX() < high.getX()
+ && low.getZ() < pos.getZ() && pos.getZ() < high.getZ() && input.getName().toLowerCase().contains(name);
+ }
+ });
+
+ if (armor != null) {
+ BlockPos pos = armor.get(0).getPosition();
+ for (BlockPos allInBox : BlockPos.getAllInBox(pos.add(-1, -2, -1), pos.add(1, -2, 1))) {
+ Block b = w.getChunkFromBlockCoords(allInBox).getBlock(allInBox);
+
+ if ((b == Blocks.chest || b == Blocks.trapped_chest) && allInBox.distanceSq(pos.add(0,-1,0)) == 1) {
+ this.chest = allInBox;
+ return;
+ }
+ }
+ }
+
}
}
+ BlockPos chest;
+
+ @Override
+ public void drawWorld(float partialTicks) {
+ super.drawWorld(partialTicks);
+ if (chest != null) {
+ RenderUtils.highlightBlock(chest, new Color(0,255,0, 50),partialTicks);
+ }
+ }
public static class Generator implements RoomProcessorGenerator<RoomProcessorRiddle> {
@Override