aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThatGravyBoat <ThatGravyBoat@users.noreply.github.com>2021-07-16 14:08:27 +0000
committerGitHub Action <actions@github.com>2021-07-16 14:08:27 +0000
commit1a6d1a5b6035d16983f53da297db76999eb3d60a (patch)
tree5cc9e8d37450a2835d668ff22ce63cebc3e90b50 /src
parent13df8fe35749850d7bd560d51f67596094378d16 (diff)
downloadSkyblockHud-Death-Defied-1a6d1a5b6035d16983f53da297db76999eb3d60a.tar.gz
SkyblockHud-Death-Defied-1a6d1a5b6035d16983f53da297db76999eb3d60a.tar.bz2
SkyblockHud-Death-Defied-1a6d1a5b6035d16983f53da297db76999eb3d60a.zip
Prettified Code!
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/NpcDialogue.java33
1 files changed, 12 insertions, 21 deletions
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<String> 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);
}
}
}
-
-
-
-
-
-
-
-
}