aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAaron <51387595+AzureAaron@users.noreply.github.com>2023-06-24 01:04:34 -0400
committerAaron <51387595+AzureAaron@users.noreply.github.com>2023-06-24 01:04:34 -0400
commit0cd67350de6b4b127322ed703a0bab3a18ac2f04 (patch)
treeb06b80bdbe969881fdd90a05443caf0a9446529a /src
parent0a3c3d61b749172464665634b392b1f68a32288e (diff)
downloadSkyblocker-0cd67350de6b4b127322ed703a0bab3a18ac2f04.tar.gz
Skyblocker-0cd67350de6b4b127322ed703a0bab3a18ac2f04.tar.bz2
Skyblocker-0cd67350de6b4b127322ed703a0bab3a18ac2f04.zip
Reformat files
Diffstat (limited to 'src')
-rw-r--r--src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/AdvertisementWidget.java15
-rw-r--r--src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/GoodToKnowWidget.java55
-rw-r--r--src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftProgressWidget.java79
3 files changed, 84 insertions, 65 deletions
diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/AdvertisementWidget.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/AdvertisementWidget.java
index 61c79c26..287b25b1 100644
--- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/AdvertisementWidget.java
+++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/AdvertisementWidget.java
@@ -8,18 +8,19 @@ import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
public class AdvertisementWidget extends Widget {
-
- private static final MutableText TITLE = Text.literal("Advertisement").formatted(Formatting.DARK_AQUA, Formatting.BOLD);
+
+ private static final MutableText TITLE = Text.literal("Advertisement").formatted(Formatting.DARK_AQUA,
+ Formatting.BOLD);
public AdvertisementWidget() {
super(TITLE, Formatting.DARK_AQUA.getColorValue());
-
-
- for(int i = 73; i < 80; i++) {
+
+ for (int i = 73; i < 80; i++) {
Text text = PlayerListMgr.textAt(i);
- if(text != null) this.addComponent(new PlainTextComponent(text));
+ if (text != null)
+ this.addComponent(new PlainTextComponent(text));
}
-
+
this.pack();
}
diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/GoodToKnowWidget.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/GoodToKnowWidget.java
index ca95f811..667bc154 100644
--- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/GoodToKnowWidget.java
+++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/GoodToKnowWidget.java
@@ -9,38 +9,47 @@ import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
public class GoodToKnowWidget extends Widget {
-
+
private static final MutableText TITLE = Text.literal("Good To Know").formatted(Formatting.BLUE, Formatting.BOLD);
-
+
public GoodToKnowWidget() {
super(TITLE, Formatting.BLUE.getColorValue());
-
- //After you progress further the tab adds more info so we need to be careful of that
- //In beginning it only shows montezuma, then timecharms and enigma souls are added
- Text pos49 = PlayerListMgr.textAt(49); //Can be times visited rift
- Text pos51 = PlayerListMgr.textAt(51); //Can be lifetime motes or visited rift
- Text pos53 = PlayerListMgr.textAt(53); //Can be lifetime motes
-
+
+ // After you progress further the tab adds more info so we need to be careful of
+ // that
+ // In beginning it only shows montezuma, then timecharms and enigma souls are
+ // added
+ Text pos49 = PlayerListMgr.textAt(49); // Can be times visited rift
+ Text pos51 = PlayerListMgr.textAt(51); // Can be lifetime motes or visited rift
+ Text pos53 = PlayerListMgr.textAt(53); // Can be lifetime motes
+
int visitedRiftPos = 0;
int lifetimeMotesPos = 0;
-
- //Check each position to see what is or isn't there so we don't try adding invalid components
- if(pos49.getString().contains("times")) visitedRiftPos = 49;
- if(pos51.getString().contains("Motes")) lifetimeMotesPos = 51;
- if(pos51.getString().contains("times")) visitedRiftPos = 51;
- if(pos53.getString().contains("Motes")) lifetimeMotesPos = 53;
-
+
+ // Check each position to see what is or isn't there so we don't try adding
+ // invalid components
+ if (pos49.getString().contains("times"))
+ visitedRiftPos = 49;
+ if (pos51.getString().contains("Motes"))
+ lifetimeMotesPos = 51;
+ if (pos51.getString().contains("times"))
+ visitedRiftPos = 51;
+ if (pos53.getString().contains("Motes"))
+ lifetimeMotesPos = 53;
+
Text timesVisitedRift = (visitedRiftPos == 51) ? pos51 : (visitedRiftPos == 49) ? pos49 : null;
Text lifetimeMotesEarned = (lifetimeMotesPos == 53) ? pos53 : (lifetimeMotesPos == 51) ? pos51 : null;
-
- if(visitedRiftPos != 0) {
- this.addComponent(new IcoTextComponent(Ico.EXPERIENCE_BOTTLE, Text.literal("Visited Rift: ").append(timesVisitedRift)));
+
+ if (visitedRiftPos != 0) {
+ this.addComponent(new IcoTextComponent(Ico.EXPERIENCE_BOTTLE,
+ Text.literal("Visited Rift: ").append(timesVisitedRift)));
}
-
- if(lifetimeMotesPos != 0) {
- this.addComponent(new IcoTextComponent(Ico.PINK_DYE, Text.literal("Lifetime Earned: ").append(lifetimeMotesEarned)));
+
+ if (lifetimeMotesPos != 0) {
+ this.addComponent(
+ new IcoTextComponent(Ico.PINK_DYE, Text.literal("Lifetime Earned: ").append(lifetimeMotesEarned)));
}
-
+
this.pack();
}
}
diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftProgressWidget.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftProgressWidget.java
index 615d3cb0..9ce12e76 100644
--- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftProgressWidget.java
+++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/tabhud/widget/rift/RiftProgressWidget.java
@@ -13,75 +13,84 @@ import net.minecraft.util.Formatting;
import net.minecraft.util.math.MathHelper;
public class RiftProgressWidget extends Widget {
-
+
private static final MutableText TITLE = Text.literal("Rift Progress").formatted(Formatting.BLUE, Formatting.BOLD);
-
+
private static final Pattern TIMECHARMS_PATTERN = Pattern.compile("Timecharms: (?<current>[0-9]+)\\/(?<total>[0-9]+)");
private static final Pattern ENIGMA_SOULS_PATTERN = Pattern.compile("Enigma Souls: (?<current>[0-9]+)\\/(?<total>[0-9]+)");
private static final Pattern MONTEZUMA_PATTERN = Pattern.compile("Montezuma: (?<current>[0-9]+)\\/(?<total>[0-9]+)");
public RiftProgressWidget() {
super(TITLE, Formatting.BLUE.getColorValue());
-
- //After you progress further the tab adds more info so we need to be careful of that
- //In beginning it only shows montezuma, then timecharms and enigma souls are added
- String pos45 = PlayerListMgr.strAt(45); //Can be Montezuma or Timecharms
- String pos46 = PlayerListMgr.strAt(46); //Can be Enigma Souls or Empty
- String pos47 = PlayerListMgr.strAt(47); //Can be Montezuma or "Good to know" heading
-
+
+ // After you progress further the tab adds more info so we need to be careful of
+ // that
+ // In beginning it only shows montezuma, then timecharms and enigma souls are
+ // added
+ String pos45 = PlayerListMgr.strAt(45); // Can be Montezuma or Timecharms
+ String pos46 = PlayerListMgr.strAt(46); // Can be Enigma Souls or Empty
+ String pos47 = PlayerListMgr.strAt(47); // Can be Montezuma or "Good to know" heading
+
boolean hasTimecharms = false;
boolean hasEnigmaSouls = false;
int montezumaPos = 0;
-
- //Check each position to see what is or isn't there so we don't try adding invalid components
- if(pos45.contains("Timecharms")) hasTimecharms = true;
- if(pos46.contains("Enigma Souls")) hasEnigmaSouls = true;
-
- //Small ternary to account for positions, defaults to -1 if it for some reason does not exist (which shouldn't be the case!)
+
+ // Check each position to see what is or isn't there so we don't try adding
+ // invalid components
+ if (pos45.contains("Timecharms"))
+ hasTimecharms = true;
+ if (pos46.contains("Enigma Souls"))
+ hasEnigmaSouls = true;
+
+ // Small ternary to account for positions, defaults to -1 if it for some reason
+ // does not exist (which shouldn't be the case!)
montezumaPos = (pos47.contains("Montezuma")) ? 47 : (pos45.contains("Montezuma")) ? 45 : -1;
-
- if(hasTimecharms) {
+
+ if (hasTimecharms) {
Matcher m = PlayerListMgr.regexAt(45, TIMECHARMS_PATTERN);
-
+
int current = Integer.parseInt(m.group("current"));
int total = Integer.parseInt(m.group("total"));
float pcnt = ((float) current / (float) total) * 100f;
Text progressText = Text.literal(current + "/" + total);
-
- ProgressComponent pc = new ProgressComponent(Ico.NETHER_STAR, Text.literal("Timecharms"), progressText, pcnt, pcntToCol(pcnt));
-
+
+ ProgressComponent pc = new ProgressComponent(Ico.NETHER_STAR, Text.literal("Timecharms"), progressText,
+ pcnt, pcntToCol(pcnt));
+
this.addComponent(pc);
}
-
- if(hasEnigmaSouls) {
+
+ if (hasEnigmaSouls) {
Matcher m = PlayerListMgr.regexAt(46, ENIGMA_SOULS_PATTERN);
-
+
int current = Integer.parseInt(m.group("current"));
int total = Integer.parseInt(m.group("total"));
float pcnt = ((float) current / (float) total) * 100f;
Text progressText = Text.literal(current + "/" + total);
-
- ProgressComponent pc = new ProgressComponent(Ico.HEART_OF_THE_SEA, Text.literal("Enigma Souls"), progressText, pcnt, pcntToCol(pcnt));
-
+
+ ProgressComponent pc = new ProgressComponent(Ico.HEART_OF_THE_SEA, Text.literal("Enigma Souls"),
+ progressText, pcnt, pcntToCol(pcnt));
+
this.addComponent(pc);
}
-
- if(montezumaPos != -1) {
+
+ if (montezumaPos != -1) {
Matcher m = PlayerListMgr.regexAt(montezumaPos, MONTEZUMA_PATTERN);
-
+
int current = Integer.parseInt(m.group("current"));
int total = Integer.parseInt(m.group("total"));
float pcnt = ((float) current / (float) total) * 100f;
Text progressText = Text.literal(current + "/" + total);
-
- ProgressComponent pc = new ProgressComponent(Ico.BONE, Text.literal("Montezuma"), progressText, pcnt, pcntToCol(pcnt));
-
+
+ ProgressComponent pc = new ProgressComponent(Ico.BONE, Text.literal("Montezuma"), progressText, pcnt,
+ pcntToCol(pcnt));
+
this.addComponent(pc);
}
-
+
this.pack();
}
-
+
private static int pcntToCol(float pcnt) {
return MathHelper.hsvToRgb(pcnt / 300f, 0.9f, 0.9f);
}