Search in sources :

Example 26 with Goal

use of net.minecraft.world.entity.ai.goal.Goal in project MagicPlugin by elBukkit.

the class MagicGoal method getSubDescription.

protected String getSubDescription() {
    List<String> goalDescriptions = new ArrayList<>();
    for (Goal goal : goals) {
        String goalDescription = goal.toString();
        if (goal == currentGoal) {
            goalDescription = ChatColor.AQUA + goalDescription;
        } else {
            goalDescription = ChatColor.DARK_AQUA + goalDescription;
        }
        goalDescriptions.add(goalDescription);
    }
    return ChatColor.DARK_GRAY + " [" + StringUtils.join(goalDescriptions, " ") + ChatColor.DARK_GRAY + "]";
}
Also used : Goal(net.minecraft.world.entity.ai.goal.Goal) ArrayList(java.util.ArrayList)

Example 27 with Goal

use of net.minecraft.world.entity.ai.goal.Goal in project MagicPlugin by elBukkit.

the class MagicGoal method canContinueToUse.

@Override
public boolean canContinueToUse() {
    boolean interrupt = false;
    boolean continuing = false;
    for (Goal goal : goals) {
        if (goal == currentGoal) {
            boolean canContinue = goal.canContinueToUse();
            if (canContinue) {
                continuing = true;
            } else {
                interrupt = true;
            }
        } else {
            // A higher-priority goal can interrupt
            boolean canUse = goal.canUse();
            if (canUse && !continuing && (currentGoal == null || currentGoal.isInterruptable())) {
                interrupt = true;
            }
        }
        if (interrupt) {
            return false;
        }
    }
    return true;
}
Also used : Goal(net.minecraft.world.entity.ai.goal.Goal)

Example 28 with Goal

use of net.minecraft.world.entity.ai.goal.Goal in project MagicPlugin by elBukkit.

the class MobUtils method getGoalDescriptions.

protected Collection<String> getGoalDescriptions(GoalSelector selector) {
    List<String> descriptions = new ArrayList<>();
    Collection<WrappedGoal> available = selector.getAvailableGoals();
    for (WrappedGoal wrappedGoal : available) {
        Goal goal = wrappedGoal.getGoal();
        String description = goal.toString();
        String parentDescription = getGoalParentDescriptions(goal);
        if (parentDescription != null) {
            description += " " + parentDescription;
        }
        if (wrappedGoal.isRunning()) {
            description = ChatColor.AQUA + description;
        } else {
            description = ChatColor.GOLD + description;
        }
        descriptions.add(ChatColor.BLUE + Integer.toString(wrappedGoal.getPriority()) + ChatColor.DARK_GRAY + ": " + description);
    }
    return descriptions;
}
Also used : StrollThroughVillageGoal(net.minecraft.world.entity.ai.goal.StrollThroughVillageGoal) OcelotAttackGoal(net.minecraft.world.entity.ai.goal.OcelotAttackGoal) MagicOwnerHurtByTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicOwnerHurtByTargetGoal) IdleGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.IdleGoal) AvoidEntityGoal(net.minecraft.world.entity.ai.goal.AvoidEntityGoal) TriggerGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.TriggerGoal) MagicPanicGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicPanicGoal) BreedGoal(net.minecraft.world.entity.ai.goal.BreedGoal) FollowMobGoal(net.minecraft.world.entity.ai.goal.FollowMobGoal) LandOnOwnersShoulderGoal(net.minecraft.world.entity.ai.goal.LandOnOwnersShoulderGoal) BreathAirGoal(net.minecraft.world.entity.ai.goal.BreathAirGoal) FloatGoal(net.minecraft.world.entity.ai.goal.FloatGoal) PanicGoal(net.minecraft.world.entity.ai.goal.PanicGoal) OwnerHurtTargetGoal(net.minecraft.world.entity.ai.goal.target.OwnerHurtTargetGoal) WrappedGoal(net.minecraft.world.entity.ai.goal.WrappedGoal) MagicCheckOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicCheckOwnerGoal) FollowOwnerGoal(net.minecraft.world.entity.ai.goal.FollowOwnerGoal) RandomSwimmingGoal(net.minecraft.world.entity.ai.goal.RandomSwimmingGoal) GolemRandomStrollInVillageGoal(net.minecraft.world.entity.ai.goal.GolemRandomStrollInVillageGoal) WaterAvoidingRandomFlyingGoal(net.minecraft.world.entity.ai.goal.WaterAvoidingRandomFlyingGoal) RequirementsGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.RequirementsGoal) OpenDoorGoal(net.minecraft.world.entity.ai.goal.OpenDoorGoal) RandomLookAroundGoal(net.minecraft.world.entity.ai.goal.RandomLookAroundGoal) RandomStrollGoal(net.minecraft.world.entity.ai.goal.RandomStrollGoal) TryFindWaterGoal(net.minecraft.world.entity.ai.goal.TryFindWaterGoal) MagicOwnerHurtTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicOwnerHurtTargetGoal) MoveTowardsRestrictionGoal(net.minecraft.world.entity.ai.goal.MoveTowardsRestrictionGoal) MagicFindOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicFindOwnerGoal) MoveTowardsTargetGoal(net.minecraft.world.entity.ai.goal.MoveTowardsTargetGoal) DefendVillageTargetGoal(net.minecraft.world.entity.ai.goal.target.DefendVillageTargetGoal) EatBlockGoal(net.minecraft.world.entity.ai.goal.EatBlockGoal) FollowParentGoal(net.minecraft.world.entity.ai.goal.FollowParentGoal) OfferFlowerGoal(net.minecraft.world.entity.ai.goal.OfferFlowerGoal) OwnerHurtByTargetGoal(net.minecraft.world.entity.ai.goal.target.OwnerHurtByTargetGoal) TemptGoal(net.minecraft.world.entity.ai.goal.TemptGoal) MeleeAttackGoal(net.minecraft.world.entity.ai.goal.MeleeAttackGoal) FollowBoatGoal(net.minecraft.world.entity.ai.goal.FollowBoatGoal) RestrictSunGoal(net.minecraft.world.entity.ai.goal.RestrictSunGoal) NearestAttackableTargetGoal(net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal) TargetGoal(net.minecraft.world.entity.ai.goal.target.TargetGoal) LookAtPlayerGoal(net.minecraft.world.entity.ai.goal.LookAtPlayerGoal) MoveThroughVillageGoal(net.minecraft.world.entity.ai.goal.MoveThroughVillageGoal) LeapAtTargetGoal(net.minecraft.world.entity.ai.goal.LeapAtTargetGoal) HurtByTargetGoal(net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal) BreakDoorGoal(net.minecraft.world.entity.ai.goal.BreakDoorGoal) SwellGoal(net.minecraft.world.entity.ai.goal.SwellGoal) Goal(net.minecraft.world.entity.ai.goal.Goal) RunAroundLikeCrazyGoal(net.minecraft.world.entity.ai.goal.RunAroundLikeCrazyGoal) ZombieAttackGoal(net.minecraft.world.entity.ai.goal.ZombieAttackGoal) MagicFollowMobGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicFollowMobGoal) FleeSunGoal(net.minecraft.world.entity.ai.goal.FleeSunGoal) MagicGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicGoal) MagicFollowOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicFollowOwnerGoal) FollowFlockLeaderGoal(net.minecraft.world.entity.ai.goal.FollowFlockLeaderGoal) MoveBackToVillageGoal(net.minecraft.world.entity.ai.goal.MoveBackToVillageGoal) WaterAvoidingRandomStrollGoal(net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal) BegGoal(net.minecraft.world.entity.ai.goal.BegGoal) InteractGoal(net.minecraft.world.entity.ai.goal.InteractGoal) ArrayList(java.util.ArrayList) WrappedGoal(net.minecraft.world.entity.ai.goal.WrappedGoal)

