Posted February 5, 20214 yr I have an aggressive mob that when it chases the player spin and then continues to follow the player. entity class public class EntityHound extends MonsterEntity implements IAnimatable { private AnimationFactory factory = new AnimationFactory(this); public EntityHound(EntityType<? extends MonsterEntity> type, World worldIn) { super(type, worldIn); this.ignoreFrustumCheck = true; } private <E extends IAnimatable> PlayState predicate(AnimationEvent<E> event) { event.getController().setAnimation(new AnimationBuilder().addAnimation("idle", true)); return PlayState.CONTINUE; } @Override public void registerControllers(AnimationData data) { data.addAnimationController(new AnimationController(this, "controller", 0, this::predicate)); } @Override public AnimationFactory getFactory() { return this.factory; } @Override protected void registerGoals() { this.goalSelector.addGoal(1, new SwimGoal(this)); this.goalSelector.addGoal(2, new MeleeAttackGoal(this, 0.8D, true)); this.goalSelector.addGoal(3, new LookAtGoal(this, PlayerEntity.class, 15.0F)); this.goalSelector.addGoal(4, new WaterAvoidingRandomWalkingGoal(this, 0.8D)); this.targetSelector.addGoal(1, new HurtByTargetGoal(this)); this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, PlayerEntity.class, true)); this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolemEntity.class, true)); } public static AttributeModifierMap.MutableAttribute func_234200_m_() { return MobEntity.func_233666_p_().createMutableAttribute(Attributes.MAX_HEALTH, 20.0D).createMutableAttribute(Attributes.MOVEMENT_SPEED, (double)0.23F).createMutableAttribute(Attributes.ATTACK_DAMAGE, 1.0D).createMutableAttribute(Attributes.FOLLOW_RANGE, 25.0D); } } Edited February 5, 20214 yr by furiusmax55
February 12, 20214 yr Spinning can happen when the entity is told repeatedly to go to a location which it is basically at already, i.e. the tolerance (proximity) check (usually based on the entity width) fails to detect it is basically there and prevents it from proceeding along the path. So, I don't know anything about your code, but you might check your entity declared width. Edited February 12, 20214 yr by lupicus
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.