aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorjani270 <69345714+jani270@users.noreply.github.com>2022-07-12 19:13:52 +0200
committerGitHub <noreply@github.com>2022-07-12 19:13:52 +0200
commitecbb0f68bbbd0dcea6c1a75855010d633625cc62 (patch)
tree7a3e0b01c31a07d5579d5ec4732f6687dd770458 /src/main/java/io
parente548f8974f402025692baa60c22a06c38a99c4a3 (diff)
downloadNotEnoughUpdates-ecbb0f68bbbd0dcea6c1a75855010d633625cc62.tar.gz
NotEnoughUpdates-ecbb0f68bbbd0dcea6c1a75855010d633625cc62.tar.bz2
NotEnoughUpdates-ecbb0f68bbbd0dcea6c1a75855010d633625cc62.zip
Added sound for 30s fishing timer (#184)
* Added sound for 30s fishing timer * move code and play sound only once * remove seconds check Co-authored-by: Lulonaut <lulonaut@tutanota.de>
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java19
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Fishing.java9
2 files changed, 27 insertions, 1 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java
index 26e25a11..13a078a2 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java
@@ -92,6 +92,7 @@ public class FishingHelper {
private int pingDelayTicks = 0;
private final List<Integer> pingDelayList = new ArrayList<>();
private int buildupSoundDelay = 0;
+ private boolean playedSound = false;
private static final ResourceLocation FISHING_WARNING_EXCLAM = new ResourceLocation(
"notenoughupdates:fishing_warning_exclam.png");
@@ -146,10 +147,26 @@ public class FishingHelper {
int ticksExisted = hook.ticksExisted;
float seconds = ticksExisted / 20F;
int color;
- if (seconds > 30) {
+ if (seconds >= 30) {
color = ChromaColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.fishing.fishingTimerColor30SecPlus);
+ if (NotEnoughUpdates.INSTANCE.config.fishing.fishingSound30Sec && !playedSound) {
+ ISound sound = new PositionedSound(new ResourceLocation("random.orb")) {{
+ volume = 50;
+ pitch = 2f;
+ repeat = false;
+ repeatDelay = 0;
+ attenuationType = ISound.AttenuationType.NONE;
+ }};
+
+ float oldLevel = Minecraft.getMinecraft().gameSettings.getSoundLevel(SoundCategory.RECORDS);
+ Minecraft.getMinecraft().gameSettings.setSoundLevel(SoundCategory.RECORDS, 1);
+ Minecraft.getMinecraft().getSoundHandler().playSound(sound);
+ Minecraft.getMinecraft().gameSettings.setSoundLevel(SoundCategory.RECORDS, oldLevel);
+ playedSound = true;
+ }
} else {
color = ChromaColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.fishing.fishingTimerColor);
+ playedSound = false;
}
Utils.drawStringCentered(
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Fishing.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Fishing.java
index e02413f7..513474ca 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Fishing.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Fishing.java
@@ -264,4 +264,13 @@ public class Fishing {
@ConfigAccordionId(id = 6)
public String fishingTimerColor30SecPlus = "0:255:0:0:0";
+ @Expose
+ @ConfigOption(
+ name = "Fishing timer ping (30s)",
+ desc = "Play a sound after 30 seconds passed"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 6)
+ public boolean fishingSound30Sec = true;
+
}