Jump to content

Recommended Posts

Posted

I have looked at several other threads and tutorials on this but it just doesnt seem to want to work. I am trying to add a custom sound to a mob, though this sound isnt nessecary i would still like to add it to my mob. here is what i have.

 

classes:

 

  Reveal hidden contents

 

 

As i said, i have tried everything i have seen to fix this. the sound file is in src/assets/mochickens/sounds/layDiamond.ogg

Posted

for most of them, just one i want custom which is in the onLivingUpdae() method. and before you point me toward your tutorial, i have looked at it and thats how i got to this point, i just cant get it to play in game.

 

public void onLivingUpdate() {
	super.onLivingUpdate();
	this.field_70888_h = this.field_70886_e;
	this.field_70884_g = this.destPos;
	this.destPos = (float) ((double) this.destPos + (double) (this.onGround ? -1
			: 4) * 0.3D);

	if (this.destPos < 0.0F) {
		this.destPos = 0.0F;
	}

	if (this.destPos > 1.0F) {
		this.destPos = 1.0F;
	}

	if (!this.onGround && this.field_70889_i < 1.0F) {
		this.field_70889_i = 1.0F;
	}

	this.field_70889_i = (float) ((double) this.field_70889_i * 0.9D);

	if (!this.onGround && this.motionY < 0.0D) {
		this.motionY *= 0.6D;
	}

	this.field_70886_e += this.field_70889_i * 2.0F;

	if (!this.isChild() && !this.worldObj.isRemote
			&& --this.timeUntilNextEgg == 0) {
		this.worldObj.playSoundAtEntity(this,
				"mochickens:sounds/layDiamond",
				1.0F,
				1.0F);
		this.dropItem(Item.diamond.itemID, 1);
		this.timeUntilNextEgg = this.rand.nextInt(1) + 60;
	}
}

 

specifically this block of it

if (!this.isChild() && !this.worldObj.isRemote
			&& --this.timeUntilNextEgg == 0) {
		this.worldObj.playSoundAtEntity(this,
				"mochickens:sounds/layDiamond",
				1.0F,
				1.0F);
		this.dropItem(Item.diamond.itemID, 1);
		this.timeUntilNextEgg = this.rand.nextInt(1) + 60;
	}

 

line is

this.worldObj.playSoundAtEntity(this, "mochickens:sounds/layDiamond", 1.0F, 1.0F);

Posted
  On 11/15/2013 at 8:48 AM, diesieben07 said:

If your sound file is

sounds/layDiamond.ogg

you have to call it with

sounds.layDiamond

when you want to play it.

 

here is the error i get by using that:

 

  Reveal hidden contents

 

 

the only change is on this on line:

this.worldObj.playSoundAtEntity(this, "mochickens:sounds.layDiamond", 1.0F, 1.0F);

Posted
  On 11/16/2013 at 7:39 AM, saxon564 said:

this.worldObj.playSoundAtEntity(this, "mochickens:sounds.layDiamond", 1.0F, 1.0F);

This would mean you put your sound at

assets/mochickens/sound/sounds/layDiamond ?

Posted

@diesieben07: i use audacity

 

@GotoLink: Thank you, that was the problem. i wasnt fully understanding the file path, though i thought i was. i changed the file path to that, and now it works.

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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