aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-01-30 16:48:06 +0900
committersyeyoung <cyong06@naver.com>2021-01-30 16:48:06 +0900
commit4dc90bc278a2ae0789ca9b810cc7af7d28b28ab2 (patch)
treeb51071d8fafd13b783c08eedcb12fd6b183c86b3 /src/main/java/kr
parentb5df27751269c372191dc26491121eb052138e03 (diff)
downloadSkyblock-Dungeons-Guide-4dc90bc278a2ae0789ca9b810cc7af7d28b28ab2.tar.gz
Skyblock-Dungeons-Guide-4dc90bc278a2ae0789ca9b810cc7af7d28b28ab2.tar.bz2
Skyblock-Dungeons-Guide-4dc90bc278a2ae0789ca9b810cc7af7d28b28ab2.zip
Advanced stuff and brand command
Diffstat (limited to 'src/main/java/kr')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java4
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java31
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java6
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java61
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomCoordDisplay.java66
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomDebugInfo.java72
6 files changed, 210 insertions, 30 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java
index 5273bbe4..2a12c3a1 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java
@@ -81,6 +81,9 @@ public class CommandDungeonsGuide extends CommandBase {
e.printStackTrace();
}
sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fReloaded Ah data"));
+ } else if (args[0].equalsIgnoreCase("brand")) {
+ String serverBrand = Minecraft.getMinecraft().thePlayer.getClientBrand();
+ sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e"+serverBrand));
} else {
sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg §7-§fOpens configuration gui"));
sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg gui §7-§fOpens configuration gui"));
@@ -88,6 +91,7 @@ public class CommandDungeonsGuide extends CommandBase {
sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg saverooms §7-§f Saves usergenerated dungeon roomdata."));
sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg loadrooms §7-§f Reloads dungeon roomdata."));
sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg reloadah §7-§f Reloads price data from server."));
+ sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg brand §7-§f View server brand."));
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java
index 7995d09d..d59d0b3d 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java
@@ -137,24 +137,12 @@ public class DungeonListener {
} catch (Throwable e2) {e2.printStackTrace();}
}
- DynamicTexture dynamicTexture = new DynamicTexture(128, 128);
- ResourceLocation location = Minecraft.getMinecraft().renderEngine.getDynamicTextureLocation("dungeons/map/", dynamicTexture);
@SubscribeEvent
public void onRender(RenderGameOverlayEvent.Post postRender) {
try {
if (postRender.type != RenderGameOverlayEvent.ElementType.TEXT) return;
SkyblockStatus skyblockStatus = (SkyblockStatus) e.getDungeonsGuide().getSkyblockStatus();
if (!skyblockStatus.isOnDungeon()) return;
- if (FeatureRegistry.DEBUG.isEnabled()) {
- GlStateManager.pushMatrix();
- int[] textureData = dynamicTexture.getTextureData();
- MapUtils.getImage().getRGB(0, 0, 128, 128, textureData, 0, 128);
- dynamicTexture.updateDynamicTexture();
- Minecraft.getMinecraft().getTextureManager().bindTexture(location);
- GlStateManager.enableAlpha();
- GuiScreen.drawModalRectWithCustomSizedTexture(0, 0, 0, 0, 128, 128, 128, 128);
- GlStateManager.popMatrix();
- }
if (skyblockStatus.getContext() != null) {
DungeonContext context = skyblockStatus.getContext();
@@ -163,24 +151,7 @@ public class DungeonListener {
if (context.getBossfightProcessor() != null) context.getBossfightProcessor().drawScreen(postRender.partialTicks);
DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt);
- FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj;
- if (dungeonRoom == null) {
- if (FeatureRegistry.DEBUG.isEnabled() && context.getBossfightProcessor() == null) {
- fontRenderer.drawString("Where are you?!", 5, 128, 0xFFFFFF);
- } else if (FeatureRegistry.DEBUG.isEnabled() && context.getBossfightProcessor() != null){
- fontRenderer.drawString("You're prob in bossfight", 5, 128, 0xFFFFFF);
- fontRenderer.drawString("processor: "+context.getBossfightProcessor(), 5, 138, 0xFFFFFF);
- fontRenderer.drawString("phase: "+context.getBossfightProcessor().getCurrentPhase(), 5, 148, 0xFFFFFF);
- fontRenderer.drawString("nextPhase: "+ StringUtils.join(context.getBossfightProcessor().getNextPhases(), ","), 5, 158, 0xFFFFFF);
- fontRenderer.drawString("phases: "+ StringUtils.join(context.getBossfightProcessor().getPhases(), ","), 5, 168, 0xFFFFFF);
- }
- } else {
- if (FeatureRegistry.DEBUG.isEnabled()) {
- fontRenderer.drawString("you're in the room... color/shape " + dungeonRoom.getColor() + " / " + dungeonRoom.getShape(), 5, 128, 0xFFFFFF);
- fontRenderer.drawString("room uuid: " + dungeonRoom.getDungeonRoomInfo().getUuid() + (dungeonRoom.getDungeonRoomInfo().isRegistered() ? "" : " (not registered)"), 5, 138, 0xFFFFFF);
- fontRenderer.drawString("room name: " + dungeonRoom.getDungeonRoomInfo().getName(), 5, 148, 0xFFFFFF);
- fontRenderer.drawString("room state / max secret: " + dungeonRoom.getCurrentState() + " / "+dungeonRoom.getTotalSecrets(), 5, 158, 0xFFFFFF);
- }
+ if (dungeonRoom != null) {
if (dungeonRoom.getRoomProcessor() != null) {
dungeonRoom.getRoomProcessor().drawScreen(postRender.partialTicks);
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
index 56939cb2..5a791c99 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
@@ -1,5 +1,8 @@
package kr.syeyoung.dungeonsguide.features;
+import kr.syeyoung.dungeonsguide.features.impl.advanced.FeatureDebuggableMap;
+import kr.syeyoung.dungeonsguide.features.impl.advanced.FeatureRoomCoordDisplay;
+import kr.syeyoung.dungeonsguide.features.impl.advanced.FeatureRoomDebugInfo;
import kr.syeyoung.dungeonsguide.features.impl.boss.FeatureAutoReparty;
import kr.syeyoung.dungeonsguide.features.impl.boss.FeatureBossHealth;
import kr.syeyoung.dungeonsguide.features.impl.boss.FeatureBoxRealLivid;
@@ -41,6 +44,9 @@ public class FeatureRegistry {
public static final SimpleFeature DEBUG = register(new SimpleFeature("hidden", "Debug", "Toggles debug mode", "debug", false));
public static final SimpleFeature ADVANCED_ROOMEDIT = register(new SimpleFeature("advanced", "Room Edit", "Allow editing dungeon rooms\n\nWarning: using this feature can break or freeze your Minecraft\nThis is only for advanced users only", "advanced.roomedit", false));
+ public static final FeatureRoomDebugInfo ADVANCED_DEBUG_ROOM = register(new FeatureRoomDebugInfo());
+ public static final FeatureDebuggableMap ADVANCED_DEBUGGABLE_MAP = register(new FeatureDebuggableMap());
+ public static final FeatureRoomCoordDisplay ADVANCED_COORDS = register(new FeatureRoomCoordDisplay());
public static final SimpleFeature SOLVER_RIDDLE = register(new SimpleFeature("solver", "Riddle Puzzle (3 weirdo) Solver", "Highlights the correct box after clicking on all 3 weirdos", "solver.riddle"));
public static final SimpleFeature SOLVER_KAHOOT = register(new SimpleFeature("solver", "Trivia Puzzle (Omnicrescent) Solver", "Highlights the correct solution for trivia puzzle", "solver.trivia"));
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java
new file mode 100644
index 00000000..ffbf6f37
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java
@@ -0,0 +1,61 @@
+package kr.syeyoung.dungeonsguide.features.impl.advanced;
+
+import kr.syeyoung.dungeonsguide.SkyblockStatus;
+import kr.syeyoung.dungeonsguide.config.types.AColor;
+import kr.syeyoung.dungeonsguide.dungeon.DungeonContext;
+import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.e;
+import kr.syeyoung.dungeonsguide.features.FeatureParameter;
+import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
+import kr.syeyoung.dungeonsguide.features.GuiFeature;
+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.Gui;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.renderer.texture.DynamicTexture;
+import net.minecraft.util.ResourceLocation;
+import org.apache.commons.lang3.StringUtils;
+import org.lwjgl.opengl.GL11;
+
+import java.awt.*;
+
+public class FeatureDebuggableMap extends GuiFeature {
+ public FeatureDebuggableMap() {
+ super("advanced", "Display Debug info included map", "ONLY WORKS WITH SECRET SETTING", "advanced.debug.map", true, 128, 128);
+ this.setEnabled(false);
+ }
+
+
+ DynamicTexture dynamicTexture = new DynamicTexture(128, 128);
+ ResourceLocation location = Minecraft.getMinecraft().renderEngine.getDynamicTextureLocation("dungeons/map/", dynamicTexture);
+
+ SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
+ @Override
+ public void drawHUD(float partialTicks) {
+ if (!skyblockStatus.isOnDungeon()) return;
+ if (!FeatureRegistry.DEBUG.isEnabled()) return;
+ DungeonContext context = skyblockStatus.getContext();
+ if (context == null) return;
+
+ GlStateManager.pushMatrix();
+ int[] textureData = dynamicTexture.getTextureData();
+ MapUtils.getImage().getRGB(0, 0, 128, 128, textureData, 0, 128);
+ dynamicTexture.updateDynamicTexture();
+ Minecraft.getMinecraft().getTextureManager().bindTexture(location);
+ GlStateManager.enableAlpha();
+ GuiScreen.drawModalRectWithCustomSizedTexture(0, 0, 0, 0, 128, 128, 128, 128);
+ GlStateManager.popMatrix();
+ }
+
+ @Override
+ public void drawDemo(float partialTicks) {
+ FontRenderer fr = getFontRenderer();
+ fr.drawString("Please join a dungeon to see preview", getFeatureRect().width / 2 - fr.getStringWidth("Please join a dungeon to see preview") / 2, getFeatureRect().height / 2 - fr.FONT_HEIGHT / 2, 0xFFFFFFFF);
+ GL11.glLineWidth(2);
+ RenderUtils.drawUnfilledBox(0,0,getFeatureRect().width, getFeatureRect().height, 0xff000000, false);
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomCoordDisplay.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomCoordDisplay.java
new file mode 100644
index 00000000..ba107312
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomCoordDisplay.java
@@ -0,0 +1,66 @@
+package kr.syeyoung.dungeonsguide.features.impl.advanced;
+
+import kr.syeyoung.dungeonsguide.SkyblockStatus;
+import kr.syeyoung.dungeonsguide.dungeon.DungeonContext;
+import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint;
+import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.e;
+import kr.syeyoung.dungeonsguide.features.FeatureParameter;
+import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
+import kr.syeyoung.dungeonsguide.features.GuiFeature;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.EntityPlayerSP;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.MathHelper;
+import org.apache.commons.lang3.StringUtils;
+
+import java.awt.*;
+
+public class FeatureRoomCoordDisplay extends GuiFeature {
+ public FeatureRoomCoordDisplay() {
+ super("advanced", "Display Coordinate Relative to the Dungeon Room and room's rotation", "X: 0 Y: 3 Z: 5 Facing: Z+" , "advanced.coords", false, getFontRenderer().getStringWidth("X: 48 Y: 100 Z: 48 Facing: Z+"), 10);
+ this.setEnabled(false);
+ parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.yellow, "color"));
+ }
+
+ SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
+ private static final String[] facing = {"Z+", "X-", "Z-", "X+"};
+ @Override
+ public void drawHUD(float partialTicks) {
+ if (!skyblockStatus.isOnDungeon()) return;
+ DungeonContext context = skyblockStatus.getContext();
+ if (context == null) return;
+
+ EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
+ Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition());
+ DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt);
+ if (dungeonRoom == null) {
+ return;
+ }
+
+ int facing = (int) (thePlayer.rotationYaw + 45) % 360;
+ if (facing < 0) facing += 360;
+ int real = (facing / 90 + dungeonRoom.getRoomMatcher().getRotation()) % 4;
+
+ OffsetPoint offsetPoint = new OffsetPoint(dungeonRoom, new BlockPos((int)thePlayer.posX, (int)thePlayer.posY, (int)thePlayer.posZ));
+
+ FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj;
+
+ double scale = getFeatureRect().getHeight() / fontRenderer.FONT_HEIGHT;
+ GlStateManager.scale(scale, scale, 0);
+
+ int color = this.<Color>getParameter("color").getValue().getRGB();
+ fontRenderer.drawString("X: "+offsetPoint.getX()+" Y: "+offsetPoint.getY()+" Z: "+offsetPoint.getZ()+" Facing: "+ FeatureRoomCoordDisplay.facing[real], 0, 0, color);
+ }
+
+ @Override
+ public void drawDemo(float partialTicks) {
+ FontRenderer fr = getFontRenderer();
+ int facing = (int) (Minecraft.getMinecraft().thePlayer.rotationYaw + 45) % 360;
+ if (facing < 0) facing += 360;
+ fr.drawString("X: 0 Y: 3 Z: 5 Facing: "+FeatureRoomCoordDisplay.facing[(facing / 90) % 4], 0,0, this.<Color>getParameter("color").getValue().getRGB());
+ }
+
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomDebugInfo.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomDebugInfo.java
new file mode 100644
index 00000000..3fc92f8f
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomDebugInfo.java
@@ -0,0 +1,72 @@
+package kr.syeyoung.dungeonsguide.features.impl.advanced;
+
+import kr.syeyoung.dungeonsguide.SkyblockStatus;
+import kr.syeyoung.dungeonsguide.dungeon.DungeonContext;
+import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.e;
+import kr.syeyoung.dungeonsguide.features.FeatureParameter;
+import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
+import kr.syeyoung.dungeonsguide.features.GuiFeature;
+import kr.syeyoung.dungeonsguide.features.listener.ChatListener;
+import kr.syeyoung.dungeonsguide.utils.TextUtils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.EntityPlayerSP;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.util.ChatComponentText;
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import org.apache.commons.lang3.StringUtils;
+
+import java.awt.*;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class FeatureRoomDebugInfo extends GuiFeature {
+ public FeatureRoomDebugInfo() {
+ super("advanced", "Display Room Debug Info", "ONLY WORKS WITH SECRET SETTING", "advanced.debug.roominfo", false, getFontRenderer().getStringWidth("longestplayernamepos: 100"), getFontRenderer().FONT_HEIGHT * 6);
+ this.setEnabled(false);
+ parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.white, "color"));
+ }
+
+ SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
+ @Override
+ public void drawHUD(float partialTicks) {
+ if (!skyblockStatus.isOnDungeon()) return;
+ if (!FeatureRegistry.DEBUG.isEnabled()) return;
+ DungeonContext context = skyblockStatus.getContext();
+ if (context == null) return;
+ EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
+ Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition());
+ DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt);
+ FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj;
+ int color = this.<Color>getParameter("color").getValue().getRGB();
+ if (dungeonRoom == null) {
+ if (context.getBossfightProcessor() == null) {
+ fontRenderer.drawString("Where are you?!", 0, 0, 0xFFFFFF);
+ } else {
+ fontRenderer.drawString("You're prob in bossfight", 0, 0, color);
+ fontRenderer.drawString("processor: "+context.getBossfightProcessor(), 0, 10, color);
+ fontRenderer.drawString("phase: "+context.getBossfightProcessor().getCurrentPhase(), 0, 20, color);
+ fontRenderer.drawString("nextPhase: "+ StringUtils.join(context.getBossfightProcessor().getNextPhases(), ","), 0, 30, color);
+ fontRenderer.drawString("phases: "+ StringUtils.join(context.getBossfightProcessor().getPhases(), ","), 0, 40, color);
+ }
+ } else {
+ fontRenderer.drawString("you're in the room... color/shape/rot " + dungeonRoom.getColor() + " / " + dungeonRoom.getShape() + " / "+dungeonRoom.getRoomMatcher().getRotation(), 0, 0, color);
+ fontRenderer.drawString("room uuid: " + dungeonRoom.getDungeonRoomInfo().getUuid() + (dungeonRoom.getDungeonRoomInfo().isRegistered() ? "" : " (not registered)"), 0, 10, color);
+ fontRenderer.drawString("room name: " + dungeonRoom.getDungeonRoomInfo().getName(), 0, 20, color);
+ fontRenderer.drawString("room state / max secret: " + dungeonRoom.getCurrentState() + " / "+dungeonRoom.getTotalSecrets(), 0, 30, color);
+
+ }
+ }
+
+ @Override
+ public void drawDemo(float partialTicks) {
+ FontRenderer fr = getFontRenderer();
+ fr.drawString("Line 1", 0,0, this.<Color>getParameter("color").getValue().getRGB());
+ fr.drawString("Line 2", 0,10, this.<Color>getParameter("color").getValue().getRGB());
+ fr.drawString("Line 3", 0,20, this.<Color>getParameter("color").getValue().getRGB());
+ fr.drawString("Line 4", 0,30, this.<Color>getParameter("color").getValue().getRGB());
+ fr.drawString("Line 5", 0,40, this.<Color>getParameter("color").getValue().getRGB());
+ }
+
+}