Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.7.2] Stopping a sound effect or damaging an entity during its flashtime


chimera27
 Share

Recommended Posts

I just had a few questions about various things that I was unable to figure out on my own. First, I was wondering if there is a way to interrupt or stop a sound effect that's playing, like for instance start a sound effect but cut it off after X happens. As far as i've seen as soon as a sound effect starts then it just goes and there isn't a real way to stop it, but I was wondering if anyone else knew some way to do this. Another thing I was wondering (also likely impossible), was if it was possible to ignore the flashtime on a enemy and allow a projectile/item/misc damage source to hurt them faster then that. The method i've been using (entity.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), damage);) Does not allow for this, neither does a standard sword. If anyone could say if either of these are possible, that would be awesome :)

Creator of Metroid Cubed! Power Suits, Beams, Hypermode and more!

width=174 height=100http://i.imgur.com/ghgWmA3.jpg[/img]

Link to comment
Share on other sites

for the sound thing: I scooped around the MC source and the only way to stop a sound from playing is the SoundSystem.stop() method:

Minecraft.getMinecraft().sndManager.sndSystem.stop(s);

where s is a String representing the currently playing sound name

 

and after that remove the key s from the playingSounds hashset within sndManager, where you would need to use reflection in order to do the latter one since the field is private.

 

 

The second one, just set the hurtResistantTime variable within the entity instance to 0 before attempting to damage the entity.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

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

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.