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

Anyone know how a mob can play music RIGHT when it spawns... and upon death, the music stops...

So far I only have 2 boss mobs, but this is still very important to me!

I am aware of the .playSoundatEntity and the onDeath... BUT I DONT EXACTLY KNOW HOW TO CONSTRUCT THE CODE!

So you don't know how to load the sound to the sound-pool and such?

 

If you don't, I can help you there.

 

With playing the sound on spawn... How is the boss mob spawned? If it is spawned via an item or such, you can play the music via the constructor of the boss mob. Yeah just play the sound via the mob's (entity's) constructor. Then you can do the LivingDeathEvent (I think its called that) and stop the song from playing...

 

To be more clear, the only way I can think of STOPPING the music when the boss dies is to, on the construction of the boss, create a new thread that plays the music. Then, using the LivingDeathEvent afore mentioned, stop the thread, thus stopping the music. If you need help just ask :D

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

  • Author

I read the part you crossed out... It actually is summoned via Item... So how do I actually play the music with the item?

Well then :D

 

 

You could do the same thing. But then if you didn't want to do that, you could create the thread when you summon the boss. Sam concept really. And you would still need the LivingDeathEvent thing

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

And instead of using the LivingDeathEvent you could better override setDead() with the line diesieben07 posted to stop the sound.

Author of PneumaticCraft, MineChess, Minesweeper Mod and Sokoban Mod. Visit www.minemaarten.com to take a look at them.

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.