aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com>2024-06-13 02:38:36 +1000
committerGitHub <noreply@github.com>2024-06-12 18:38:36 +0200
commitfc45d59ebdb7ed846ad5be2ddb077de4c6b779fe (patch)
tree5d596e720ff346fdbbd88d231747ff1630684e8b
parent01917a751c087ddb97e899611777a6f6de24ad01 (diff)
downloadNotEnoughUpdates-fc45d59ebdb7ed846ad5be2ddb077de4c6b779fe.tar.gz
NotEnoughUpdates-fc45d59ebdb7ed846ad5be2ddb077de4c6b779fe.tar.bz2
NotEnoughUpdates-fc45d59ebdb7ed846ad5be2ddb077de4c6b779fe.zip
Add NeuCalendar improvements (#1204)
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java7
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java32
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java14
3 files changed, 45 insertions, 8 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
index d67b7fb2..7c847526 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
@@ -304,6 +304,8 @@ public class RenderListener {
}
}
+ boolean storageTurnedOffTheCalendar = false;
+
/**
* Sets hoverInv and focusInv variables, representing whether the NEUOverlay should render behind the inventory when
* (hoverInv == true) and whether mouse/kbd inputs shouldn't be sent to NEUOverlay (focusInv == true).
@@ -420,9 +422,14 @@ public class RenderListener {
boolean storageOverlayActive = StorageManager.getInstance().shouldRenderStorageOverlay(containerName);
if (storageOverlayActive) {
+ storageTurnedOffTheCalendar = true;
+ CalendarOverlay.ableToClickCalendar = false;
StorageOverlay.getInstance().render();
event.setCanceled(true);
return;
+ } else if (storageTurnedOffTheCalendar) {
+ CalendarOverlay.ableToClickCalendar = true;
+ storageTurnedOffTheCalendar = false;
}
if (tradeWindowActive) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java
index f2af715c..aef92239 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java
@@ -93,6 +93,8 @@ public class CalendarOverlay {
public static boolean ableToClickCalendar = true;
long thunderStormEpoch = 1692826500000L;
+ long oringoEpoch = 1583153700000L;
+ long oringoInterval = 223200000L;
long rainInterval = 3600000L;
long thunderFrequency = 3;
long rainDuration = 1200 * 1000L;
@@ -112,7 +114,7 @@ public class CalendarOverlay {
private int ySize = 170;
private static final Pattern CALENDAR_PATTERN = Pattern.compile(
- "((?:Early | Late )?(?:Spring|Summer|Fall|Winter)), Year ([0-9]+)");
+ "((?:Early |Late )?(?:Spring|Summer|Fall|Winter)), Year ([0-9]+)");
private int jingleIndex = -1;
@@ -143,8 +145,6 @@ public class CalendarOverlay {
"NEU Calendar Item"
); // Star Cult Stack
- private boolean canAddcountdownCalc = (NotEnoughUpdates.INSTANCE.config.misc.showWhenCountdownEnds == 1 || NotEnoughUpdates.INSTANCE.config.misc.showWhenCountdownEnds == 2);
-
static {
NBTTagCompound tag = new NBTTagCompound();
tag.setString("event_id", "dark_auction");
@@ -356,6 +356,20 @@ public class CalendarOverlay {
}
}
+ String[] oringoPets = new String[]{
+ "§6Lion",
+ "§6Monkey",
+ "§6Elephant",
+ "§6Tiger",
+ "§6Blue Whale",
+ "§6Giraffe",
+ };
+
+ public String getZooPet(long startTime) {
+ long time = startTime - oringoEpoch;
+ return "§7Pet available: " + oringoPets[(int) ((time / oringoInterval) % 6)];
+ }
+
@SubscribeEvent
public void tick(RepositoryReloadEvent event) {
JsonObject calendarJson = NotEnoughUpdates.INSTANCE.manager.getJsonFromFile(new File(
@@ -506,6 +520,10 @@ public class CalendarOverlay {
if (lore.isEmpty()) continue;
String first = lore.get(0);
if (first.startsWith(startsInText)) {
+ boolean zoo = false;
+ if (item.hasDisplayName()) {
+ zoo = item.getDisplayName().equals("§aTraveling Zoo");
+ }
String time = Utils.cleanColour(first.substring(startsInText.length()));
long eventTime = currentTime + getTimeOffset(time);
@@ -521,11 +539,15 @@ public class CalendarOverlay {
String lastsForS = Utils.cleanColour(line.substring(lastsForText.length()));
lastsFor = getTimeOffset(lastsForS);
}
- if (Utils.cleanColour(line).trim().length() == 0) {
+ if (Utils.cleanColour(line).trim().isEmpty()) {
foundBreak = true;
}
}
}
+ if (zoo) {
+ desc.add("");
+ desc.add(getZooPet(eventTime));
+ }
getEventsAt(eventTime).add(new SBEvent(
getIdForDisplayName(item.getDisplayName()), item.getDisplayName(),
true, item, desc, lastsFor
@@ -548,7 +570,7 @@ public class CalendarOverlay {
JsonArray array = new JsonArray();
for (String line : ItemUtils.getLore(item)) {
- if (line.startsWith(EnumChatFormatting.YELLOW + "\u25CB")) {
+ if (line.startsWith("§e○") || line.startsWith("§6☘")) {
array.add(new JsonPrimitive(Utils.cleanColour(line.substring(4))));
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java
index bd869c90..0cada57e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java
@@ -252,8 +252,13 @@ public class GuiCustomHex extends Gui {
return INSTANCE;
}
+ boolean hexTurnedOffTheCalendar = false;
+
public boolean shouldOverride(String containerName) {
- CalendarOverlay.ableToClickCalendar = true;
+ if (hexTurnedOffTheCalendar) {
+ CalendarOverlay.ableToClickCalendar = true;
+ hexTurnedOffTheCalendar = false;
+ }
if (containerName == null) {
shouldOverrideET = false;
shouldOverrideFast = false;
@@ -307,8 +312,11 @@ public class GuiCustomHex extends Gui {
ContainerChest cc = (ContainerChest) chest.inventorySlots;
ItemStack hexStack = cc.getLowerChestInventory().getStackInSlot(50);
ItemStack bookStack = cc.getLowerChestInventory().getStackInSlot(32);
- CalendarOverlay.ableToClickCalendar =
- !(shouldOverrideET || shouldOverrideFast || shouldOverrideGemstones || shouldOverrideXp);
+ boolean shouldDisableCalendar = !(shouldOverrideET || shouldOverrideFast || shouldOverrideGemstones || shouldOverrideXp);
+ if (!shouldDisableCalendar && CalendarOverlay.ableToClickCalendar) {
+ CalendarOverlay.ableToClickCalendar = false;
+ hexTurnedOffTheCalendar = true;
+ }
if (bookStack != null && bookStack.getItem() == Items.book) {
shouldOverrideGemstones = false;
}