Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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 by TKFRvision

  • 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 by TKFRvision

  • 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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.