Jump to content

[1.9.4] [SOLVED] Block-Entity Sounds


Bektor

Recommended Posts

Hi,

 

I'm wondering how I can let a entity, for example a falling block play a sound. So when the block get's removed and replaced with the falling entity

a custom falling sound will be played until the entity reaches the ground.

 

It would also be nice to have the sound quieter when the distance between the player and the block is larger and the sound.

And is there a method for letting the sound play later when the player is farer away like in RL?

 

Just to mention, I have the Falling entity instance, but I don't have access to any player...

 

In I think 1.8.9 was it, I did it that way:

entityFallingBlock.worldObj.playSoundAtEntity(entityFallingBlock, ModSounds.FALLINING_ROCK_SHORT, .8f, .5f);

 

I'm now using 1.9.4.

 

Thx in advance.

Bektor

Developer of Primeval Forest.

Link to comment
Share on other sites

You have to register a

SoundEvent

for every one of your sounds. This registration works just like for Blocks or Items, you create a new SoundEvent and register it using

GameRegistry.register

. The method you were using does not exist anymore now, but you can use

Entity#playSound

.

Ok, thx. ;)

Developer of Primeval Forest.

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

×
×
  • Create New...

Important Information

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