chimera27 Posted April 24, 2014 Posted April 24, 2014 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 Quote Creator of Metroid Cubed! Power Suits, Beams, Hypermode and more! http://i.imgur.com/ghgWmA3.jpg[/img]
SanAndreaP Posted April 24, 2014 Posted April 24, 2014 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. Quote 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.
Recommended Posts
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.