Posted June 1, 20169 yr Hi! I have problem with entity's AI: if isAIEnabled() returning true my mob is "lagging" - if I higher he begins shake head in different sides, if I set block before him, he jumps only after few seconds, when I changing my direction, he changes it after few seconds and moves in old direction some time. It's not critical but annoying, and happens only if I enable AI. Thanks.
June 1, 20169 yr How about some code? If this custom AI? You might be messing with sides or if by lagging you mean logic lagging (server) - your AI might be too heavy (but that would lag whole server). 1.7.10 is no longer supported by forge, you are on your own.
June 1, 20169 yr Author I don't sure that code is needed because this happens even if I use this code: public class EntityGargoyle extends EntityMob { public EntityGargoyle(World p_i1694_1_) { super(p_i1694_1_); this.setSize(0.8F, 2F); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false)); this.tasks.addTask(4, new EntityAIAttackOnCollide(this, EntityVillager.class, 1.0D, true)); this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(6, new EntityAIMoveThroughVillage(this, 1.0D, false)); this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, 0, false)); } public boolean isAIEnabled() { return true; } } I copied tasks from zombie class. Mob still lagging. He can't find path to target and when he falls in hole with 1 block height he just rotating on one point.
June 2, 20169 yr In early versions of MC, the "AI" was not abstracted as tasks. Then some mobs converted to the task paradigm (and returned true for AI enabled). By 1.8, all mobs had made the switch, so I think the method was discarded as unnecessary. Search at Google to find discussions on the subject, but essentially, you should always set it true and use the task paradigm. Does your gargoyle inherit a navigator from somewhere? Maybe that's a 1.8 abstraction, so I might not be able to help. I don't know enough about 1.7.10 AI. Steel yourself for the inevitable suggestion that you should upgrade to 1.9.x. In what context did you experience lag? If it was in the Eclipse debugger, then all bets are off. My last stray thought is to find yourself a "profiler" for Java that will tell you what's consuming your CPU cycles. A good profiler will expose problematic call stacks to investigate. The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
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.