Started by
ahznb
on
Topic category: Help with Minecraft modding (Java Edition)
I'm trying to call playSound inside my custom block's randomTickUpdateEvent like this:
But the sound doesn't play at all. The line after it that sends chat will display the text though.
Is this a bug? Sounds play when called from other procs, so is it because it was called inside a tick event?
Edited by ahznb on Sat, 12/07/2019 - 15:22
Tick event of which mod element? You can open a support ticket and upload your workspace and tell me which mod elements to check too.
Its from Custom block element, Random tick event.
Random tick event has a computer icon next to it which means it is a client-only event and should only be used for particle effects.
Use tick update for this instead.
Ah, tick update works.
But looking in vanilla minecraft code in net.minecraft.block.BlockFire, they call playSound in randomDisplayTick, which is client side only as well. How is that?
There are a few different implementations of play sound and some are client-side only and this one is used by say a fire.
To offer better support for multiplayer and not to confuse users, we only offer server-side play sound procedure block.
Thanks for the explanation!