diff options
Diffstat (limited to 'mod/src')
21 files changed, 90 insertions, 236 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/chat/ChatProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/chat/ChatProcessor.java index 6a2295d9..a5eb360f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/chat/ChatProcessor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/chat/ChatProcessor.java @@ -80,7 +80,7 @@ public class ChatProcessor { } } - } catch (Throwable e) { + } catch (Exception e) { e.printStackTrace(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java index 28a702d3..30e96d2d 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java @@ -327,7 +327,7 @@ public class CommandDgDebug extends CommandBase { DungeonRoom dungeonRoom = context.getScaffoldParser().getRoomMap().get(roomPt); GeneralRoomProcessor grp = (GeneralRoomProcessor) dungeonRoom.getRoomProcessor(); grp.pathfind("COMMAND", args[1], args[2], FeatureRegistry.SECRET_LINE_PROPERTIES_AUTOPATHFIND.getRouteProperties()); - } catch (Throwable t) { + } catch (Exception t) { t.printStackTrace(); } } @@ -430,7 +430,7 @@ public class CommandDgDebug extends CommandBase { DungeonsGuide.getDungeonsGuide().getDungeonFacade().setContext(null); MapUtils.clearMap(); - } catch (Throwable t) { + } catch (Exception t) { t.printStackTrace(); } } @@ -687,7 +687,7 @@ public class CommandDgDebug extends CommandBase { for (String s : dungeonRoom.getMechanics().keySet()) { grp.pathfind("COMMAND-" + s, s, "navigate", FeatureRegistry.SECRET_LINE_PROPERTIES_AUTOPATHFIND.getRouteProperties()); } - } catch (Throwable t) { + } catch (Exception t) { t.printStackTrace(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java index ff3e8038..b120499e 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java @@ -215,7 +215,7 @@ public class CommandDungeonsGuide extends CommandBase { Minecraft.getMinecraft().displayGuiScreen(target); target = null; } - } catch (Throwable t) { + } catch (Exception t) { t.printStackTrace(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CosmeticsManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CosmeticsManager.java index 82c4b6cb..2d73ff92 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CosmeticsManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CosmeticsManager.java @@ -252,7 +252,7 @@ public class CosmeticsManager { } } contextThreadLocal.set(total); - } catch (Throwable t) { + } catch (Exception t) { System.out.println(clientChatReceivedEvent.message); t.printStackTrace(); } @@ -367,7 +367,7 @@ public class CosmeticsManager { startingSearch, 0); } clientChatReceivedEvent.message = SurgicalReplacer.combine(chatComponents); - } catch (Throwable t) { + } catch (Exception t) { System.out.println(clientChatReceivedEvent.message); t.printStackTrace(); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/DiscordIntegrationManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/DiscordIntegrationManager.java index 44bdf4c0..86cf868c 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/DiscordIntegrationManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/discord/DiscordIntegrationManager.java @@ -126,7 +126,7 @@ public class DiscordIntegrationManager implements IPCListener { ipcClient.setListener(this); System.out.println("Connecting"); } catch (NoDiscordClientException ignored) { - } catch (Throwable t) { + } catch (Exception t) { t.printStackTrace(); } } @@ -184,7 +184,7 @@ public class DiscordIntegrationManager implements IPCListener { JDiscordRelation relation = JDiscordRelation.parse(obj); relationMap.put(relation.getDiscordUser().getIdLong(), relation); } - } catch (Throwable e) {e.printStackTrace();} + } catch (Exception e) {e.printStackTrace();} } private void sendRichPresence(RichPresence presence) { @@ -240,8 +240,8 @@ public class DiscordIntegrationManager implements IPCListener { else { updatePresence(); } - } catch (Throwable t) { - t.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); // let thread just die if catastrophic failure occurs. } try { Thread.sleep(32); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/ActionDisplayPane.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/ActionDisplayPane.java index b6478138..64c9b8a2 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/ActionDisplayPane.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/ActionDisplayPane.java @@ -62,7 +62,7 @@ public class ActionDisplayPane extends MPanel { displayPane = new ActionTreeDisplayPane(dungeonRoom, tree); displayPane.setBounds(new Rectangle(0,25,getBounds().width,getBounds().height-25)); add(displayPane); - } catch (Throwable t) { + } catch (Exception t) { t.printStackTrace(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/GeneralEditPane.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/GeneralEditPane.java index 9d117abd..019d42e3 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/GeneralEditPane.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/GeneralEditPane.java @@ -178,7 +178,7 @@ public class GeneralEditPane extends MPanel { dataoutputstream.close(); } ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §fSaved to "+f.getName())); - } catch (Throwable e) { + } catch (Exception e) { e.printStackTrace(); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/RoommatchingPane.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/RoommatchingPane.java index 35c1728d..0b7f1df6 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/RoommatchingPane.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomedit/panes/RoommatchingPane.java @@ -62,7 +62,7 @@ public class RoommatchingPane extends MPanel { displayPane = new RoomMatchDisplayPane(dungeonRoom, uid, rotation); displayPane.setBounds(new Rectangle(0,25,getBounds().width,getBounds().height-25)); add(displayPane); - } catch (Throwable t) { + } catch (Exception t) { t.printStackTrace(); } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java index 2af9cd76..a96b23e6 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/roomprocessor/bombdefuse/RoomProcessorBombDefuseSolver.java @@ -205,7 +205,7 @@ public class RoomProcessorBombDefuseSolver extends GeneralRoomProcessor { if (ch.getRight() != null && ch.getRight().getProcessor() != null) ch.getRight().getProcessor().onDataReceive(compound); } - } catch (Throwable t) { + } catch (Exception t) { t.printStackTrace(); ChatTransmitter.sendDebugChat(new ChatComponentText("Failed to analyze Bomb Defuse Chat")); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/annotations/EventHandlerRegistry.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/annotations/EventHandlerRegistry.java index 7fde5290..46fff031 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/annotations/EventHandlerRegistry.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/annotations/EventHandlerRegistry.java @@ -126,8 +126,10 @@ public class EventHandlerRegistry { if (target.condition == null || (target.condition.get() == Boolean.TRUE)) { // it is safe to use this here. target.invokeSite.invoke(event); } - } catch (Throwable e) { + } catch (Exception e) { logger.error("An error occurred while handling event: \nFeature = " + target.getFeature().getClass().getName(), e); + } catch (Throwable t) { + throw new RuntimeException("An catastrophic error occured while handling event: ", t); } profiler.endSection(); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketInjector.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketInjector.java index ca295afa..2362d5d6 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketInjector.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/PacketInjector.java @@ -63,7 +63,7 @@ public class PacketInjector extends ChannelDuplexHandler { MinecraftForge.EVENT_BUS.post(receivedEvent); packet = receivedEvent.packet; } - } catch (Throwable t) { + } catch (Exception t) { t.printStackTrace(); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/inviteViewer/PartyInviteViewer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/inviteViewer/PartyInviteViewer.java index 2073ca3d..1479f8c0 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/inviteViewer/PartyInviteViewer.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/inviteViewer/PartyInviteViewer.java @@ -56,9 +56,8 @@ public class PartyInviteViewer extends AbstractGuiFeature { @DGEventHandler(triggerOutOfSkyblock = true) public void onTick(DGTickEvent tickEvent) { - try { + if (partyInviteViewer != null) partyInviteViewer.tick(); - } catch (Throwable e) {e.printStackTrace();} } @DGEventHandler(triggerOutOfSkyblock = true) diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/onlinealarm/PlayingDGAlarm.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/onlinealarm/PlayingDGAlarm.java index 66c530d3..c05440bc 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/onlinealarm/PlayingDGAlarm.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/discord/onlinealarm/PlayingDGAlarm.java @@ -47,9 +47,8 @@ public class PlayingDGAlarm extends AbstractGuiFeature { @DGEventHandler(triggerOutOfSkyblock = true) public void onTick(DGTickEvent event) { - try { + if (onlinePeopleViewer != null) onlinePeopleViewer.tick(); - } catch (Throwable e) {e.printStackTrace();} } @DGEventHandler(triggerOutOfSkyblock = true) public void onDiscordUserUpdate(DiscordUserUpdateEvent event) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeaturePlayerESP.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeaturePlayerESP.java index 404414da..5b45adb9 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeaturePlayerESP.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/dungeon/FeaturePlayerESP.java @@ -75,7 +75,7 @@ public class FeaturePlayerESP extends SimpleFeature { float f = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * renderPlayerEvent.partialRenderTick; try { renderPlayerEvent.renderer.doRender((AbstractClientPlayer) renderPlayerEvent.entityPlayer, renderPlayerEvent.x, renderPlayerEvent.y, renderPlayerEvent.z, f, renderPlayerEvent.partialRenderTick); - } catch (Throwable t) {} + } catch (Exception t) {} GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_KEEP); GL11.glStencilFunc(GL11.GL_NOTEQUAL, 1, 0xff); @@ -88,7 +88,7 @@ public class FeaturePlayerESP extends SimpleFeature { renderPlayerEvent.renderer.setRenderOutlines(true); try { renderPlayerEvent.renderer.doRender((AbstractClientPlayer) renderPlayerEvent.entityPlayer, 0,-0.9,0, f, renderPlayerEvent.partialRenderTick); - } catch (Throwable t) {} + } catch (Exception t) {} renderPlayerEvent.renderer.setRenderOutlines(false); GL11.glDepthFunc(GL11.GL_LEQUAL); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeatureGoodParties.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeatureGoodParties.java index 53279180..c929911a 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeatureGoodParties.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/FeatureGoodParties.java @@ -112,7 +112,7 @@ public class FeatureGoodParties extends SimpleFeature { } - } catch (Throwable e) { + } catch (Exception e) { e.printStackTrace(); } GlStateManager.colorMask(true, true, true, true); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FeatureViewPlayerStatsOnJoin.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FeatureViewPlayerStatsOnJoin.java index 230224f9..5f87c71e 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FeatureViewPlayerStatsOnJoin.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FeatureViewPlayerStatsOnJoin.java @@ -172,7 +172,7 @@ public class FeatureViewPlayerStatsOnJoin extends SimpleFeature { int x = guiChatBox.getX(scaledResolution); int y = guiChatBox.getY(scaledResolution); ichatcomponent = guiChatBox.chatArray.getHoveredComponent(guiChatBox.getSelectedTab().getChatLines(), Mouse.getX(), Mouse.getY(), x, y); - } catch (Throwable t) { + } catch (Exception t) { } } if (ichatcomponent == null) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/MGui.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/MGui.java index fbceb1e5..1cf20cca 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/MGui.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/MGui.java @@ -81,8 +81,8 @@ public class MGui extends GuiScreen { try { mainPanel.keyPressed0(typedChar, keyCode); super.keyTyped(typedChar, keyCode); - } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + } catch (Exception e) { + e.printStackTrace(); } } @@ -90,8 +90,8 @@ public class MGui extends GuiScreen { public void keyHeld(int keyCode, char typedChar) throws IOException { try { mainPanel.keyHeld0(typedChar, keyCode); - } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + } catch (Exception e) { + e.printStackTrace(); } } @@ -99,8 +99,8 @@ public class MGui extends GuiScreen { public void keyReleased(int keyCode, char typedChar) throws IOException { try { mainPanel.keyReleased0(typedChar, keyCode); - } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + } catch (Exception e) { + e.printStackTrace(); } } @@ -111,8 +111,8 @@ public class MGui extends GuiScreen { super.mouseClicked(mouseX, mouseY, mouseButton); mainPanel.mouseClicked0(mouseX, mouseY , mouseX, mouseY, mouseButton); - } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + } catch (Exception e) { + e.printStackTrace(); } } @@ -136,8 +136,8 @@ public class MGui extends GuiScreen { try { mainPanel.mouseReleased0(mouseX, mouseY , mouseX, mouseY, state); - } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + } catch (Exception e) { + e.printStackTrace(); } } @@ -147,8 +147,8 @@ public class MGui extends GuiScreen { try { mainPanel.mouseClickMove0(mouseX, mouseY , mouseX, mouseY, clickedMouseButton, timeSinceLastClick); - } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + } catch (Exception e) { + e.printStackTrace(); } } @@ -157,8 +157,8 @@ public class MGui extends GuiScreen { try { mainPanel.mouseMoved0(mouseX, mouseY , mouseX, mouseY); - } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + } catch (Exception e) { + e.printStackTrace(); } } @@ -175,7 +175,6 @@ public class MGui extends GuiScreen { @Override public void handleMouseInput() throws IOException { if (!isOpen) return; - try { int i = Mouse.getEventX(); int j = this.mc.displayHeight - Mouse.getEventY(); int k = Mouse.getEventButton(); @@ -200,14 +199,13 @@ public class MGui extends GuiScreen { this.mouseClickMove(i, j, this.eventButton, l); } if (lastX != i || lastY != j) { - try { EnumCursor prevCursor = mainPanel.getCurrentCursor(); mainPanel.setCursor(EnumCursor.DEFAULT); this.mouseMove(i, j); EnumCursor newCursor = mainPanel.getCurrentCursor(); + try { if (prevCursor != newCursor) Mouse.setNativeCursor(GLCursors.getCursor(newCursor)); } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) e.printStackTrace(); } } @@ -215,13 +213,14 @@ public class MGui extends GuiScreen { int wheel = Mouse.getEventDWheel(); if (wheel != 0) { - mainPanel.mouseScrolled0(i, j, i, j, wheel); + try { + mainPanel.mouseScrolled0(i, j, i, j, wheel); + } catch (Exception e) { + e.printStackTrace(); + } } lastX = i; lastY = j; - } catch (Throwable e) { - e.printStackTrace(); - } } public void handleKeyboardInput() throws IOException { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MKeyEditButton.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MKeyEditButton.java deleted file mode 100755 index 703c99a3..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/gui/elements/MKeyEditButton.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.mod.gui.elements; - -import kr.syeyoung.dungeonsguide.mod.gui.MPanel; -import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.mod.utils.cursor.EnumCursor; -import lombok.Getter; -import lombok.Setter; -import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.PositionedSoundRecord; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.settings.GameSettings; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -import java.awt.*; - -@Getter -@Setter -public class MKeyEditButton extends MPanel { - private int key; - private Runnable onKeyEdit; - - private Color foreground = Color.white; - private int background = RenderUtils.blendAlpha(0xFF141414, 0.08f); - private int hover = RenderUtils.blendAlpha(0xFF141414, 0.14f); - private int clicked = RenderUtils.blendAlpha(0xFF141414, 0.16f); - private int border = 0x0; - private int disabled =0xFF141414; - private int roundness = 0; - - private boolean enabled = true; - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle clip) { - Dimension bounds = getSize(); - - int bg = background; - if (!enabled) { - bg = disabled; - } else if (getTooltipsOpen() > 0) { - } else if (selected) { - bg = clicked; - } else if (new Rectangle(new Point(0,0),bounds).contains(relMousex0, relMousey0)) { - bg = hover; - } - if (roundness == 0) { - if (((border >> 24) & 0xFF) == 0) - Gui.drawRect(0, 0, getBounds().width, getBounds().height, bg); - else { - Gui.drawRect(0, 0, getBounds().width, getBounds().height, border); - Gui.drawRect(1, 1, getBounds().width - 1, getBounds().height - 1, bg); - } - } else { - if (((border >> 24) & 0xFF) == 0) - RenderUtils.drawRoundedRectangle(0, 0, getBounds().width, getBounds().height, roundness, Math.PI/8, bg); - else { - RenderUtils.drawRoundedRectangle(0, 0, getBounds().width, getBounds().height, roundness, Math.PI/8, border); - RenderUtils.drawRoundedRectangle(1, 1, getBounds().width-2, getBounds().height-2, roundness, Math.PI/8, bg); - } - GlStateManager.enableTexture2D(); - } - - String str = GameSettings.getKeyDisplayString(key); - if (selected) str = "> "+str+" <"; - FontRenderer renderer = Minecraft.getMinecraft().fontRendererObj; - int width = renderer.getStringWidth(str); - int x = (getBounds().width - width) / 2; - int y = (getBounds().height - renderer.FONT_HEIGHT) / 2 + 1; - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - renderer.drawString(str, x,y, foreground.getRGB()); - } - - private boolean selected; - @Override - public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - if (lastAbsClip.contains(absMouseX, absMouseY) && getTooltipsOpen() == 0) { - if (selected) { - key = -100 + mouseButton; - selected = false; - if (onKeyEdit != null) - onKeyEdit.run(); - } else { - selected = true; - } - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); - } else { - selected = false; - } - } - - @Override - public void mouseReleased(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int state) { - - } - - - @Override - public void mouseMoved(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0) { - if (lastAbsClip.contains(absMouseX, absMouseY) && enabled) - setCursor(EnumCursor.POINTING_HAND); - } - - @Override - public void keyPressed(char typedChar, int keyCode) { - if (!selected) return; - if (keyCode == 1) { - key = 0; - } else if (keyCode != 0) { - key = keyCode; - } else if (typedChar > 0) { - key = typedChar + 256; - } - selected = false; - if (onKeyEdit != null) - onKeyEdit.run(); - throw new RuntimeException("hack to stop event propagation"); - } - - @Override - public Dimension getPreferredSize() { - return new Dimension(80, 15); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/GuiScreenAdapter.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/GuiScreenAdapter.java index 34d755cb..b1c26b37 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/GuiScreenAdapter.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/GuiScreenAdapter.java @@ -151,8 +151,8 @@ public class GuiScreenAdapter extends GuiScreen { try { view.keyPressed0(typedChar, keyCode); super.keyTyped(typedChar, keyCode); - } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + } catch (Exception e) { + e.printStackTrace(); } } @@ -160,8 +160,8 @@ public class GuiScreenAdapter extends GuiScreen { public void keyHeld(int keyCode, char typedChar) throws IOException { try { view.keyHeld0(typedChar, keyCode); - } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + } catch (Exception e) { + e.printStackTrace(); } } @@ -169,8 +169,8 @@ public class GuiScreenAdapter extends GuiScreen { public void keyReleased(int keyCode, char typedChar) throws IOException { try { view.keyReleased0(typedChar, keyCode); - } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + } catch (Exception e) { + e.printStackTrace(); } } @@ -181,8 +181,8 @@ public class GuiScreenAdapter extends GuiScreen { super.mouseClicked(mouseX, mouseY, mouseButton); view.mouseClicked0(mouseX, mouseY , mouseX, mouseY, mouseButton); - } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + } catch (Exception e) { + e.printStackTrace(); } } @@ -206,8 +206,8 @@ public class GuiScreenAdapter extends GuiScreen { try { view.mouseReleased0(mouseX, mouseY , mouseX, mouseY, state); - } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + } catch (Exception e) { + e.printStackTrace(); } } @@ -217,8 +217,8 @@ public class GuiScreenAdapter extends GuiScreen { try { view.mouseClickMove0(mouseX, mouseY , mouseX, mouseY, clickedMouseButton, timeSinceLastClick); - } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + } catch (Exception e) { + e.printStackTrace(); } } @@ -227,8 +227,8 @@ public class GuiScreenAdapter extends GuiScreen { try { view.mouseMoved0(mouseX, mouseY , mouseX, mouseY, true); - } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + } catch (Exception e) { + e.printStackTrace(); } } @@ -245,7 +245,6 @@ public class GuiScreenAdapter extends GuiScreen { @Override public void handleMouseInput() throws IOException { if (!isOpen) return; - try { int i = Mouse.getEventX(); int j = this.mc.displayHeight - Mouse.getEventY(); int k = Mouse.getEventButton(); @@ -270,14 +269,14 @@ public class GuiScreenAdapter extends GuiScreen { this.mouseClickMove(i, j, this.eventButton, l); } if (lastX != i || lastY != j) { - try { EnumCursor prevCursor = view.getCurrentCursor(); view.setCursor(EnumCursor.DEFAULT); this.mouseMove(i, j); EnumCursor newCursor = view.getCurrentCursor(); + try { if (prevCursor != newCursor) Mouse.setNativeCursor(GLCursors.getCursor(newCursor)); } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + e.printStackTrace(); } } @@ -285,13 +284,14 @@ public class GuiScreenAdapter extends GuiScreen { int wheel = Mouse.getEventDWheel(); if (wheel != 0) { - view.mouseScrolled0(i, j, i, j, wheel); + try { + view.mouseScrolled0(i, j, i, j, wheel); + } catch (Exception e) { + e.printStackTrace(); + } } lastX = i; lastY = j; - } catch (Throwable e) { - e.printStackTrace(); - } } public void handleKeyboardInput() throws IOException { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/PropByPropParsedWidgetConverter.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/PropByPropParsedWidgetConverter.java index d0a907a2..ff42cd38 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/PropByPropParsedWidgetConverter.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/xml/PropByPropParsedWidgetConverter.java @@ -81,6 +81,8 @@ public abstract class PropByPropParsedWidgetConverter<W extends Widget, R extend .getTarget() .invoke(rootWidget); exported.setValue(obj); + } catch (Error error) { + throw error; } catch (Throwable e) { throw new RuntimeException(e); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManager.java index 7fb6e0da..b3453385 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManager.java @@ -156,8 +156,8 @@ public class OverlayManager { private void keyTyped(char typedChar, int keyCode) throws IOException { try { view.keyPressed0(typedChar, keyCode); - } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + } catch (Exception e) { + e.printStackTrace(); } } @@ -165,8 +165,8 @@ public class OverlayManager { private void keyHeld(int keyCode, char typedChar) throws IOException { try { view.keyHeld0(typedChar, keyCode); - } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + } catch (Exception e) { + e.printStackTrace(); } } @@ -174,8 +174,8 @@ public class OverlayManager { private void keyReleased(int keyCode, char typedChar) throws IOException { try { view.keyReleased0(typedChar, keyCode); - } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + } catch (Exception e) { + e.printStackTrace(); } } @@ -184,8 +184,8 @@ public class OverlayManager { try { return view.mouseClicked0(mouseX, mouseY , mouseX, mouseY, mouseButton); - } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + } catch (Exception e) { + e.printStackTrace(); } return false; @@ -195,8 +195,8 @@ public class OverlayManager { try { view.mouseReleased0(mouseX, mouseY , mouseX, mouseY, state); - } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + } catch (Exception e) { + e.printStackTrace(); } } @@ -205,8 +205,8 @@ public class OverlayManager { try { view.mouseClickMove0(mouseX, mouseY , mouseX, mouseY, clickedMouseButton, timeSinceLastClick); - } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + } catch (Exception e) { + e.printStackTrace(); } } @@ -215,8 +215,8 @@ public class OverlayManager { try { view.mouseMoved0(mouseX, mouseY , mouseX, mouseY, true); - } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + } catch (Exception e) { + e.printStackTrace(); } } @@ -232,7 +232,6 @@ public class OverlayManager { @SubscribeEvent(priority = EventPriority.HIGHEST) public void handleMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent) throws IOException { - try { int i = Mouse.getEventX(); int j = this.mc.displayHeight - Mouse.getEventY(); int k = Mouse.getEventButton(); @@ -258,14 +257,14 @@ public class OverlayManager { this.mouseClickMove(i, j, this.eventButton, l); } if (lastX != i || lastY != j) { - try { EnumCursor prevCursor = view.getCurrentCursor(); view.setCursor(EnumCursor.DEFAULT); this.mouseMove(i, j); EnumCursor newCursor = view.getCurrentCursor(); + try { if (prevCursor != newCursor) Mouse.setNativeCursor(GLCursors.getCursor(newCursor)); } catch (Throwable e) { - if (e.getMessage() == null || !e.getMessage().contains("hack to stop")) + e.printStackTrace(); } } @@ -273,14 +272,15 @@ public class OverlayManager { int wheel = Mouse.getEventDWheel(); if (wheel != 0) { - boolean cancel = view.mouseScrolled0(i, j, i, j, wheel); - if (cancel) mouseInputEvent.setCanceled(true); + try { + boolean cancel = view.mouseScrolled0(i, j, i, j, wheel); + if (cancel) mouseInputEvent.setCanceled(true); + } catch (Exception e) { + e.printStackTrace(); + } } lastX = i; lastY = j; - } catch (Throwable e) { - e.printStackTrace(); - } } @SubscribeEvent(priority = EventPriority.HIGHEST) |