Mrbysco / Durability-Notifier

Notifying you whenever your tools hit a certain percentage of durability since 2017
https://www.curseforge.com/minecraft/mc-mods/durability-notifier
MIT License
6 stars 5 forks source link

[Suggestion]: Don't allow sound to play after the first time durability drops below the configured percent #5

Closed Kaleidio closed 2 years ago

Kaleidio commented 2 years ago

General Info

Suggestion Description

The sound rapidly plays any time you hold the use button, which can spam the noise 20 times per second, making it annoying

I propose adding code that only plays the sound once it drops below the configured durability, then don't play the sound again until the weapon has been repaired above the configured durability and drops below it again.

Mrbysco commented 2 years ago

Durability is checked every time an item is about to be used (Right click, left click etc). The reason it plays so many times is because the even fires every tick so it fires 20 times a second.

Kaleidio commented 2 years ago

can you add a boolean that is tested every time that check occurs so it only plays the sound once, then sets the bool to true until it sees durability above the configured percent again where it sets it to false, only playing the sound when the bool is false?

Kaleidio commented 2 years ago

considering that, it could also be on a per item basis, and it might be possible to store those bools entirely client side and not save them to world data at all (which would be beneficial so logging into a new world reminds the player that this tool is low)

Mrbysco commented 2 years ago

This will be fixed in 1.1.0 which will be uploaded shortly