Jump to content

[Request] Minor change to onPlaySound hook in ISoundHandler


Recommended Posts

Posted

Currently the onPlaySound hook from ISoundHandler is triggered from within the playSound method in SoundManager. playSoundEffect in World first calls playSound in RenderGlobal and in that method a distance check is made to the current renderViewEntity before passing it on to SoundManager.

 

This means that the Forge hook is never called if the current render entity is out of a certain range of the block.

Would it be possible to move the call to the hook before the range check is done, either within World or within RenderGlobal ? This way you could still check if a sound was supposed to be played even if it is never actually played due to distance considerations, making it possible to create blocks that can "listen" for certain sounds.

 

NOTE: The onPlaySoundAtEntity hook in ISoundHandler works correctly as it is triggered within World

47MdL.png

Posted

Not to be a fanboy or anything, but... I love your mod. CreeperFace.png

Sorry for the lack of useful input. I just wanted to let you know. :D

 

Well, I guess this post won't be completely useless. The link in your signature is broken. Try this instead. :)

[url=http://www.minecraftforum.net/topic/838839-100-thaumcraft/][img=http://i.imgur.com/47MdL.png][/url]

 

 

47MdL.png

 

Check out my

Texture Packs Thread here on the Forge Forum. :)

Currently in the process of adding some mod support for JohnSmith Texture Pack.

width=105 height=12https://www.sugarsync.com/piv/D8135159_67366891_21351[/img]

 

width=209 height=19https://www.sugarsync.com/piv/D8135159_67366891_772852[/img]

Posted

not against it personally, but in order for this to work, would they not have to re-write half the vanilla sound handling code? :S

(i am not a java expert, and honestly have not spend a lot of time looking over the MC base-code)

Being noobish since 96, being dumb since birth!

  • 2 weeks later...
Posted

This is good idea.

Maybe another hook without a range check?

So, what would happen if I did push that shiny red button over there? ... Really? ... Can I try it? ... Damn.

  • 2 weeks later...
Posted

As an example for when I ran into this issue:

 

I created a block that "listens" via the hook for specific notes being played by a vanilla noteblock. Everthing works perfectly as long as the player remains within the view distance of the noteblock. Any further and the sounds doesn't play and the hook is never triggered.

 

However the sound call is still made so in my mind the hook should still trigger, even though the actual sound doesn't play.

 

 

Anyway, there are a few other issues with this as well, since I suspect this won't work in SMP anyway.

47MdL.png

Posted

As an example for when I ran into this issue:

 

I created a block that "listens" via the hook for specific notes being played by a vanilla noteblock. Everthing works perfectly as long as the player remains within the view distance of the noteblock. Any further and the sounds doesn't play and the hook is never triggered.

 

However the sound call is still made so in my mind the hook should still trigger, even though the actual sound doesn't play.

 

 

Anyway, there are a few other issues with this as well, since I suspect this won't work in SMP anyway.

 

If a tree falls in the wood, and no one is around, does it still make a noise?

 

Instead of hooking to the sound, can you hook to the activation of the noteblock itself, and check to make sure that it is set to the particular 'sound' you are looking for? Perhaps restrict it to check for it being within x block radius, so it would be able to legitimately 'hear' the noise itself.

 

Not very familiar with Java code yet, but in logic statements:

 

If (noteblock triggers) THEN
   IF (noteblock is within range) THEN
        IF (Noteblock is set to the particular setting you are looking for) THEN
            Trigger
        ENDIF
   ENDIF
ENDIF

 

Just throwing out an idea for you

Posted

cant wait for new mods, since i bought the game 2 days ago :) now i can play mc without being afraid to get problems with mojang or the law :-P oh and servers are not a problem anymore, damn shitty cracked servers lol, just a waste of time

Minecraft.net Username: Sailren

Posted

cant wait for new mods, since i bought the game 2 days ago :) now i can play mc without being afraid to get problems with mojang or the law :-P oh and servers are not a problem anymore, damn shitty cracked servers lol, just a waste of time

 

Yeah. I can honestly say that with what I've gotten out of it, and still get plenty out of, that Minecraft is probably the best $26 or so I ever spent on a videogame. :P

Check out my

Texture Packs Thread here on the Forge Forum. :)

Currently in the process of adding some mod support for JohnSmith Texture Pack.

width=105 height=12https://www.sugarsync.com/piv/D8135159_67366891_21351[/img]

 

width=209 height=19https://www.sugarsync.com/piv/D8135159_67366891_772852[/img]

Posted

and we can show our creativity in this game, just look after the enterprise in youtube :D one of them, others build the red dragon in zelda wind waker :) at the moment im trying to play direwolfs season 4 lets play on my own, i will update to 1.3.1, when he starts his season 5 and i have finished my season 4 :D

Minecraft.net Username: Sailren

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.