diff options
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java | 11 | ||||
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java | 6 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java index f2b13abc..f68f3c58 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java @@ -40,6 +40,10 @@ public class ItemCooldowns { private static final Map<ItemStack, Float> durabilityOverrideMap = new HashMap<>(); public static long pickaxeUseCooldownMillisRemaining = -1; private static long treecapitatorCooldownMillisRemaining = -1; + + public static boolean firstLoad = true; + public static long firstLoadMillis = 0; + private static long lastMillis = 0; public static long pickaxeCooldown = -1; @@ -57,6 +61,11 @@ public class ItemCooldowns { } long currentTime = System.currentTimeMillis(); + if (firstLoad) { + firstLoadMillis = currentTime; + firstLoad = false; + } + Long key; while ((key = blocksClicked.floorKey(currentTime - 1500)) != null) { @@ -78,7 +87,7 @@ public class ItemCooldowns { } @SubscribeEvent - public void onWorldUnload(WorldEvent.Load event) { + public void onWorldLoad(WorldEvent.Load event) { blocksClicked.clear(); if (pickaxeCooldown > 0) pickaxeUseCooldownMillisRemaining = 60 * 1000; pickaxeCooldown = -1; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java index 03fe9eff..4fe3aa8d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java @@ -397,6 +397,12 @@ public class MiningOverlay extends TextTabOverlay { } } + if (ItemCooldowns.firstLoadMillis > 0) { + //set cooldown on first skyblock load. + ItemCooldowns.pickaxeUseCooldownMillisRemaining = 60 * 1000 - (System.currentTimeMillis() - ItemCooldowns.firstLoadMillis); + ItemCooldowns.firstLoadMillis = 0; + } + String pickaxeCooldown; if (ItemCooldowns.pickaxeUseCooldownMillisRemaining <= 0) { pickaxeCooldown = DARK_AQUA + "Pickaxe CD: \u00a7aReady"; |