aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
diff options
context:
space:
mode:
authorRoman / Nea <roman.graef@gmail.com>2022-01-16 01:03:04 +0100
committerGitHub <noreply@github.com>2022-01-15 19:03:04 -0500
commitc81b6a34ae7bbb70a11f23f49422f2fceffa689c (patch)
tree44d2f2ba99a7e1746293489ee9b00dc9c307735b /src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
parent2aa911fa84399a5a8cc9f36715246c7f3eee7133 (diff)
downloadnotenoughupdates-c81b6a34ae7bbb70a11f23f49422f2fceffa689c.tar.gz
notenoughupdates-c81b6a34ae7bbb70a11f23f49422f2fceffa689c.tar.bz2
notenoughupdates-c81b6a34ae7bbb70a11f23f49422f2fceffa689c.zip
Add sounds and rework the existing textures to custom Dwarven Mines /… (#51)
* Pre Work of custom biomes * Work on auto chunk update, Add Debug command * Added 6 new biomes that are used in crystal hollows * Made it so the biomes are registered in the main class so it loads properly * Add sounds and rework the existing textures to custom Dwarven Mines / CH blocks * Config fixups * make titanium sounds work * Added sounds per gemstone type * fix dwarven mines sounds * stop spamming sound effects with config * Changelog for CH custom blocks * add all the files * Update src/main/resources/assets/notenoughupdates/sounds/titaniumbreak.json * Update src/main/resources/assets/notenoughupdates/sounds/mithrilbreak.json * Update src/main/resources/assets/notenoughupdates/sounds/gemstonetopazbreak.json * Update src/main/resources/assets/notenoughupdates/sounds/gemstonerubybreak.json * Update src/main/resources/assets/notenoughupdates/sounds/gemstonesapphirebreak.json * Update src/main/resources/assets/notenoughupdates/sounds/gemstonejasperbreak.json * Update src/main/resources/assets/notenoughupdates/sounds/gemstoneamethystbreak.json * Update src/main/resources/assets/notenoughupdates/sounds/gemstonejadebreak.json * Update src/main/resources/assets/notenoughupdates/sounds/gemstoneamberbreak.json * Update src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java * Update src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java * Update src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java * Update src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java * Update src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java * Update src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java Co-authored-by: DoKM <mcazzyman@gmail.com> Co-authored-by: nopothegamer <40329022+nopothegamer@users.noreply.github.com> Co-authored-by: IRONM00N <64110067+IRONM00N@users.noreply.github.com>
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java35
1 files changed, 24 insertions, 11 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
index 008738fd..6dcd284e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java
@@ -2,6 +2,7 @@ package io.github.moulberry.notenoughupdates.util;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.LocationChangeEvent;
import io.github.moulberry.notenoughupdates.overlays.SlayerOverlay;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiChest;
@@ -14,6 +15,7 @@ import net.minecraft.scoreboard.Scoreboard;
import net.minecraft.util.IChatComponent;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
import net.minecraftforge.client.event.GuiOpenEvent;
+import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@@ -23,6 +25,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -77,7 +80,7 @@ public class SBInfo {
public void onWorldLoad(WorldEvent.Load event) {
lastLocRaw = -1;
locraw = null;
- mode = null;
+ this.setLocation(null);
joinedWorld = System.currentTimeMillis();
lastOpenContainerName = "";
hasNewTab = false;
@@ -106,7 +109,7 @@ public class SBInfo {
if (System.currentTimeMillis() - lastManualLocRaw > 5000) event.setCanceled(true);
if (obj.has("gametype") && obj.has("mode") && obj.has("map")) {
locraw = obj;
- mode = locraw.get("mode").getAsString();
+ setLocation(locraw.get("mode").getAsString());
}
}
} catch (Exception e) {
@@ -116,12 +119,16 @@ public class SBInfo {
}
public String getLocation() {
- if (mode == null) {
- return null;
- }
return mode;
}
+ public void setLocation(String location) {
+ if (!Objects.equals(this.mode, location)) {
+ MinecraftForge.EVENT_BUS.post(new LocationChangeEvent(location, this.mode));
+ }
+ this.mode = location;
+ }
+
private static final String profilePrefix = "\u00a7r\u00a7e\u00a7lProfile: \u00a7r\u00a7a";
private static final String skillsPrefix = "\u00a7r\u00a7e\u00a7lSkills: \u00a7r\u00a7a";
@@ -154,7 +161,8 @@ public class SBInfo {
try {
int level = Integer.parseInt(matcher.group(2).trim());
XPInformation.getInstance().updateLevel(matcher.group(1).toLowerCase().trim(), level);
- } catch (Exception ignored) {}
+ } catch (Exception ignored) {
+ }
}
}
}
@@ -204,13 +212,17 @@ public class SBInfo {
if (SlayerOverlay.slayerQuest) {
if (line.contains(" I")) {
SlayerOverlay.slayerTier = 1;
- } if (line.contains(" II")) {
+ }
+ if (line.contains(" II")) {
SlayerOverlay.slayerTier = 2;
- } if (line.contains(" III")) {
+ }
+ if (line.contains(" III")) {
SlayerOverlay.slayerTier = 3;
- } if (line.contains(" IV")) {
+ }
+ if (line.contains(" IV")) {
SlayerOverlay.slayerTier = 4;
- } if (line.contains(" V")) {
+ }
+ if (line.contains(" V")) {
SlayerOverlay.slayerTier = 5;
}
}
@@ -226,7 +238,8 @@ public class SBInfo {
String timeSpace = time.replace("am", " am").replace("pm", " pm");
SimpleDateFormat parseFormat = new SimpleDateFormat("hh:mm a");
currentTimeDate = parseFormat.parse(timeSpace);
- } catch (ParseException ignored) {}
+ } catch (ParseException ignored) {
+ }
}
//Replaced with for loop because in crystal hollows with events the line it's on can shift.
for (String line : lines) {