aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java5
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java3
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java36
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java10
4 files changed, 46 insertions, 8 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java
index 873ecb04..cbb60556 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java
@@ -95,7 +95,12 @@ public class GuiGuiLocationConfig extends GuiScreen {
@Override
public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
+ try {
mainPanel.mouseClickMove0(mouseX,mouseY,mouseX,mouseY,clickedMouseButton,timeSinceLastClick);
+ } catch (IllegalArgumentException ignored) {
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
}
@Override
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java
index 1ae85ac5..77ad4cc8 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java
@@ -66,7 +66,7 @@ public class PanelDelegate extends MPanel {
lastX = absMouseX;
lastY = absMouseY;
- if (selectedPart != -1) throw new IllegalArgumentException("bruh, a hack to stop event progress");
+ throw new IllegalArgumentException("bruh, a hack to stop event progress");
}
@Override
@@ -151,6 +151,7 @@ public class PanelDelegate extends MPanel {
}
guiFeature.setFeatureRect(rectangle);
+ throw new IllegalArgumentException("bruh, a hack to stop event progress");
} else if (selectedPart == -1){
Rectangle rectangle = guiFeature.getFeatureRect().getBounds();
rectangle.translate(dx, dy);
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java
index 5b9bfa98..2e1451dc 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java
@@ -24,7 +24,9 @@ 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.GuiIngameMenu;
import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.MathHelper;
import net.minecraftforge.client.event.GuiScreenEvent;
@@ -46,7 +48,14 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis
SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
@Override
public void drawHUD(float partialTicks) {
- if (Minecraft.getMinecraft().currentScreen != null) return;
+ if (Minecraft.getMinecraft().currentScreen != null && !(Minecraft.getMinecraft().currentScreen instanceof GuiGuiLocationConfig
+ || Minecraft.getMinecraft().currentScreen instanceof GuiConfig
+ || Minecraft.getMinecraft().currentScreen instanceof GuiDungeonRoomEdit
+ || Minecraft.getMinecraft().currentScreen instanceof GuiDungeonAddSet
+ || Minecraft.getMinecraft().currentScreen instanceof GuiDungeonParameterEdit
+ || Minecraft.getMinecraft().currentScreen instanceof GuiDungeonValueEdit
+ || Minecraft.getMinecraft().currentScreen instanceof GuiContainer
+ || Minecraft.getMinecraft().currentScreen instanceof GuiIngameMenu)) return;
if (!skyblockStatus.isOnDungeon()) return;
if (skyblockStatus.getContext() == null || !skyblockStatus.getContext().getMapProcessor().isInitialized()) return;
DungeonContext context = skyblockStatus.getContext();
@@ -93,7 +102,9 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis
|| Minecraft.getMinecraft().currentScreen instanceof GuiDungeonRoomEdit
|| Minecraft.getMinecraft().currentScreen instanceof GuiDungeonAddSet
|| Minecraft.getMinecraft().currentScreen instanceof GuiDungeonParameterEdit
- || Minecraft.getMinecraft().currentScreen instanceof GuiDungeonValueEdit) return;
+ || Minecraft.getMinecraft().currentScreen instanceof GuiDungeonValueEdit
+ || Minecraft.getMinecraft().currentScreen instanceof GuiContainer
+ || Minecraft.getMinecraft().currentScreen instanceof GuiIngameMenu) return;
if (!skyblockStatus.isOnDungeon()) return;
if (skyblockStatus.getContext() == null || !skyblockStatus.getContext().getMapProcessor().isInitialized()) return;
@@ -149,6 +160,8 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis
(((DungeonMechanic) obj).getRepresentingPoint() != null ?
String.format("%.1f", MathHelper.sqrt_double(((DungeonMechanic) obj).getRepresentingPoint().getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))) : "")
+"m)",fr.getStringWidth(name) + 3, i * fr.FONT_HEIGHT, 0xFFAAAAAA);
+ } else if ("$SPECIAL-CANCEL".equals(obj)) {
+ fr.drawString("Cancel Current", 3, i * fr.FONT_HEIGHT, 0xFF00FFFF);
} else {
Gui.drawRect(-1, i * fr.FONT_HEIGHT, feature.width - 3, i * fr.FONT_HEIGHT + fr.FONT_HEIGHT - 1, 0xFF444444);
fr.drawString((String)obj, 3, i * fr.FONT_HEIGHT, 0xFFEEEEEE);
@@ -201,6 +214,9 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis
if (dungeonRoom == null) return;
if (!(dungeonRoom.getRoomProcessor() instanceof GeneralRoomProcessor)) return;
+ sortedMechanics.add("$SPECIAL-CANCEL");
+ sortedMechanicsName.add("");
+
boolean found = false;
for (Map.Entry<String, DungeonMechanic> value : ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).getDungeonRoom().getDungeonRoomInfo().getMechanics().entrySet()) {
if (value.getValue() instanceof DungeonFairySoul) {
@@ -283,7 +299,9 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis
|| Minecraft.getMinecraft().currentScreen instanceof GuiDungeonRoomEdit
|| Minecraft.getMinecraft().currentScreen instanceof GuiDungeonAddSet
|| Minecraft.getMinecraft().currentScreen instanceof GuiDungeonParameterEdit
- || Minecraft.getMinecraft().currentScreen instanceof GuiDungeonValueEdit) return;
+ || Minecraft.getMinecraft().currentScreen instanceof GuiDungeonValueEdit
+ || Minecraft.getMinecraft().currentScreen instanceof GuiContainer
+ || Minecraft.getMinecraft().currentScreen instanceof GuiIngameMenu) return;
if (!skyblockStatus.isOnDungeon()) return;
@@ -309,10 +327,13 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis
mouseInputEvent.setCanceled(true);
int wheel = Mouse.getDWheel();
- if (wheel > 0) dy += fr.FONT_HEIGHT;
- else if (wheel < 0) dy -= fr.FONT_HEIGHT;
+ if (wheel > 0) dy -= fr.FONT_HEIGHT;
+ else if (wheel < 0) dy += fr.FONT_HEIGHT;
+
+ if (-dy + sortedMechanics.size() * fr.FONT_HEIGHT < feature.height - fr.FONT_HEIGHT - 6) dy = -(feature.height - fr.FONT_HEIGHT - 6) + sortedMechanics.size() * fr.FONT_HEIGHT;
if (dy < 0) dy = 0;
+
if (Mouse.getEventButton() != -1) {
int yDiff = mouseY + dy - feature.y - fr.FONT_HEIGHT - 6;
selected = yDiff / fr.FONT_HEIGHT;
@@ -323,6 +344,11 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis
possibleStates.clear();
} else if (sortedMechanics.get(selected) instanceof DungeonMechanic){
possibleStates = Lists.newArrayList(((DungeonMechanic) sortedMechanics.get(selected)).getPossibleStates(dungeonRoom));
+ } else if ("$SPECIAL-CANCEL".equals(sortedMechanics.get(selected))) {
+ ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).cancel();
+ possibleStates.clear();
+ selected = -1;
+ selectedState = -1;
} else {
possibleStates.clear();
selected = -1;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java
index 508cc93d..2601b67f 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java
@@ -46,12 +46,15 @@ public class GeneralRoomProcessor implements RoomProcessor {
private DungeonRoom dungeonRoom;
public GeneralRoomProcessor(DungeonRoom dungeonRoom) {
this.dungeonRoom = dungeonRoom;
- if (FeatureRegistry.SECRET_AUTO_START.isEnabled())
- searchForNextTarget();
}
+ private boolean ticked = false;
@Override
public void tick() {
+ if (!ticked && FeatureRegistry.SECRET_AUTO_START.isEnabled())
+ searchForNextTarget();
+
+ ticked = true;
if (path != null) {
path.onTick();
if (FeatureRegistry.SECRET_AUTO_BROWSE_NEXT.isEnabled() && path.getCurrentAction() instanceof ActionComplete) {
@@ -184,6 +187,9 @@ public class GeneralRoomProcessor implements RoomProcessor {
public void pathfind(String mechanic, String state) {
path = new ActionRoute(getDungeonRoom(), mechanic, state);
}
+ public void cancel() {
+ path = null;
+ }
@Override
public void onPostGuiRender(GuiScreenEvent.DrawScreenEvent.Post event) {