Posted June 21, 20169 yr I use tryMoveToXYZ for give it move but it move just 7-10 block. i need it move around the world.
June 21, 20169 yr You need to give your mob some AI. Using vanilla classes, you can add things like: // your mob will wander aimlessly tasks.addTask(5, new EntityAIWander(this, 1.0D)); // your mob will move towards and attack players targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); There are lots of other examples in vanilla code - check out the various mobs such as Zombies, Skeletons, etc. Spiders are a good example of a custom movement / navigation type, and you can override #getBlockPathWeight in any mob using movement AI to modify what it considers a good path. http://i.imgur.com/NdrFdld.png[/img]
June 21, 20169 yr Author I create new class name AIMoveHuman by this class is EntityAIWander. public class AIMoveHuman extends EntityAIBase { private EntitySoliderMelee entity; private int xPosition; private double yPosition; private int zPosition; private double speed; private static int n = 0; public AIMoveHuman(EntitySoliderMelee p_i1648_1_, double p_i1648_2_) { this.entity = p_i1648_1_; this.speed = p_i1648_2_; this.setMutexBits(1); } /** * Returns whether the EntityAIBase should begin execution. */ public boolean shouldExecute() { this.xPosition = this.entity.PositionX.get(n); this.yPosition = this.entity.posY; this.zPosition = this.entity.PositionZ.get(n); int a = this.n + 1; if(a != this.entity.PositionX.size()){ this.n++; } return true; } /** * Returns whether an in-progress EntityAIBase should continue executing */ public boolean continueExecuting() { return !this.entity.getNavigator().noPath(); } /** * Execute a one shot task or start executing a continuous task */ public void startExecuting() { this.entity.getNavigator().tryMoveToXYZ(this.xPosition, this.yPosition, this.zPosition, this.speed); } } it will move follow list in entity. I will try add EntityAINearestAttackableTarget, if i have a problem, i will comback this post.
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.