From 1a6d1a5b6035d16983f53da297db76999eb3d60a Mon Sep 17 00:00:00 2001 From: ThatGravyBoat Date: Fri, 16 Jul 2021 14:08:27 +0000 Subject: Prettified Code! --- .../skyblockhud/handlers/NpcDialogue.java | 33 ++++++++-------------- 1 file changed, 12 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/NpcDialogue.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/NpcDialogue.java index efccbbf..ab4afbc 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/NpcDialogue.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/NpcDialogue.java @@ -1,5 +1,7 @@ package com.thatgravyboat.skyblockhud.handlers; +import static com.thatgravyboat.skyblockhud.GuiTextures.dialogue; + import com.thatgravyboat.skyblockhud.SkyblockHud; import com.thatgravyboat.skyblockhud.Utils; import java.util.ArrayDeque; @@ -17,8 +19,6 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; -import static com.thatgravyboat.skyblockhud.GuiTextures.dialogue; - public class NpcDialogue { public static final Pattern NPC_DIALOGUE_REGEX = Pattern.compile("\\[NPC] (.*): (.*)"); @@ -31,12 +31,11 @@ public class NpcDialogue { private static String currentDialogue = null; @SubscribeEvent - public void onTick(TickEvent.ClientTickEvent event){ + public void onTick(TickEvent.ClientTickEvent event) { if (event.phase.equals(TickEvent.Phase.START) || SkyblockHud.config.misc.hideDialogueBox) return; - if (showDialogue) ticks++; - else ticks = 0; + if (showDialogue) ticks++; else ticks = 0; - if (showDialogue && ticks % 60 == 0){ + if (showDialogue && ticks % 60 == 0) { currentDialogue = DIALOGUE.poll(); if (currentDialogue == null) { @@ -47,10 +46,10 @@ public class NpcDialogue { } @SubscribeEvent - public void onChat(ClientChatReceivedEvent event){ - if (event.type != 2 && !SkyblockHud.config.misc.hideDialogueBox){ + public void onChat(ClientChatReceivedEvent event) { + if (event.type != 2 && !SkyblockHud.config.misc.hideDialogueBox) { String message = Utils.removeColor(event.message.getUnformattedText()); - if (message.toLowerCase(Locale.ENGLISH).startsWith("[npc]")){ + if (message.toLowerCase(Locale.ENGLISH).startsWith("[npc]")) { Matcher matcher = NPC_DIALOGUE_REGEX.matcher(message); if (matcher.find()) { showDialogue = true; @@ -73,10 +72,10 @@ public class NpcDialogue { mc.renderEngine.bindTexture(dialogue); GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); - int x = SkyblockHud.config.misc.dialoguePos.getAbsX(event.resolution,182) - 91; - int y = SkyblockHud.config.misc.dialoguePos.getAbsY(event.resolution,68); + int x = SkyblockHud.config.misc.dialoguePos.getAbsX(event.resolution, 182) - 91; + int y = SkyblockHud.config.misc.dialoguePos.getAbsY(event.resolution, 68); - Gui.drawModalRectWithCustomSizedTexture(x,y, 0, 0, 182, 68, 256, 256); + Gui.drawModalRectWithCustomSizedTexture(x, y, 0, 0, 182, 68, 256, 256); FontRenderer font = mc.fontRendererObj; @@ -85,16 +84,8 @@ public class NpcDialogue { List text = font.listFormattedStringToWidth(currentDialogue, 160); for (int i = 0; i < text.size(); i++) { - Utils.drawStringScaled(text.get(i), font, x + 40, y + 10 + font.FONT_HEIGHT + 6 + (i * font.FONT_HEIGHT + 3), false, 0xffffff, 0.75f); + Utils.drawStringScaled(text.get(i), font, x + 40, y + 10 + font.FONT_HEIGHT + 6 + (i * font.FONT_HEIGHT + 3), false, 0xffffff, 0.75f); } } } - - - - - - - - } -- cgit