Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.16.4] Entity Spin, Help Please

Recommended Posts

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;

        public void registerControllers(AnimationData data)
            data.addAnimationController(new AnimationController(this, "controller", 0, this::predicate));

        public AnimationFactory getFactory()
            return this.factory;

    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 by furiusmax55
Link to post
Share on other sites

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 by lupicus
Link to post
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.

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.

  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.