Jump to content

Recommended Posts

Posted

Ok first of all i have block in "" as im pretty sure its done in the blocks tileEntity and not the block itself...though im open to the posibility im wrong.

 

A perfect example of what i want to achieve is the pulverisor or sawmill from ThermalExpansion, when the block is active it emits a noise,

now i know how to register sounds (unless they are registered differently if we need them to loop ofcourse)

 

so lets take a sound for an example laugh

we have this line in our sounds.json (if additional stuff needs to be added let me know)

 "laugh": {"category": "master","sounds": [{"name": "laugh","stream": false}]},

 

how would we then trigger that sound to be heard from that "block " on a loop untill we tell it not to ?

If its on a loop can we stop it and then start it with a different pitch?

 

 

the goal im going for in my mod:

my block detects its raining (done) if its raining it starts to charge up ...this will mean a sparking noise quiet and slow the duration being random, then a switch to the next sound file again random duration , a faster spark

 

i now how to make a sound play once but not how to make it loop, im pretty sure thermal expansion arnt playing thier sound waiting for it to end then playing it again...but i could be wrong.

Posted

it seems i had this problem before (http://www.minecraftforge.net/forum/index.php/topic,20966.msg106896.html#msg106896) sadly im cursed with a memory issue (short term and some long term is fine but other long term just...well gets deleted)

 

read through it all and i feel i would of been better off not finding my old thread, more confused then ever

 

Still i sort of understand packets now (i have even managed to successfully send one) and that may help.

 

I confess i was hoping for a more newb friendly response then look at this class, trying to work it out from the class feels like reinventing the wheel given that other mods have done it successfully.

 

 

**edit**

nope, i just cant figure it out from the old thread and that class, i ny be missing something blindingly obvoiuse but then i wasnt taught java at school and i mod for fun, i have enough java knowledge to do something but this is clearly beyond me.

 

for now i will play sound the only way i know how and have it play every x ticks where x is the length of ticks the file is.....if its on a server that has tick issues that could be bad but i see no way to do looped sounds and be server friendly. I dont get much free time between work and life hence my comment about not wanting to reinvent the wheel and have wasted what little i had tonight on trying this :( may try again at the end of the month when ill have more time.

 

Posted

i cant remember what went wrong, i believe it was fine in singleplayer but once in a multiplayer enviroment it failed or crashed.

 

on my laptop i have my work around, basicly what i have done is made it play the sound if thier is one, and start a timer (all this is in the onUpdate) when the timer reaches x the sound is played again, this repeats until the sound given to it is nulled (its pretty much how pneumaticcraft does it), x in my case though is setup from my constants file which will have a list of all the sound files im likely to need to loop and thier length in ticks, so to get x i simply call the method in the constants with the sound name and it returns the length

 

its not pretty

its not efficent

On a server with a bad tick rate it will have pauses in the loop

but atleast i can understand it, at a much later point when my knowledge gets better i may be able to do it right but for now i have to settle for the work around, the end user should only notice a difference if the tps is low..it which point they have more important things to deal with then my sound file sounding wierd :)

 

**edit**

looking at some of the other threads and info on updating to 1.8 i kind of think i would be better scrapping what i have and starting again but at 1.8, granted some of the stuff in my mod wont work for months as they rely on other mods (or are addons to other mods) but better that then learn stuff that i will need to do differently in a few months anyway.

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.