Jump to content

Recommended Posts

Posted

Basically, I've been setting up this custom tamable mob, copying over code from the Wolf and other entities and then replacing it to what I need.

It works, except for two little details - firstly: baby mobs.

I'd like my mob to be able to breed, which it can - once I tame two and give them both fishes. They then engage to kiss and then a baby pops out...except it's not a baby and it's an adult...well the model is an adult, the bounds are for a baby, the shadow is for a baby etc... Basically it's a baby mob with the adult model. Here's my code for the createChild:

    public EntityPenguin createChild(EntityAgeable par1EntityAgeable)
    {
    	EntityPenguin entitypenguin = new EntityPenguin(this.worldObj);
        String s = this.getOwnerName();

        if (s != null && s.trim().length() > 0)
        {
        	entitypenguin.setOwner(s);
        	entitypenguin.setTamed(true);
        }

        return entitypenguin;
    }

 

And the other problem I have is the sounds. I've looked around a bunch and found some tutorials, but afaik, the sound system is different for 1.7.x, rendering all 1.6.x tutorials useless. The only one I found didn't get me too far. So if anyone has any knowledge of the sounds in 1.7.x, I'd greatly appreciate it. :D

 

EDIT: I have figured out the baby mobs, thanks to delpi. But I'm still unsure about the sounds, if anyone could help then that'd be awesome.

Posted

I'm guessing a bit, but I bet your model / entity isn't based upon something ageable and it isn't passing the baby variable onto the model or client.  That or your model isn't written to shrink a baby.

 

If you look at ageable, I think it will add the child variable to a datawatcher.  You might be able to jsut do that if your model is setup to render a child correctly.

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

I'm guessing a bit, but I bet your model / entity isn't based upon something ageable and it isn't passing the baby variable onto the model or client.  That or your model isn't written to shrink a baby.

 

If you look at ageable, I think it will add the child variable to a datawatcher.  You might be able to jsut do that if your model is setup to render a child correctly.

Oh, I didn't even think of  that. I'll try it out.

Posted

I don't have my setup handy to give you a copy but I'll lay it out for you and you can probably find the right tutorial from there.

 

In your resources folder you need a sounds.json file which describes your sounds. Then you create a folder in your resources called "sounds" and put your .ogg files in there.

 

This video is pretty good on it if I'm remembering the right one.

 

https://www.youtube.com/watch?v=MTGJXO_2Kks

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

I don't have my setup handy to give you a copy but I'll lay it out for you and you can probably find the right tutorial from there.

 

In your resources folder you need a sounds.json file which describes your sounds. Then you create a folder in your resources called "sounds" and put your .ogg files in there.

 

This video is pretty good on it if I'm remembering the right one.

 

https://www.youtube.com/watch?v=MTGJXO_2Kks

Well, I have followed everything in this tutorial, but I cannot figure out how to implement it in the Entity code.

If I make it

    protected String getLivingSound() {
            return return SoundHandler.onEntityPlay("mob.penguin.say", event.player.worldObj, event.player, 1, 1);
    }

it just gives me an error ???

Posted

 

Well, I have followed everything in this tutorial, but I cannot figure out how to implement it in the Entity code.

If I make it

    protected String getLivingSound() {
            return return SoundHandler.onEntityPlay("mob.penguin.say", event.player.worldObj, event.player, 1, 1);
    }

it just gives me an error ???

 

return return

 

Dude, seriously?! :-P

 

 

Posted

 

Well, I have followed everything in this tutorial, but I cannot figure out how to implement it in the Entity code.

If I make it

    protected String getLivingSound() {
            return return SoundHandler.onEntityPlay("mob.penguin.say", event.player.worldObj, event.player, 1, 1);
    }

it just gives me an error ???

 

return return

 

Dude, seriously?! :-P

Yea I noticed that and fixed it, but it still gives me an error :S

Posted

I think most of your troubles are just basic Java. 

 

You want the entity to make the sound right? You might want to check out my entity custom sounds tutorial: http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-organizing-sound.html

 

From within an entity class, you should be able to play a sound simply with:

playSound("mob.bigCat.growl", getSoundVolume(), getSoundPitch())

 

And the if you extended wolf you'll want to replace the various sounds for whining and panting and such.  I think my tutorial can give you the idea.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

I think most of your troubles are just basic Java. 

 

You want the entity to make the sound right? You might want to check out my entity custom sounds tutorial: http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-organizing-sound.html

 

From within an entity class, you should be able to play a sound simply with:

playSound("mob.bigCat.growl", getSoundVolume(), getSoundPitch())

 

And the if you extended wolf you'll want to replace the various sounds for whining and panting and such.  I think my tutorial can give you the idea.

Oh gosh, you have no idea how much you helped me. :D

I did go for a little work-around, which I'm not sure is necessary, but here's how I did it (for anyone else having issues).

For the living sounds I replaced getLivingSound() with this:

    public void playLivingSound()
    {
    	this.playSound(Strings.MODID + ":" + "mob.penguin.say", this.getSoundVolume(), this.getSoundPitch());
    }

And as I made the hurt/death sounds be the same as the living sounds, here's how I implemented them:

    public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
    {
    	if (this.getHealth() <= 0.0F)
        {
        	this.playSound(Strings.MODID + ":" + "mob.penguin.say", this.getSoundVolume(), this.getSoundPitch());
        }
        else
        {
        	this.playSound(Strings.MODID + ":" + "mob.penguin.say", this.getSoundVolume(), this.getSoundPitch());
        }
    }

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.