Jump to content

Recommended Posts

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!

Posted

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

Posted

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

Posted

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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