aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorsyeyoung <42869671+cyoung06@users.noreply.github.com>2020-11-22 23:08:32 +0900
committersyeyoung <42869671+cyoung06@users.noreply.github.com>2020-11-22 23:08:32 +0900
commit46a86f18ebd62a3771ca4fcb7d1cf17f69b80c73 (patch)
tree7e51cbd93de3c30d95e85b4df4c9eefd4bd3c367 /src/main
parentb46d3d8ce98b112d8c4f1b3ad5eed81b234b1892 (diff)
downloadSkyblock-Dungeons-Guide-46a86f18ebd62a3771ca4fcb7d1cf17f69b80c73.tar.gz
Skyblock-Dungeons-Guide-46a86f18ebd62a3771ca4fcb7d1cf17f69b80c73.tar.bz2
Skyblock-Dungeons-Guide-46a86f18ebd62a3771ca4fcb7d1cf17f69b80c73.zip
Debug
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/EventListener.java16
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java17
2 files changed, 32 insertions, 1 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java b/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java
index 9cb73aa1..42705f78 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/EventListener.java
@@ -6,6 +6,8 @@ import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoom;
import kr.syeyoung.dungeonsguide.utils.MapUtils;
import kr.syeyoung.dungeonsguide.utils.RenderUtils;
import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.EntityPlayerSP;
+import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.texture.DynamicTexture;
@@ -55,6 +57,20 @@ public class EventListener {
GlStateManager.enableAlpha();
GuiScreen.drawModalRectWithCustomSizedTexture(0,0, 0, 0, 128, 128, 128, 128);
+ if (skyblockStatus.getContext() != null) {
+ DungeonContext context = skyblockStatus.getContext();
+ EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
+ Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition());
+
+ DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt);
+ FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj;
+ if (dungeonRoom == null) {
+ fontRenderer.drawString("Where are you?!", 5, 128, 0xFFFFFF);
+ } else {
+ fontRenderer.drawString("you're in the room... "+dungeonRoom.getColor()+" / "+dungeonRoom.getShape(), 5, 128, 0xFFFFFF);
+ }
+
+ }
}
@SubscribeEvent
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java
index a3e0d961..7cfbdfba 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java
@@ -1,6 +1,7 @@
package kr.syeyoung.dungeonsguide.dungeon;
import com.google.common.collect.Sets;
+import jdk.nashorn.internal.ir.Block;
import kr.syeyoung.dungeonsguide.DungeonsGuide;
import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoom;
import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DoorFinderRegistry;
@@ -145,6 +146,9 @@ public class MapProcessor {
public BlockPos roomPointToWorldPoint(Point roomPoint) {
return new BlockPos(context.getDungeonMin().getX() +(roomPoint.x * 32), context.getDungeonMin().getY(), context.getDungeonMin().getZ() +(roomPoint.y *32));
}
+ public Point worldPointToRoomPoint(BlockPos worldPoint) {
+ return new Point((worldPoint.getX() - context.getDungeonMin().getX()) / 32, (worldPoint.getZ() - context.getDungeonMin().getZ()) / 32);
+ }
private void processMap(byte[] mapData) {
int height = (int)((128.0 - topLeftMapPoint.y) / (unitRoomDimension.height + doorDimension.height));
@@ -160,7 +164,18 @@ public class MapProcessor {
if (color != 0 && color != 85) {
MapUtils.record(mapData, mapPoint.x, mapPoint.y, new Color(0,255,255,80));
DungeonRoom rooms = buildRoom(mapData, new Point(x,y));
- Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("New Map discovered! shape: "+rooms.getShape()+ " color: "+rooms.getColor()+" min: "+rooms.getMin()+" / "+x+","+y));
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("New Map discovered! shape: "+rooms.getShape()+ " color: "+rooms.getColor()+" unitPos: "+x+","+y));
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("New Map discovered! mapMin: "+rooms.getMin()));
+ StringBuilder builder = new StringBuilder();
+ for (int dy =0;dy<4;dy++) {
+ for (int dx = 0; dx < 4; dx ++) {
+ boolean isSet = ((rooms.getShape() >> (dy * 4 + dx)) & 0x1) != 0;
+ builder.append(isSet ? "O" : "X");
+ }
+ builder.append("\n");
+ }
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Shape visual: "+builder.toString()));
+
context.getDungeonRoomList().add(rooms);
for (Point p:rooms.getUnitPoints()) {
roomsFound.add(p);