aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung
diff options
context:
space:
mode:
authorsyeyoung <42869671+cyoung06@users.noreply.github.com>2020-11-30 17:12:11 +0900
committersyeyoung <42869671+cyoung06@users.noreply.github.com>2020-11-30 17:12:11 +0900
commitab797402af6b7169a29240a0dcee6a02875ebfa6 (patch)
tree428f20f399185883d9bbc72b2a1d55ab751cfd94 /src/main/java/kr/syeyoung
parent6bd059a0459607917081239db756ee47548935b0 (diff)
downloadSkyblock-Dungeons-Guide-ab797402af6b7169a29240a0dcee6a02875ebfa6.tar.gz
Skyblock-Dungeons-Guide-ab797402af6b7169a29240a0dcee6a02875ebfa6.tar.bz2
Skyblock-Dungeons-Guide-ab797402af6b7169a29240a0dcee6a02875ebfa6.zip
AUAUSDASJD
Diffstat (limited to 'src/main/java/kr/syeyoung')
-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
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java80
4 files changed, 129 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
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java
index 1de06e66..d2dbeb39 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java
@@ -10,6 +10,7 @@ import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
+import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.Vec3;
import org.lwjgl.opengl.GL11;
@@ -247,6 +248,85 @@ public class RenderUtils {
//...
}
+
+ public static void highlightBox(Entity entity, Color c, float partialTicks, boolean depth) {
+ Entity viewing_from = Minecraft.getMinecraft().getRenderViewEntity();
+
+ double x_fix = viewing_from.lastTickPosX + ((viewing_from.posX - viewing_from.lastTickPosX) * partialTicks);
+ double y_fix = viewing_from.lastTickPosY + ((viewing_from.posY - viewing_from.lastTickPosY) * partialTicks);
+ double z_fix = viewing_from.lastTickPosZ + ((viewing_from.posZ - viewing_from.lastTickPosZ) * partialTicks);
+
+ GlStateManager.pushMatrix();
+ GlStateManager.pushAttrib();
+ GlStateManager.translate(-x_fix, -y_fix, -z_fix);
+
+ GlStateManager.disableLighting();
+ GlStateManager.enableBlend();
+ GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GlStateManager.disableTexture2D();
+
+ if (!depth) {
+ GL11.glDisable(GL11.GL_DEPTH_TEST);
+ GL11.glDepthMask(false);
+ }
+ GL11.glColor4ub((byte)c.getRed(), (byte)c.getGreen(), (byte)c.getBlue(), (byte)c.getAlpha());
+
+ AxisAlignedBB axisAlignedBB = AxisAlignedBB.fromBounds(-0.4,-1.5,-0.4,0.4,0,0.4);
+ GL11.glTranslated(-0.4 + entity.posX, -1.5 + entity.posY, -0.4 + entity.posZ);
+
+ double x = 0.8;
+ double y = 1.5;
+ double z = 0.8;
+ GL11.glBegin(GL11.GL_QUADS);
+ GL11.glVertex3d(0, 0, 0);
+ GL11.glVertex3d(0, 0, z);
+ GL11.glVertex3d(0, y, z);
+ GL11.glVertex3d(0, y, 0); // TOP LEFT / BOTTOM LEFT / TOP RIGHT/ BOTTOM RIGHT
+
+ GL11.glVertex3d(x, 0, z);
+ GL11.glVertex3d(x, 0, 0);
+ GL11.glVertex3d(x, y, 0);
+ GL11.glVertex3d(x, y, z);
+
+ GL11.glVertex3d(0, y, z);
+ GL11.glVertex3d(0, 0, z);
+ GL11.glVertex3d(x, 0, z);
+ GL11.glVertex3d(x, y, z); // TOP LEFT / BOTTOM LEFT / TOP RIGHT/ BOTTOM RIGHT
+
+ GL11.glVertex3d(0, 0, 0);
+ GL11.glVertex3d(0, y, 0);
+ GL11.glVertex3d(x, y, 0);
+ GL11.glVertex3d(x, 0, 0);
+
+ GL11.glVertex3d(0,y,0);
+ GL11.glVertex3d(0,y,z);
+ GL11.glVertex3d(x,y,z);
+ GL11.glVertex3d(x,y,0);
+
+ GL11.glVertex3d(0,0,z);
+ GL11.glVertex3d(0,0,0);
+ GL11.glVertex3d(x,0,0);
+ GL11.glVertex3d(x,0,z);
+
+
+
+ GL11.glEnd();
+
+
+ if (!depth) {
+ GL11.glDisable(GL11.GL_DEPTH_TEST);
+ GL11.glDepthMask(true);
+ }
+ GlStateManager.enableTexture2D();
+ GlStateManager.disableBlend();
+ GlStateManager.enableLighting();
+ GlStateManager.popMatrix();
+ GlStateManager.popAttrib();
+
+
+//...
+
+ }
public static void drawTextAtWorld(String text, float x, float y, float z, int color, float scale, boolean increase, boolean renderBlackBox, float partialTicks) {
float lScale = scale;