Search in sources :

Example 1 with SwimGoal

use of net.minecraft.entity.ai.goal.SwimGoal in project minecolonies by Minecolonies.

the class EntityCitizen method initTasks.

/**
 * Initiates citizen goalSelector Suppressing Sonar Rule Squid:S881 The rule thinks we should extract ++priority in a proper statement. But in this case the rule does not apply
 * because that would remove the readability.
 */
@SuppressWarnings(INCREMENT_AND_DECREMENT_OPERATORS_SHOULD_NOT_BE_USED_IN_A_METHOD_CALL_OR_MIXED_WITH_OTHER_OPERATORS_IN_AN_EXPRESSION)
private void initTasks() {
    int priority = 0;
    this.goalSelector.addGoal(priority, new SwimGoal(this));
    this.goalSelector.addGoal(++priority, new EntityAICitizenAvoidEntity(this, MonsterEntity.class, (float) DISTANCE_OF_ENTITY_AVOID, LATER_RUN_SPEED_AVOID, INITIAL_RUN_SPEED_AVOID));
    this.goalSelector.addGoal(++priority, new EntityAIEatTask(this));
    this.goalSelector.addGoal(++priority, new EntityAISickTask(this));
    this.goalSelector.addGoal(++priority, new EntityAISleep(this));
    this.goalSelector.addGoal(priority, new EntityAIInteractToggleAble(this, FENCE_TOGGLE, TRAP_TOGGLE, DOOR_TOGGLE));
    this.goalSelector.addGoal(++priority, new LookAtWithoutMovingGoal(this, PlayerEntity.class, WATCH_CLOSEST2, 1.0F));
    this.goalSelector.addGoal(++priority, new LookAtWithoutMovingGoal(this, EntityCitizen.class, WATCH_CLOSEST2_FAR, WATCH_CLOSEST2_FAR_CHANCE));
    this.goalSelector.addGoal(++priority, new EntityAICitizenWander(this, DEFAULT_SPEED, 1.0D));
    this.goalSelector.addGoal(++priority, new LookAtGoal(this, LivingEntity.class, WATCH_CLOSEST));
    this.goalSelector.addGoal(++priority, new EntityAIMournCitizen(this, DEFAULT_SPEED));
}
Also used : LookAtGoal(net.minecraft.entity.ai.goal.LookAtGoal) EntityAIInteractToggleAble(com.minecolonies.coremod.entity.ai.minimal.EntityAIInteractToggleAble) MonsterEntity(net.minecraft.entity.monster.MonsterEntity) LookAtWithoutMovingGoal(net.minecraft.entity.ai.goal.LookAtWithoutMovingGoal) SwimGoal(net.minecraft.entity.ai.goal.SwimGoal) PlayerEntity(net.minecraft.entity.player.PlayerEntity) ServerPlayerEntity(net.minecraft.entity.player.ServerPlayerEntity) AbstractEntityCitizen(com.minecolonies.api.entity.citizen.AbstractEntityCitizen)

Example 2 with SwimGoal

use of net.minecraft.entity.ai.goal.SwimGoal in project Mekanism by mekanism.

the class EntityRobit method registerGoals.

@Override
protected void registerGoals() {
    super.registerGoals();
    goalSelector.addGoal(1, new RobitAIPickup(this, 1));
    goalSelector.addGoal(2, new RobitAIFollow(this, 1, 4, 2));
    goalSelector.addGoal(3, new LookAtGoal(this, PlayerEntity.class, 8));
    goalSelector.addGoal(3, new LookRandomlyGoal(this));
    goalSelector.addGoal(4, new SwimGoal(this));
}
Also used : LookAtGoal(net.minecraft.entity.ai.goal.LookAtGoal) LookRandomlyGoal(net.minecraft.entity.ai.goal.LookRandomlyGoal) RobitAIFollow(mekanism.common.entity.ai.RobitAIFollow) RobitAIPickup(mekanism.common.entity.ai.RobitAIPickup) SwimGoal(net.minecraft.entity.ai.goal.SwimGoal) PlayerEntity(net.minecraft.entity.player.PlayerEntity) ServerPlayerEntity(net.minecraft.entity.player.ServerPlayerEntity)

Example 3 with SwimGoal

use of net.minecraft.entity.ai.goal.SwimGoal in project beebuddy by queenofthebees.

the class BeeEntityMixin method beebuddy$initTamedGoals.

