Posted June 28, 20214 yr Hey, I have a question. How do I play a sound while holding an item? Right now it works kinda but its a very shitty system and its performance properly sucks. I made a class based on MovingSound. It gets triggered by the ontickupdate event. To prevent the triggering of the sound twice I use the NBTCompound in which my MovingSound class writes a value into when its done playing. This value has to get checked on every tick. That sucks. Also it just breaks when I open my inventory. If you have a better idea please tell me. Thanks. Edited June 28, 20214 yr by TKFRvision
June 28, 20214 yr Author I see what you mean but I cant implement it like that (setting the volume to 0 when its not in hand) because idk when to create the instance of movingsound. In the minecart the entityspawn event is used. For items there is no such thing (or is there?) Edited June 28, 20214 yr by TKFRvision
June 28, 20214 yr Author Well that brings us back to the original problem...do I really have to read the nbt of every of this item every tick to check that the sound is not playing already? Because thats like a lot...Maybe there is a different system for checking that?
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.