
Pockets playSound cause java exception
Wojbie opened this issue ยท 1 comments
Minecraft Version
1.21.7
Version
1.116.0
Details
Pockets with speakers appear to have issue with playSound function, causing java error related to main thread. playNote and playAudio run fine. Other computers and turtles run all 3 speaker functions without issues.
local speaker = peripheral.find("speaker")
speaker.playSound("entity.firework_rocket.blast")

Log file with java errors that this causes:
latest.log
Oh, hahaha. That's embarrassing indeed.
[09:46:32] [ComputerCraft-Computer-Worker-2/ERROR]: Error calling call on dan200.computercraft.core.apis.PeripheralAPI@c044aae
java.lang.IllegalStateException: Must be called from the main thread
at knot/dan200.computercraft.shared.pocket.core.PocketBrain.requireMainThread(PocketBrain.java:102) ~[cc-tweaked-1.21.7-fabric-1.116.0.jar:?]
at knot/dan200.computercraft.shared.pocket.core.PocketBrain.getEntity(PocketBrain.java:115) ~[cc-tweaked-1.21.7-fabric-1.116.0.jar:?]
at knot/dan200.computercraft.shared.pocket.core.PocketBrain$UpgradeAccess.getEntity(PocketBrain.java:220) ~[cc-tweaked-1.21.7-fabric-1.116.0.jar:?]
at knot/dan200.computercraft.shared.pocket.peripherals.PocketSpeakerPeripheral.getPosition(PocketSpeakerPeripheral.java:28) ~[cc-tweaked-1.21.7-fabric-1.116.0.jar:?]
at knot/dan200.computercraft.shared.peripheral.speaker.SpeakerPeripheral.playSound(SpeakerPeripheral.java:258) ~[cc-tweaked-1.21.7-fabric-1.116.0.jar:?]
at knot/dan200.computercraft.core.asm.PeripheralMethodSupplier.lambda$static$0(PeripheralMethodSupplier.java:28) ~[cc-tweaked-1.21.7-fabric-1.116.0.jar:?]
at knot/dan200.computercraft.core.apis.PeripheralAPI$PeripheralWrapper.call(PeripheralAPI.java:105) ~[cc-tweaked-1.21.7-fabric-1.116.0.jar:?]
at knot/dan200.computercraft.core.apis.PeripheralAPI.call(PeripheralAPI.java:323) ~[cc-tweaked-1.21.7-fabric-1.116.0.jar:?]
at knot/dan200.computercraft.core.asm.LuaMethodSupplier.lambda$static$0(LuaMethodSupplier.java:27) ~[cc-tweaked-1.21.7-fabric-1.116.0.jar:?]
at knot/dan200.computercraft.core.lua.ResultInterpreterFunction.invoke(ResultInterpreterFunction.java:56) ~[cc-tweaked-1.21.7-fabric-1.116.0.jar:?]