@Unique
private void beebuddy$initTamedGoals() {
    BeeEntity us = (BeeEntity) (Object) this;
    this.goalSelector.add(0, new BeeSitGoal(us));
    this.goalSelector.add(1, StingGoalInvoker.beebuddy$make(us, us, 1.399999976158142D, true));
    this.goalSelector.add(2, new FollowParentGoal(us, 1.25D));
    this.goalSelector.add(3, new FollowFriendGoal(us));
    this.goalSelector.add(4, new AnimalMateGoal(us, 1.0D));
    if (pollinateGoal == null) {
        // we can be called before initGoals's body
        pollinateGoal = PollinateGoalInvoker.beebuddy$make(us);
    }
    this.goalSelector.add(5, pollinateGoal);
    if (moveToFlowerGoal == null) {
        moveToFlowerGoal = MoveToFlowerGoalInvoker.beebuddy$make(us);
    }
    this.goalSelector.add(6, moveToFlowerGoal);
    this.goalSelector.add(7, new SitOnHeadGoal(us));
    this.goalSelector.add(7, BeeWanderAroundGoalInvoker.beebuddy$make(us));
    this.goalSelector.add(8, new LookAtEntityGoal(us, PlayerEntity.class, 4.0F));
    this.goalSelector.add(8, new SwimGoal(us));
    BeeEntityMixin mix = this;
    this.targetSelector.add(1, (new RevengeGoal(this) {

        @Override
        public boolean canStart() {
            if (!super.canStart()) {
                return false;
            }
            if (us.getAttacker() != null) {
                UUID u = us.getAttacker().getUuid();
                return !u.equals(mix.beebuddy$getFriend());
            } else {
                return true;
            }
        }

        @Override
        public boolean shouldContinue() {
            return us.hasAngerTime() && super.shouldContinue();
        }
    }).setGroupRevenge(new Class[0]));
}
Also used : RevengeGoal(net.minecraft.entity.ai.goal.RevengeGoal) FollowParentGoal(net.minecraft.entity.ai.goal.FollowParentGoal) FollowFriendGoal(nomble.beebuddy.entity.ai.goal.FollowFriendGoal) LookAtEntityGoal(net.minecraft.entity.ai.goal.LookAtEntityGoal) SitOnHeadGoal(nomble.beebuddy.entity.ai.goal.SitOnHeadGoal) SwimGoal(net.minecraft.entity.ai.goal.SwimGoal) PlayerEntity(net.minecraft.entity.player.PlayerEntity) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity) AnimalMateGoal(net.minecraft.entity.ai.goal.AnimalMateGoal) BeeSitGoal(nomble.beebuddy.entity.ai.goal.BeeSitGoal) BeeEntity(net.minecraft.entity.passive.BeeEntity) UUID(java.util.UUID) Unique(org.spongepowered.asm.mixin.Unique)

Example 4 with SwimGoal

use of net.minecraft.entity.ai.goal.SwimGoal in project bioplethora by AquexTheSeal.

the class PrimordialRingEntity method registerGoals.

@Override
protected void registerGoals() {
    super.registerGoals();
    this.goalSelector.addGoal(1, new PrimordialRingFollowOwnerGoal(this, 1.5D, 30.0F, 5.0F, true));
    this.goalSelector.addGoal(2, new PrimordialRingRangedAttackGoal(this));
    this.goalSelector.addGoal(5, new LookRandomlyGoal(this));
    this.goalSelector.addGoal(7, new SwimGoal(this));
    this.targetSelector.addGoal(1, new PrimordialRingOwnerHurtByTargetGoal(this));
    this.targetSelector.addGoal(2, new PrimordialRingOwnerHurtTargetGoal(this));
}
Also used : PrimordialRingFollowOwnerGoal(io.github.bioplethora.entity.ai.PrimordialRingFollowOwnerGoal) LookRandomlyGoal(net.minecraft.entity.ai.goal.LookRandomlyGoal) PrimordialRingRangedAttackGoal(io.github.bioplethora.entity.ai.PrimordialRingRangedAttackGoal) PrimordialRingOwnerHurtTargetGoal(io.github.bioplethora.entity.ai.PrimordialRingOwnerHurtTargetGoal) PrimordialRingOwnerHurtByTargetGoal(io.github.bioplethora.entity.ai.PrimordialRingOwnerHurtByTargetGoal) SwimGoal(net.minecraft.entity.ai.goal.SwimGoal)

Example 5 with SwimGoal

use of net.minecraft.entity.ai.goal.SwimGoal in project wildmod by Osmiooo.

the class FireflyEntity method initGoals.

protected void initGoals() {
    this.goalSelector.add(2, new FireflyWanderGoal(this));
    this.goalSelector.add(1, new SwimGoal(this));
}
Also used : FireflyWanderGoal(frozenblock.wild.mod.liukrastapi.FireflyWanderGoal) SwimGoal(net.minecraft.entity.ai.goal.SwimGoal)

Aggregations

SwimGoal (net.minecraft.entity.ai.goal.SwimGoal)23 PlayerEntity (net.minecraft.entity.player.PlayerEntity)12 LookAtGoal (net.minecraft.entity.ai.goal.LookAtGoal)7 LookRandomlyGoal (net.minecraft.entity.ai.goal.LookRandomlyGoal)6 ServerPlayerEntity (net.minecraft.entity.player.ServerPlayerEntity)5 AbstractEntityCitizen (com.minecolonies.api.entity.citizen.AbstractEntityCitizen)4 EntityAIInteractToggleAble (com.minecolonies.coremod.entity.ai.minimal.EntityAIInteractToggleAble)4 LookAtEntityGoal (net.minecraft.entity.ai.goal.LookAtEntityGoal)4 LookAtWithoutMovingGoal (net.minecraft.entity.ai.goal.LookAtWithoutMovingGoal)4 RandomWalkingGoal (net.minecraft.entity.ai.goal.RandomWalkingGoal)3 RevengeGoal (net.minecraft.entity.ai.goal.RevengeGoal)3 WaterAvoidingRandomWalkingGoal (net.minecraft.entity.ai.goal.WaterAvoidingRandomWalkingGoal)3 EntityAIFollowAttackTarget (team.cqr.cqrepoured.entity.ai.EntityAIFollowAttackTarget)3 EntityAIFollowPath (team.cqr.cqrepoured.entity.ai.EntityAIFollowPath)3 EntityAIMoveToHome (team.cqr.cqrepoured.entity.ai.EntityAIMoveToHome)3 EntityAIMoveToLeader (team.cqr.cqrepoured.entity.ai.EntityAIMoveToLeader)3 EntityAIAttack (team.cqr.cqrepoured.entity.ai.attack.EntityAIAttack)3 EntityAICQRNearestAttackTarget (team.cqr.cqrepoured.entity.ai.target.EntityAICQRNearestAttackTarget)3 EntityAIHurtByTarget (team.cqr.cqrepoured.entity.ai.target.EntityAIHurtByTarget)3 EntityAIVisitor (com.minecolonies.coremod.entity.ai.minimal.EntityAIVisitor)2