Posted December 9, 201410 yr 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.
December 9, 201410 yr 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!
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.