Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(legacy) Playsound ConcurrentModificationException #4199

Merged
merged 1 commit into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,11 @@ abstract class Command(val command: String, vararg val alias: String) : Minecraf
/**
* Play edit sound
*/
protected fun playEdit() = mc.soundHandler.playSound(PositionedSoundRecord.create(ResourceLocation("random.anvil_use"), 1F))
protected fun playEdit() {
synchronized(mc.soundHandler) {
mc.soundHandler.playSound(
PositionedSoundRecord.create(ResourceLocation("random.anvil_use"), 1F)
)
}
}
}
13 changes: 8 additions & 5 deletions src/main/java/net/ccbluex/liquidbounce/features/module/Module.kt
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,14 @@ open class Module constructor(

// Play sound and add notification
if (!isStarting) {
mc.soundHandler.playSound(PositionedSoundRecord.create(ResourceLocation("random.click"), 1F))
addNotification(Notification(translation("notification.module" + if (value) "Enabled" else "Disabled",
getName()
)
)
synchronized(mc.soundHandler) {
mc.soundHandler.playSound(
PositionedSoundRecord.create(ResourceLocation("random.click"), 1F)
)
}
addNotification(
Notification(translation("notification.module" + if (value) "Enabled" else "Disabled", getName())
)
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ object ClickGui : GuiScreen() {

displayChatMessage("§6Settings applied successfully")
HUD.addNotification(Notification("Updated Settings"))
mc.soundHandler.playSound(
PositionedSoundRecord.create(
ResourceLocation("random.anvil_use"), 1F
synchronized(mc.soundHandler) {
mc.soundHandler.playSound(
PositionedSoundRecord.create(ResourceLocation("random.anvil_use"), 1F)
)
)
}
} catch (e: Exception) {
ClientUtils.LOGGER.error("Failed to load settings", e)
displayChatMessage("Failed to load settings: ${e.message}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,21 @@ abstract class Style : MinecraftInstance() {
abstract fun drawButtonElement(mouseX: Int, mouseY: Int, buttonElement: ButtonElement)
abstract fun drawModuleElementAndClick(mouseX: Int, mouseY: Int, moduleElement: ModuleElement, mouseButton: Int?): Boolean

fun clickSound() = mc.soundHandler.playSound(PositionedSoundRecord.create(ResourceLocation("gui.button.press"), 1f))
fun clickSound() {
synchronized(mc.soundHandler) {
mc.soundHandler.playSound(
PositionedSoundRecord.create(ResourceLocation("gui.button.press"), 1F)
)
}
}

fun showSettingsSound() = mc.soundHandler.playSound(PositionedSoundRecord.create(ResourceLocation("random.bow"), 1f))
fun showSettingsSound() {
synchronized(mc.soundHandler) {
mc.soundHandler.playSound(
PositionedSoundRecord.create(ResourceLocation("random.bow"), 1F)
)
}
}

protected fun round(v: Float): Float {
var bigDecimal = BigDecimal(v.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import net.ccbluex.liquidbounce.utils.render.toColorArray
import net.ccbluex.liquidbounce.value.*
import org.lwjgl.opengl.GL11

// TODO: Delete on b99 (Dev Build)
@ElementInfo(name = "BlockCounter")
class BlockCounter(x: Double = 520.0, y: Double = 245.0) : Element(x = x, y = y) {

Expand Down