Jump to content

[1.7.10] Vanilla Mobs follow when holding custom item


Major_Mints

Recommended Posts

I am wondering how i can make vanilla Minecraft mobs follow me when i hold my item. can i make this happen in my custom item's class? If so, how can i accomplish this? I am new to modding so if you could show me some sort of example code that would be wonderful, also, i would like to thank you for your help in advance.

Link to comment
Share on other sites

There's a task called EntityAITempt, which handles animals following you when you hold wheat/seeds/whatever. So I believe you would actually have to add the tasks to the entities you want to respond to your item. The item is one of the arguments for the constructor of the task, actually, so you shouldn't have any problem.

 

To add the task to the vanilla animals though, you'd need to make an event handler to get the animal when it joins the world and check if it's the right species, and then add it to each animal as it is created.

 

I used this tutorial by coolAlias to make such a handler and did so without a hitch. Hope that helps!

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.

Announcements



×
×
  • Create New...

Important Information

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