Jump to content

Recommended Posts

Posted

I want to add a task to the pig that will make the pig follow the player, regardless of what is held. Maybe i could make it my pet? Although i'm not sure how to do that. Any help is appreciated. Thanks!

Posted

Check out the wolf code.

if (user.hasKnowledgeOfJava) {

    if (user.question.hasCode) {

        return interpetHelpfulResponse(user.getQuestion());

    } else {

        return "Could you post your code please?";

    }

} else {

    return "Learn some freaking Java!";

}

Posted

All the code you need is in any of the passive mobs that can be tamed (all of which extend EntityTameable). As suggested, if you look in EntityWolf and EntityTameable, you can find the code you need.

 

You will not be able to easily make the vanilla pig tameable, but you can make a class that extends EntityPig and replace the vanilla pig with your custom pig when you 'tame' the pig.

Posted

Ok thanks for clearing that up. :) Is there a way, though, for it to just follow me by either setting it's path? I tried but I got a null error. Same if I try to just set it's position to about mine. It doesn't have to be a pet or anything. I also tried setting its path to entity? Sorry not at my computer now but it took an entity creature and I'm not sure if you can cast entity player into that.

Posted

I've wanted to do something similar to this and I thought maybe I could make the mob target the player without hurting him? Also if anyone could figure out the piece of code that has a baby animal follow it's parent that might work too?

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.