Jump to content

outflows

Members
  • Posts

    82
  • Joined

  • Last visited

Everything posted by outflows

  1. Could you show me an example of this being used
  2. Yes, I have seen you on like 3 other posts saying that. I looked at the class and I didn't really understand how on earth I was supposed to implement that into my code. Granted I only started modding like a week ago. I actually figured it out though for anyone who wants to know. It's incredibly simple: Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMusicRecord(SoundEvent));
  3. Thanks for the help with that but I have one more question if you don't mind helping. Although this is somewhat unrelated, I've been searching through forum posts for hours now and can't figure out how to make the sound follow the player. If you could help that would be awesome
  4. So i've been using playsound in order to play sound at a player's position. I wanted to figure out if there was a way that you can make the sound follow the user rather than just play at the position that they were at when I called the function.
  5. what would the appropriate event be? Also, would I put the eventbus for this in the init or preinit? One last thing, the sound file I'm using is like 3 minutes long so would that affect anything?
  6. So all I want to do is add a sound to the registry but for some reason it's not working. This is what I did: public class SoundRegistrator { public static final SoundEvent BOND; static { BOND = addSoundsToRegistry("bond"); } private static SoundEvent addSoundsToRegistry(String soundId) { ResourceLocation shotSoundLocation = new ResourceLocation("pokalert", soundId); SoundEvent soundEvent = new SoundEvent(shotSoundLocation); soundEvent.setRegistryName(shotSoundLocation); return soundEvent; } } public class SoundRegisterListener { @SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true) public void registerSOundEvents(RegistryEvent.Register<SoundEvent> event) { event.getRegistry().registerAll(SoundRegistrator.BOND); } } EntityPlayer player = Minecraft.getMinecraft().player; EntityPlayerSP sp = (EntityPlayerSP)player; ResourceLocation location = new ResourceLocation("pokalert", "bond"); SoundEvent sevent = new SoundEvent(location); sp.playSound(sevent, 5.0f, 5.0f); { "bond": { "category": "player", "sounds": [{ "name": "pokalert:bond.ogg", "stream": true }] } }
  7. So I have a pretty complicated problem at the moment. What I want is to be able to play some music when a certain mob is detected. The problem with this is that I check if the mob is being detected every tick and therefore, the sound resets every time it gets to the playsound function (once a tick as long as the mob is still withing loaded chunks). This results in the music playing over and over again instead of stopping only when the mob is no longer within loaded chunks. So I know I can fix this by using a boolean variable to tell whether or not the mob is there, but I have no clue how to stop the playsound function once it starts. I really don't want to have to implement threading into this mod because I don't know how to do that and it would make things way more complicated than they need to be, so if anyone can help that would be awesome.
×
×
  • Create New...

Important Information

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