diff options
Diffstat (limited to 'src/main/java/io')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java | 19 | ||||
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Fishing.java | 9 |
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; + } |