Aggregations

Goal (net.minecraft.world.entity.ai.goal.Goal)28 AvoidEntityGoal (net.minecraft.world.entity.ai.goal.AvoidEntityGoal)20 BegGoal (net.minecraft.world.entity.ai.goal.BegGoal)20 BreakDoorGoal (net.minecraft.world.entity.ai.goal.BreakDoorGoal)20 BreathAirGoal (net.minecraft.world.entity.ai.goal.BreathAirGoal)20 BreedGoal (net.minecraft.world.entity.ai.goal.BreedGoal)20 EatBlockGoal (net.minecraft.world.entity.ai.goal.EatBlockGoal)20 FleeSunGoal (net.minecraft.world.entity.ai.goal.FleeSunGoal)20 FloatGoal (net.minecraft.world.entity.ai.goal.FloatGoal)20 FollowBoatGoal (net.minecraft.world.entity.ai.goal.FollowBoatGoal)20 FollowFlockLeaderGoal (net.minecraft.world.entity.ai.goal.FollowFlockLeaderGoal)20 FollowMobGoal (net.minecraft.world.entity.ai.goal.FollowMobGoal)20 FollowOwnerGoal (net.minecraft.world.entity.ai.goal.FollowOwnerGoal)20 FollowParentGoal (net.minecraft.world.entity.ai.goal.FollowParentGoal)20 GolemRandomStrollInVillageGoal (net.minecraft.world.entity.ai.goal.GolemRandomStrollInVillageGoal)20 InteractGoal (net.minecraft.world.entity.ai.goal.InteractGoal)20 LandOnOwnersShoulderGoal (net.minecraft.world.entity.ai.goal.LandOnOwnersShoulderGoal)20 LeapAtTargetGoal (net.minecraft.world.entity.ai.goal.LeapAtTargetGoal)20 LookAtPlayerGoal (net.minecraft.world.entity.ai.goal.LookAtPlayerGoal)20 MeleeAttackGoal (net.minecraft.world.entity.ai.goal.MeleeAttackGoal)20