Search in sources :

Example 1 with MagicFindOwnerGoal

use of com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicFindOwnerGoal in project MagicPlugin by elBukkit.

the class MobUtils method getGoal.

private Goal getGoal(GoalType goalType, Entity entity, Mob mob, ConfigurationSection config) {
    final String classType = config.getString("entity_class", "player");
    final double speed = config.getDouble("speed", 1);
    final double sprintSpeed = config.getDouble("sprint_speed", 1);
    final float distance = (float) config.getDouble("distance", 16);
    final boolean doors = config.getBoolean("doors", true);
    final boolean interruptable = config.getBoolean("interruptable", true);
    final boolean see = config.getBoolean("see", true);
    final boolean reach = config.getBoolean("reach", false);
    final float startDistance = (float) config.getDouble("start_distance", 5);
    final float stopDistance = (float) config.getDouble("stop_distance", 1);
    final float radius = (float) config.getDouble("radius", 16);
    final PathfinderMob pathfinder = mob instanceof PathfinderMob ? (PathfinderMob) mob : null;
    int interval = config.getInt("interval", 1000);
    // Interval is specified in ms, but needed in ticks
    interval = interval / 50;
    MageController controller = platform.getController();
    Mage mage;
    List<Goal> goals;
    switch(goalType) {
        case AVOID_ENTITY:
            if (pathfinder == null)
                return null;
            return new AvoidEntityGoal<>(pathfinder, getMobClass(classType), distance, sprintSpeed, sprintSpeed);
        case BEG:
            if (mob instanceof Wolf) {
                return new BegGoal((Wolf) mob, distance);
            }
            return null;
        case BREAK_DOOR:
            return new BreakDoorGoal(mob, difficulty -> true);
        case BREATHE_AIR:
            if (pathfinder == null)
                return null;
            return new BreathAirGoal(pathfinder);
        case BREED:
            if (mob instanceof Animal) {
                return new BreedGoal((Animal) mob, speed);
            }
            return null;
        case EAT_BLOCK:
            return new EatBlockGoal(mob);
        case FLEE_SUN:
            if (pathfinder == null)
                return null;
            return new FleeSunGoal(pathfinder, speed);
        case FLOAT:
            return new FloatGoal(mob);
        case FOLLOW_BOAT:
            if (pathfinder == null)
                return null;
            return new FollowBoatGoal(pathfinder);
        case FOLLOW_FLOCK_LEADER:
            if (mob instanceof AbstractSchoolingFish) {
                return new FollowFlockLeaderGoal((AbstractSchoolingFish) mob);
            }
            return null;
        case FOLLOW_MOB:
            return new FollowMobGoal(mob, speed, distance, radius);
        case FOLLOW_OWNER:
            if (mob instanceof TamableAnimal) {
                return new FollowOwnerGoal((TamableAnimal) mob, speed, startDistance, stopDistance, config.getBoolean("fly", false));
            }
        // Intentional fall-through
        case MAGIC_FOLLOW_OWNER:
            return new MagicFollowOwnerGoal(platform, mob, speed, startDistance, stopDistance, interval, config);
        case FOLLOW_PARENT:
            if (mob instanceof Animal) {
                return new FollowParentGoal((Animal) mob, speed);
            }
            return null;
        case GOLEM_RANDOM_STROLL_IN_VILLAGE:
            if (pathfinder == null)
                return null;
            return new GolemRandomStrollInVillageGoal(pathfinder, speed);
        case INTERACT:
            return new InteractGoal(mob, getMobClass(classType), distance, (float) config.getDouble("probability", 1));
        case LAND_ON_OWNERS_SHOULDER:
            if (mob instanceof ShoulderRidingEntity) {
                return new LandOnOwnersShoulderGoal((ShoulderRidingEntity) mob);
            }
            return null;
        case LEAP_AT_TARGET:
            return new LeapAtTargetGoal(mob, (float) config.getDouble("y_offset", 0.4));
        case LOOK_AT_PLAYER:
            return new LookAtPlayerGoal(mob, getMobClass(classType), distance, (float) config.getDouble("probability", 1), config.getBoolean("horizontal"));
        case MELEE_ATTACK:
            if (pathfinder == null)
                return null;
            return new MeleeAttackGoal(pathfinder, speed, config.getBoolean("follow", true));
        case MOVE_BACK_TO_VILLAGE:
            if (pathfinder == null)
                return null;
            return new MoveBackToVillageGoal(pathfinder, speed, config.getBoolean("check", true));
        case MOVE_THROUGH_VILLAGE:
            if (pathfinder == null)
                return null;
            return new MoveThroughVillageGoal(pathfinder, speed, config.getBoolean("night", true), (int) distance, (BooleanSupplier) () -> doors);
        case MOVE_TOWARDS_RESTRICTION:
            if (pathfinder == null)
                return null;
            return new MoveTowardsRestrictionGoal(pathfinder, speed);
        case MOVE_TOWARDS_TARGET:
            if (pathfinder == null)
                return null;
            return new MoveTowardsTargetGoal(pathfinder, speed, distance);
        case OCELOT_ATTACK:
            return new OcelotAttackGoal(mob);
        case OFFER_FLOWER:
            if (mob instanceof IronGolem) {
                return new OfferFlowerGoal((IronGolem) mob);
            }
            return null;
        case OPEN_DOOR:
            return new OpenDoorGoal(mob, config.getBoolean("close", false));
        case PANIC_FIRE:
            if (pathfinder == null)
                return null;
            return new PanicGoal(pathfinder, speed);
        case PANIC:
        case MAGIC_PANIC:
            if (pathfinder == null)
                return null;
            return new MagicPanicGoal(pathfinder, speed, config.getInt("panic", 3000), config.getInt("calm", 5000), interruptable);
        case RANDOM_LOOK_AROUND:
            return new RandomLookAroundGoal(mob);
        case RANDOM_STROLL:
            if (pathfinder == null)
                return null;
            return new RandomStrollGoal(pathfinder, speed, interval);
        case RANDOM_SWIMMING:
            if (pathfinder == null)
                return null;
            return new RandomSwimmingGoal(pathfinder, speed, interval);
        case RESTRICT_SUN:
            if (pathfinder == null)
                return null;
            return new RestrictSunGoal(pathfinder);
        case RUN_AROUND_LIKE_CRAZY:
            if (mob instanceof Horse) {
                return new RunAroundLikeCrazyGoal((Horse) mob, speed);
            }
            return null;
        case STROLL_THROUGH_VILLAGE:
            if (pathfinder == null)
                return null;
            return new StrollThroughVillageGoal(pathfinder, interval);
        case SWELL:
            if (mob instanceof Creeper) {
                return new SwellGoal((Creeper) mob);
            }
            return null;
        case TEMPT:
            if (pathfinder == null)
                return null;
            String itemKey = config.getString("item", "EMERALD");
            try {
                Material material = Material.valueOf(itemKey.toUpperCase());
                org.bukkit.inventory.ItemStack itemStack = new org.bukkit.inventory.ItemStack(material);
                ItemUtils itemUtils = platform.getItemUtils();
                itemStack = itemUtils.makeReal(itemStack);
                ItemStack nms = (ItemStack) itemUtils.getHandle(itemStack);
                if (nms == null) {
                    platform.getLogger().warning("Invalid item from material in temp goal: " + itemKey);
                    return null;
                }
                boolean scare = config.getBoolean("scare", false);
                return new TemptGoal(pathfinder, speed, Ingredient.of(nms), scare);
            } catch (Exception ex) {
                platform.getLogger().warning("Invalid material in temp goal: " + itemKey);
                return null;
            }
        case TRY_FIND_WATER:
            if (pathfinder == null)
                return null;
            return new TryFindWaterGoal(pathfinder);
        case WATER_AVOIDING_RANDOM_FLYING:
            if (pathfinder == null)
                return null;
            return new WaterAvoidingRandomFlyingGoal(pathfinder, speed);
        case WATER_AVOIDING_RANDOM_STROLL:
            if (pathfinder == null)
                return null;
            return new WaterAvoidingRandomStrollGoal(pathfinder, speed);
        case ZOMBIE_ATTACK:
            if (mob instanceof Zombie) {
                return new ZombieAttackGoal((Zombie) mob, speed, config.getBoolean("follow", true));
            }
            return null;
        // Target
        case DEFEND_VILLAGE_TARGET:
            if (mob instanceof IronGolem) {
                return new DefendVillageTargetGoal((IronGolem) mob);
            }
            return null;
        case HURT_BY_TARGET:
            if (pathfinder == null)
                return null;
            return new HurtByTargetGoal(pathfinder);
        case NEAREST_ATTACKABLE_TARGET:
            return new NearestAttackableTargetGoal<>(mob, getMobClass(classType), see, reach);
        case OWNER_HURT_BY_TARGET:
            if (mob instanceof TamableAnimal) {
                return new OwnerHurtByTargetGoal((TamableAnimal) mob);
            }
        // Intentional fall-through
        case MAGIC_OWNER_HURT_BY_TARGET:
            return new MagicOwnerHurtByTargetGoal(platform, mob, entity, see, reach);
        case OWNER_HURT_TARGET:
            if (mob instanceof TamableAnimal) {
                return new OwnerHurtTargetGoal((TamableAnimal) mob);
            }
        // Intentional fall-through
        case MAGIC_OWNER_HURT_TARGET:
            return new MagicOwnerHurtTargetGoal(platform, mob, entity, see, reach);
        // Magic add-ons
        case FOLLOW_ENTITY:
        case MAGIC_FOLLOW_MOB:
            Class<? extends LivingEntity> mobClass = getMobClass(classType);
            if (mobClass == null) {
                platform.getLogger().warning("Unsupported entity_class in magic_follow_mob goal: " + classType);
                return null;
            }
            return new MagicFollowMobGoal(mob, speed, radius, distance, interval, mobClass);
        case REQUIREMENT:
        case REQUIREMENTS:
            if (pathfinder == null)
                return null;
            mage = controller.getMage(entity);
            Collection<Requirement> requirements = controller.getRequirements(config);
            goals = getGoals(entity, mob, config, "magic requirement goal");
            return new RequirementsGoal(mage, goals, interruptable, requirements);
        case GROUP:
            goals = getGoals(entity, mob, config, "magic group goal");
            return new MagicGoal(goals, interruptable);
        case TRIGGER:
            mage = controller.getMage(entity);
            goals = getGoals(entity, mob, config, "magic trigger goal");
            return new TriggerGoal(mage, goals, interruptable, config.getString("trigger", "goal"), interval);
        case FIND_OWNER:
            return new MagicFindOwnerGoal(platform, mob, radius, getMobClass(classType));
        case CHECK_OWNER:
            return new MagicCheckOwnerGoal(platform, mob);
        case IDLE:
            return new IdleGoal();
        case SPIN:
            return new SpinGoal(mob, (float) config.getDouble("degrees", 10));
        default:
            platform.getLogger().warning("Unsupported goal type: " + goalType);
            return null;
    }
}
Also used : TryFindWaterGoal(net.minecraft.world.entity.ai.goal.TryFindWaterGoal) TriggerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.TriggerGoal) IdleGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.IdleGoal) NearestAttackableTargetGoal(net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal) MagicGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.MagicGoal) SpinGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.SpinGoal) MageController(com.elmakers.mine.bukkit.api.magic.MageController) AvoidEntityGoal(net.minecraft.world.entity.ai.goal.AvoidEntityGoal) FollowBoatGoal(net.minecraft.world.entity.ai.goal.FollowBoatGoal) MagicPanicGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.MagicPanicGoal) StrollThroughVillageGoal(net.minecraft.world.entity.ai.goal.StrollThroughVillageGoal) OcelotAttackGoal(net.minecraft.world.entity.ai.goal.OcelotAttackGoal) AvoidEntityGoal(net.minecraft.world.entity.ai.goal.AvoidEntityGoal) 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) MagicOwnerHurtByTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.MagicOwnerHurtByTargetGoal) OwnerHurtTargetGoal(net.minecraft.world.entity.ai.goal.target.OwnerHurtTargetGoal) WrappedGoal(net.minecraft.world.entity.ai.goal.WrappedGoal) 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) OpenDoorGoal(net.minecraft.world.entity.ai.goal.OpenDoorGoal) RandomLookAroundGoal(net.minecraft.world.entity.ai.goal.RandomLookAroundGoal) MagicOwnerHurtTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.MagicOwnerHurtTargetGoal) RandomStrollGoal(net.minecraft.world.entity.ai.goal.RandomStrollGoal) TryFindWaterGoal(net.minecraft.world.entity.ai.goal.TryFindWaterGoal) MagicFindOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.MagicFindOwnerGoal) MoveTowardsRestrictionGoal(net.minecraft.world.entity.ai.goal.MoveTowardsRestrictionGoal) IdleGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.IdleGoal) 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) MagicCheckOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.MagicCheckOwnerGoal) MagicFollowOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.MagicFollowOwnerGoal) RequirementsGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.RequirementsGoal) 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) MagicGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.MagicGoal) 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) FleeSunGoal(net.minecraft.world.entity.ai.goal.FleeSunGoal) TriggerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.TriggerGoal) MagicFollowMobGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.MagicFollowMobGoal) FollowFlockLeaderGoal(net.minecraft.world.entity.ai.goal.FollowFlockLeaderGoal) MoveBackToVillageGoal(net.minecraft.world.entity.ai.goal.MoveBackToVillageGoal) SpinGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.SpinGoal) WaterAvoidingRandomStrollGoal(net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal) BegGoal(net.minecraft.world.entity.ai.goal.BegGoal) InteractGoal(net.minecraft.world.entity.ai.goal.InteractGoal) BegGoal(net.minecraft.world.entity.ai.goal.BegGoal) MeleeAttackGoal(net.minecraft.world.entity.ai.goal.MeleeAttackGoal) RestrictSunGoal(net.minecraft.world.entity.ai.goal.RestrictSunGoal) Horse(net.minecraft.world.entity.animal.horse.Horse) ZombieHorse(net.minecraft.world.entity.animal.horse.ZombieHorse) AbstractChestedHorse(net.minecraft.world.entity.animal.horse.AbstractChestedHorse) AbstractHorse(net.minecraft.world.entity.animal.horse.AbstractHorse) ZombieAttackGoal(net.minecraft.world.entity.ai.goal.ZombieAttackGoal) InteractGoal(net.minecraft.world.entity.ai.goal.InteractGoal) BreathAirGoal(net.minecraft.world.entity.ai.goal.BreathAirGoal) MoveBackToVillageGoal(net.minecraft.world.entity.ai.goal.MoveBackToVillageGoal) Zombie(net.minecraft.world.entity.monster.Zombie) MagicOwnerHurtByTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.MagicOwnerHurtByTargetGoal) MagicOwnerHurtByTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.MagicOwnerHurtByTargetGoal) OwnerHurtByTargetGoal(net.minecraft.world.entity.ai.goal.target.OwnerHurtByTargetGoal) MagicOwnerHurtTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.MagicOwnerHurtTargetGoal) MagicCheckOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.MagicCheckOwnerGoal) Requirement(com.elmakers.mine.bukkit.api.requirements.Requirement) Mage(com.elmakers.mine.bukkit.api.magic.Mage) Animal(net.minecraft.world.entity.animal.Animal) TamableAnimal(net.minecraft.world.entity.TamableAnimal) MagicFollowMobGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.MagicFollowMobGoal) LandOnOwnersShoulderGoal(net.minecraft.world.entity.ai.goal.LandOnOwnersShoulderGoal) BreedGoal(net.minecraft.world.entity.ai.goal.BreedGoal) LeapAtTargetGoal(net.minecraft.world.entity.ai.goal.LeapAtTargetGoal) MoveThroughVillageGoal(net.minecraft.world.entity.ai.goal.MoveThroughVillageGoal) ItemStack(net.minecraft.world.item.ItemStack) FollowOwnerGoal(net.minecraft.world.entity.ai.goal.FollowOwnerGoal) MagicFollowOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.MagicFollowOwnerGoal) MoveTowardsTargetGoal(net.minecraft.world.entity.ai.goal.MoveTowardsTargetGoal) DefendVillageTargetGoal(net.minecraft.world.entity.ai.goal.target.DefendVillageTargetGoal) MagicFollowOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.MagicFollowOwnerGoal) RunAroundLikeCrazyGoal(net.minecraft.world.entity.ai.goal.RunAroundLikeCrazyGoal) WaterAvoidingRandomStrollGoal(net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal) MoveTowardsRestrictionGoal(net.minecraft.world.entity.ai.goal.MoveTowardsRestrictionGoal) StrollThroughVillageGoal(net.minecraft.world.entity.ai.goal.StrollThroughVillageGoal) SwellGoal(net.minecraft.world.entity.ai.goal.SwellGoal) TamableAnimal(net.minecraft.world.entity.TamableAnimal) Creeper(net.minecraft.world.entity.monster.Creeper) TemptGoal(net.minecraft.world.entity.ai.goal.TemptGoal) FollowFlockLeaderGoal(net.minecraft.world.entity.ai.goal.FollowFlockLeaderGoal) OwnerHurtTargetGoal(net.minecraft.world.entity.ai.goal.target.OwnerHurtTargetGoal) MagicOwnerHurtTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.MagicOwnerHurtTargetGoal) IronGolem(net.minecraft.world.entity.animal.IronGolem) FleeSunGoal(net.minecraft.world.entity.ai.goal.FleeSunGoal) ShoulderRidingEntity(net.minecraft.world.entity.animal.ShoulderRidingEntity) EatBlockGoal(net.minecraft.world.entity.ai.goal.EatBlockGoal) LookAtPlayerGoal(net.minecraft.world.entity.ai.goal.LookAtPlayerGoal) Wolf(net.minecraft.world.entity.animal.Wolf) OpenDoorGoal(net.minecraft.world.entity.ai.goal.OpenDoorGoal) RandomStrollGoal(net.minecraft.world.entity.ai.goal.RandomStrollGoal) WaterAvoidingRandomStrollGoal(net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal) BreakDoorGoal(net.minecraft.world.entity.ai.goal.BreakDoorGoal) FollowParentGoal(net.minecraft.world.entity.ai.goal.FollowParentGoal) MagicOwnerHurtByTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.MagicOwnerHurtByTargetGoal) OwnerHurtByTargetGoal(net.minecraft.world.entity.ai.goal.target.OwnerHurtByTargetGoal) HurtByTargetGoal(net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal) GolemRandomStrollInVillageGoal(net.minecraft.world.entity.ai.goal.GolemRandomStrollInVillageGoal) Material(org.bukkit.Material) WaterAvoidingRandomFlyingGoal(net.minecraft.world.entity.ai.goal.WaterAvoidingRandomFlyingGoal) MagicPanicGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.MagicPanicGoal) PanicGoal(net.minecraft.world.entity.ai.goal.PanicGoal) MagicPanicGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.MagicPanicGoal) RandomLookAroundGoal(net.minecraft.world.entity.ai.goal.RandomLookAroundGoal) MagicFindOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.MagicFindOwnerGoal) RequirementsGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.RequirementsGoal) OcelotAttackGoal(net.minecraft.world.entity.ai.goal.OcelotAttackGoal) AbstractSchoolingFish(net.minecraft.world.entity.animal.AbstractSchoolingFish) FollowMobGoal(net.minecraft.world.entity.ai.goal.FollowMobGoal) MagicFollowMobGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_1.goal.MagicFollowMobGoal) RandomSwimmingGoal(net.minecraft.world.entity.ai.goal.RandomSwimmingGoal) PathfinderMob(net.minecraft.world.entity.PathfinderMob) ItemUtils(com.elmakers.mine.bukkit.utility.platform.ItemUtils) FloatGoal(net.minecraft.world.entity.ai.goal.FloatGoal) OfferFlowerGoal(net.minecraft.world.entity.ai.goal.OfferFlowerGoal)

Example 2 with MagicFindOwnerGoal

use of com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicFindOwnerGoal in project MagicPlugin by elBukkit.

the class MobUtils method getGoal.

private Goal getGoal(GoalType goalType, Entity entity, Mob mob, ConfigurationSection config) {
    final String classType = config.getString("entity_class", "player");
    final double speed = config.getDouble("speed", 1);
    final double sprintSpeed = config.getDouble("sprint_speed", 1);
    final float distance = (float) config.getDouble("distance", 16);
    final boolean doors = config.getBoolean("doors", true);
    final boolean interruptable = config.getBoolean("interruptable", true);
    final boolean see = config.getBoolean("see", true);
    final boolean reach = config.getBoolean("reach", false);
    final float startDistance = (float) config.getDouble("start_distance", 5);
    final float stopDistance = (float) config.getDouble("stop_distance", 1);
    final float radius = (float) config.getDouble("radius", 16);
    final PathfinderMob pathfinder = mob instanceof PathfinderMob ? (PathfinderMob) mob : null;
    int interval = config.getInt("interval", 1000);
    // Interval is specified in ms, but needed in ticks
    interval = interval / 50;
    MageController controller = platform.getController();
    Mage mage;
    List<Goal> goals;
    switch(goalType) {
        case AVOID_ENTITY:
            if (pathfinder == null)
                return null;
            return new AvoidEntityGoal<>(pathfinder, getMobClass(classType), distance, sprintSpeed, sprintSpeed);
        case BEG:
            if (mob instanceof Wolf) {
                return new BegGoal((Wolf) mob, distance);
            }
            return null;
        case BREAK_DOOR:
            return new BreakDoorGoal(mob, difficulty -> true);
        case BREATHE_AIR:
            if (pathfinder == null)
                return null;
            return new BreathAirGoal(pathfinder);
        case BREED:
            if (mob instanceof Animal) {
                return new BreedGoal((Animal) mob, speed);
            }
            return null;
        case EAT_BLOCK:
            return new EatBlockGoal(mob);
        case FLEE_SUN:
            if (pathfinder == null)
                return null;
            return new FleeSunGoal(pathfinder, speed);
        case FLOAT:
            return new FloatGoal(mob);
        case FOLLOW_BOAT:
            if (pathfinder == null)
                return null;
            return new FollowBoatGoal(pathfinder);
        case FOLLOW_FLOCK_LEADER:
            if (mob instanceof AbstractSchoolingFish) {
                return new FollowFlockLeaderGoal((AbstractSchoolingFish) mob);
            }
            return null;
        case FOLLOW_MOB:
            return new FollowMobGoal(mob, speed, distance, radius);
        case FOLLOW_OWNER:
            if (mob instanceof TamableAnimal) {
                return new FollowOwnerGoal((TamableAnimal) mob, speed, startDistance, stopDistance, config.getBoolean("fly", false));
            }
        // Intentional fall-through
        case MAGIC_FOLLOW_OWNER:
            return new MagicFollowOwnerGoal(platform, mob, speed, startDistance, stopDistance, interval, config);
        case FOLLOW_PARENT:
            if (mob instanceof Animal) {
                return new FollowParentGoal((Animal) mob, speed);
            }
            return null;
        case GOLEM_RANDOM_STROLL_IN_VILLAGE:
            if (pathfinder == null)
                return null;
            return new GolemRandomStrollInVillageGoal(pathfinder, speed);
        case INTERACT:
            return new InteractGoal(mob, getMobClass(classType), distance, (float) config.getDouble("probability", 1));
        case LAND_ON_OWNERS_SHOULDER:
            if (mob instanceof ShoulderRidingEntity) {
                return new LandOnOwnersShoulderGoal((ShoulderRidingEntity) mob);
            }
            return null;
        case LEAP_AT_TARGET:
            return new LeapAtTargetGoal(mob, (float) config.getDouble("y_offset", 0.4));
        case LOOK_AT_PLAYER:
            return new LookAtPlayerGoal(mob, getMobClass(classType), distance, (float) config.getDouble("probability", 1), config.getBoolean("horizontal"));
        case MELEE_ATTACK:
            if (pathfinder == null)
                return null;
            return new MeleeAttackGoal(pathfinder, speed, config.getBoolean("follow", true));
        case MOVE_BACK_TO_VILLAGE:
            if (pathfinder == null)
                return null;
            return new MoveBackToVillageGoal(pathfinder, speed, config.getBoolean("check", true));
        case MOVE_THROUGH_VILLAGE:
            if (pathfinder == null)
                return null;
            return new MoveThroughVillageGoal(pathfinder, speed, config.getBoolean("night", true), (int) distance, (BooleanSupplier) () -> doors);
        case MOVE_TOWARDS_RESTRICTION:
            if (pathfinder == null)
                return null;
            return new MoveTowardsRestrictionGoal(pathfinder, speed);
        case MOVE_TOWARDS_TARGET:
            if (pathfinder == null)
                return null;
            return new MoveTowardsTargetGoal(pathfinder, speed, distance);
        case OCELOT_ATTACK:
            return new OcelotAttackGoal(mob);
        case OFFER_FLOWER:
            if (mob instanceof IronGolem) {
                return new OfferFlowerGoal((IronGolem) mob);
            }
            return null;
        case OPEN_DOOR:
            return new OpenDoorGoal(mob, config.getBoolean("close", false));
        case PANIC_FIRE:
            if (pathfinder == null)
                return null;
            return new PanicGoal(pathfinder, speed);
        case PANIC:
        case MAGIC_PANIC:
            if (pathfinder == null)
                return null;
            return new MagicPanicGoal(pathfinder, speed, config.getInt("panic", 3000), config.getInt("calm", 5000), interruptable);
        case RANDOM_LOOK_AROUND:
            return new RandomLookAroundGoal(mob);
        case RANDOM_STROLL:
            if (pathfinder == null)
                return null;
            return new RandomStrollGoal(pathfinder, speed, interval);
        case RANDOM_SWIMMING:
            if (pathfinder == null)
                return null;
            return new RandomSwimmingGoal(pathfinder, speed, interval);
        case RESTRICT_SUN:
            if (pathfinder == null)
                return null;
            return new RestrictSunGoal(pathfinder);
        case RUN_AROUND_LIKE_CRAZY:
            if (mob instanceof Horse) {
                return new RunAroundLikeCrazyGoal((Horse) mob, speed);
            }
            return null;
        case STROLL_THROUGH_VILLAGE:
            if (pathfinder == null)
                return null;
            return new StrollThroughVillageGoal(pathfinder, interval);
        case SWELL:
            if (mob instanceof Creeper) {
                return new SwellGoal((Creeper) mob);
            }
            return null;
        case TEMPT:
            if (pathfinder == null)
                return null;
            String itemKey = config.getString("item", "EMERALD");
            try {
                Material material = Material.valueOf(itemKey.toUpperCase());
                org.bukkit.inventory.ItemStack itemStack = new org.bukkit.inventory.ItemStack(material);
                ItemUtils itemUtils = platform.getItemUtils();
                itemStack = itemUtils.makeReal(itemStack);
                ItemStack nms = (ItemStack) itemUtils.getHandle(itemStack);
                if (nms == null) {
                    platform.getLogger().warning("Invalid item from material in temp goal: " + itemKey);
                    return null;
                }
                boolean scare = config.getBoolean("scare", false);
                return new TemptGoal(pathfinder, speed, Ingredient.of(nms), scare);
            } catch (Exception ex) {
                platform.getLogger().warning("Invalid material in temp goal: " + itemKey);
                return null;
            }
        case TRY_FIND_WATER:
            if (pathfinder == null)
                return null;
            return new TryFindWaterGoal(pathfinder);
        case WATER_AVOIDING_RANDOM_FLYING:
            if (pathfinder == null)
                return null;
            return new WaterAvoidingRandomFlyingGoal(pathfinder, speed);
        case WATER_AVOIDING_RANDOM_STROLL:
            if (pathfinder == null)
                return null;
            return new WaterAvoidingRandomStrollGoal(pathfinder, speed);
        case ZOMBIE_ATTACK:
            if (mob instanceof Zombie) {
                return new ZombieAttackGoal((Zombie) mob, speed, config.getBoolean("follow", true));
            }
            return null;
        // Target
        case DEFEND_VILLAGE_TARGET:
            if (mob instanceof IronGolem) {
                return new DefendVillageTargetGoal((IronGolem) mob);
            }
            return null;
        case HURT_BY_TARGET:
            if (pathfinder == null)
                return null;
            return new HurtByTargetGoal(pathfinder);
        case NEAREST_ATTACKABLE_TARGET:
            return new NearestAttackableTargetGoal<>(mob, getMobClass(classType), see, reach);
        case OWNER_HURT_BY_TARGET:
            if (mob instanceof TamableAnimal) {
                return new OwnerHurtByTargetGoal((TamableAnimal) mob);
            }
        // Intentional fall-through
        case MAGIC_OWNER_HURT_BY_TARGET:
            return new MagicOwnerHurtByTargetGoal(platform, mob, entity, see, reach);
        case OWNER_HURT_TARGET:
            if (mob instanceof TamableAnimal) {
                return new OwnerHurtTargetGoal((TamableAnimal) mob);
            }
        // Intentional fall-through
        case MAGIC_OWNER_HURT_TARGET:
            return new MagicOwnerHurtTargetGoal(platform, mob, entity, see, reach);
        // Magic add-ons
        case FOLLOW_ENTITY:
        case MAGIC_FOLLOW_MOB:
            Class<? extends LivingEntity> mobClass = getMobClass(classType);
            if (mobClass == null) {
                platform.getLogger().warning("Unsupported entity_class in magic_follow_mob goal: " + classType);
                return null;
            }
            return new MagicFollowMobGoal(mob, speed, radius, distance, interval, mobClass);
        case REQUIREMENT:
        case REQUIREMENTS:
            if (pathfinder == null)
                return null;
            mage = controller.getMage(entity);
            Collection<Requirement> requirements = controller.getRequirements(config);
            goals = getGoals(entity, mob, config, "magic requirement goal");
            return new RequirementsGoal(mage, goals, interruptable, requirements);
        case GROUP:
            goals = getGoals(entity, mob, config, "magic group goal");
            return new MagicGoal(goals, interruptable);
        case TRIGGER:
            mage = controller.getMage(entity);
            goals = getGoals(entity, mob, config, "magic trigger goal");
            return new TriggerGoal(mage, goals, interruptable, config.getString("trigger", "goal"), interval);
        case FIND_OWNER:
            return new MagicFindOwnerGoal(platform, mob, radius, getMobClass(classType));
        case CHECK_OWNER:
            return new MagicCheckOwnerGoal(platform, mob);
        case IDLE:
            return new IdleGoal();
        default:
            platform.getLogger().warning("Unsupported goal type: " + goalType);
            return null;
    }
}
Also used : TryFindWaterGoal(net.minecraft.world.entity.ai.goal.TryFindWaterGoal) TriggerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.TriggerGoal) IdleGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.IdleGoal) NearestAttackableTargetGoal(net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal) MagicGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.MagicGoal) MageController(com.elmakers.mine.bukkit.api.magic.MageController) AvoidEntityGoal(net.minecraft.world.entity.ai.goal.AvoidEntityGoal) FollowBoatGoal(net.minecraft.world.entity.ai.goal.FollowBoatGoal) IdleGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.IdleGoal) StrollThroughVillageGoal(net.minecraft.world.entity.ai.goal.StrollThroughVillageGoal) OcelotAttackGoal(net.minecraft.world.entity.ai.goal.OcelotAttackGoal) AvoidEntityGoal(net.minecraft.world.entity.ai.goal.AvoidEntityGoal) MagicFindOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.MagicFindOwnerGoal) MagicGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.MagicGoal) MagicOwnerHurtTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.MagicOwnerHurtTargetGoal) MagicFollowOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.MagicFollowOwnerGoal) 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) MagicFollowMobGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.MagicFollowMobGoal) 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) FollowOwnerGoal(net.minecraft.world.entity.ai.goal.FollowOwnerGoal) RandomSwimmingGoal(net.minecraft.world.entity.ai.goal.RandomSwimmingGoal) MagicPanicGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.MagicPanicGoal) GolemRandomStrollInVillageGoal(net.minecraft.world.entity.ai.goal.GolemRandomStrollInVillageGoal) WaterAvoidingRandomFlyingGoal(net.minecraft.world.entity.ai.goal.WaterAvoidingRandomFlyingGoal) OpenDoorGoal(net.minecraft.world.entity.ai.goal.OpenDoorGoal) RandomLookAroundGoal(net.minecraft.world.entity.ai.goal.RandomLookAroundGoal) MagicOwnerHurtByTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.MagicOwnerHurtByTargetGoal) RandomStrollGoal(net.minecraft.world.entity.ai.goal.RandomStrollGoal) TryFindWaterGoal(net.minecraft.world.entity.ai.goal.TryFindWaterGoal) MoveTowardsRestrictionGoal(net.minecraft.world.entity.ai.goal.MoveTowardsRestrictionGoal) 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) RequirementsGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.RequirementsGoal) 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) MagicCheckOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.MagicCheckOwnerGoal) ZombieAttackGoal(net.minecraft.world.entity.ai.goal.ZombieAttackGoal) TriggerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.TriggerGoal) FleeSunGoal(net.minecraft.world.entity.ai.goal.FleeSunGoal) 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) BegGoal(net.minecraft.world.entity.ai.goal.BegGoal) MeleeAttackGoal(net.minecraft.world.entity.ai.goal.MeleeAttackGoal) RestrictSunGoal(net.minecraft.world.entity.ai.goal.RestrictSunGoal) Horse(net.minecraft.world.entity.animal.horse.Horse) ZombieHorse(net.minecraft.world.entity.animal.horse.ZombieHorse) AbstractChestedHorse(net.minecraft.world.entity.animal.horse.AbstractChestedHorse) AbstractHorse(net.minecraft.world.entity.animal.horse.AbstractHorse) ZombieAttackGoal(net.minecraft.world.entity.ai.goal.ZombieAttackGoal) InteractGoal(net.minecraft.world.entity.ai.goal.InteractGoal) BreathAirGoal(net.minecraft.world.entity.ai.goal.BreathAirGoal) MoveBackToVillageGoal(net.minecraft.world.entity.ai.goal.MoveBackToVillageGoal) Zombie(net.minecraft.world.entity.monster.Zombie) MagicOwnerHurtByTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.MagicOwnerHurtByTargetGoal) MagicOwnerHurtByTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.MagicOwnerHurtByTargetGoal) OwnerHurtByTargetGoal(net.minecraft.world.entity.ai.goal.target.OwnerHurtByTargetGoal) MagicOwnerHurtTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.MagicOwnerHurtTargetGoal) MagicCheckOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.MagicCheckOwnerGoal) Requirement(com.elmakers.mine.bukkit.api.requirements.Requirement) Mage(com.elmakers.mine.bukkit.api.magic.Mage) Animal(net.minecraft.world.entity.animal.Animal) TamableAnimal(net.minecraft.world.entity.TamableAnimal) MagicFollowMobGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.MagicFollowMobGoal) LandOnOwnersShoulderGoal(net.minecraft.world.entity.ai.goal.LandOnOwnersShoulderGoal) BreedGoal(net.minecraft.world.entity.ai.goal.BreedGoal) LeapAtTargetGoal(net.minecraft.world.entity.ai.goal.LeapAtTargetGoal) MoveThroughVillageGoal(net.minecraft.world.entity.ai.goal.MoveThroughVillageGoal) ItemStack(net.minecraft.world.item.ItemStack) MagicFollowOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.MagicFollowOwnerGoal) FollowOwnerGoal(net.minecraft.world.entity.ai.goal.FollowOwnerGoal) MoveTowardsTargetGoal(net.minecraft.world.entity.ai.goal.MoveTowardsTargetGoal) DefendVillageTargetGoal(net.minecraft.world.entity.ai.goal.target.DefendVillageTargetGoal) MagicFollowOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.MagicFollowOwnerGoal) RunAroundLikeCrazyGoal(net.minecraft.world.entity.ai.goal.RunAroundLikeCrazyGoal) WaterAvoidingRandomStrollGoal(net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal) MoveTowardsRestrictionGoal(net.minecraft.world.entity.ai.goal.MoveTowardsRestrictionGoal) StrollThroughVillageGoal(net.minecraft.world.entity.ai.goal.StrollThroughVillageGoal) SwellGoal(net.minecraft.world.entity.ai.goal.SwellGoal) TamableAnimal(net.minecraft.world.entity.TamableAnimal) Creeper(net.minecraft.world.entity.monster.Creeper) TemptGoal(net.minecraft.world.entity.ai.goal.TemptGoal) FollowFlockLeaderGoal(net.minecraft.world.entity.ai.goal.FollowFlockLeaderGoal) MagicOwnerHurtTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.MagicOwnerHurtTargetGoal) OwnerHurtTargetGoal(net.minecraft.world.entity.ai.goal.target.OwnerHurtTargetGoal) IronGolem(net.minecraft.world.entity.animal.IronGolem) FleeSunGoal(net.minecraft.world.entity.ai.goal.FleeSunGoal) ShoulderRidingEntity(net.minecraft.world.entity.animal.ShoulderRidingEntity) EatBlockGoal(net.minecraft.world.entity.ai.goal.EatBlockGoal) LookAtPlayerGoal(net.minecraft.world.entity.ai.goal.LookAtPlayerGoal) Wolf(net.minecraft.world.entity.animal.Wolf) OpenDoorGoal(net.minecraft.world.entity.ai.goal.OpenDoorGoal) RandomStrollGoal(net.minecraft.world.entity.ai.goal.RandomStrollGoal) WaterAvoidingRandomStrollGoal(net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal) BreakDoorGoal(net.minecraft.world.entity.ai.goal.BreakDoorGoal) FollowParentGoal(net.minecraft.world.entity.ai.goal.FollowParentGoal) MagicOwnerHurtByTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.MagicOwnerHurtByTargetGoal) OwnerHurtByTargetGoal(net.minecraft.world.entity.ai.goal.target.OwnerHurtByTargetGoal) HurtByTargetGoal(net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal) GolemRandomStrollInVillageGoal(net.minecraft.world.entity.ai.goal.GolemRandomStrollInVillageGoal) Material(org.bukkit.Material) WaterAvoidingRandomFlyingGoal(net.minecraft.world.entity.ai.goal.WaterAvoidingRandomFlyingGoal) PanicGoal(net.minecraft.world.entity.ai.goal.PanicGoal) MagicPanicGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.MagicPanicGoal) MagicPanicGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.MagicPanicGoal) RandomLookAroundGoal(net.minecraft.world.entity.ai.goal.RandomLookAroundGoal) MagicFindOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.MagicFindOwnerGoal) RequirementsGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.RequirementsGoal) OcelotAttackGoal(net.minecraft.world.entity.ai.goal.OcelotAttackGoal) AbstractSchoolingFish(net.minecraft.world.entity.animal.AbstractSchoolingFish) FollowMobGoal(net.minecraft.world.entity.ai.goal.FollowMobGoal) MagicFollowMobGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_0.goal.MagicFollowMobGoal) RandomSwimmingGoal(net.minecraft.world.entity.ai.goal.RandomSwimmingGoal) PathfinderMob(net.minecraft.world.entity.PathfinderMob) ItemUtils(com.elmakers.mine.bukkit.utility.platform.ItemUtils) FloatGoal(net.minecraft.world.entity.ai.goal.FloatGoal) OfferFlowerGoal(net.minecraft.world.entity.ai.goal.OfferFlowerGoal)

Example 3 with MagicFindOwnerGoal

use of com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicFindOwnerGoal in project MagicPlugin by elBukkit.

the class MobUtils method getGoal.

private Goal getGoal(GoalType goalType, Entity entity, Mob mob, ConfigurationSection config) {
    final String classType = config.getString("entity_class", "player");
    final double speed = config.getDouble("speed", 1);
    final double sprintSpeed = config.getDouble("sprint_speed", 1);
    final float distance = (float) config.getDouble("distance", 16);
    final boolean doors = config.getBoolean("doors", true);
    final boolean interruptable = config.getBoolean("interruptable", true);
    final boolean see = config.getBoolean("see", true);
    final boolean reach = config.getBoolean("reach", false);
    final float startDistance = (float) config.getDouble("start_distance", 5);
    final float stopDistance = (float) config.getDouble("stop_distance", 1);
    final float radius = (float) config.getDouble("radius", 16);
    final PathfinderMob pathfinder = mob instanceof PathfinderMob ? (PathfinderMob) mob : null;
    int interval = config.getInt("interval", 1000);
    // Interval is specified in ms, but needed in ticks
    interval = interval / 50;
    MageController controller = platform.getController();
    Mage mage;
    List<Goal> goals;
    switch(goalType) {
        case AVOID_ENTITY:
            if (pathfinder == null)
                return null;
            return new AvoidEntityGoal<>(pathfinder, getMobClass(classType), distance, sprintSpeed, sprintSpeed);
        case BEG:
            if (mob instanceof Wolf) {
                return new BegGoal((Wolf) mob, distance);
            }
            return null;
        case BREAK_DOOR:
            return new BreakDoorGoal(mob, difficulty -> true);
        case BREATHE_AIR:
            if (pathfinder == null)
                return null;
            return new BreathAirGoal(pathfinder);
        case BREED:
            if (mob instanceof Animal) {
                return new BreedGoal((Animal) mob, speed);
            }
            return null;
        case EAT_BLOCK:
            return new EatBlockGoal(mob);
        case FLEE_SUN:
            if (pathfinder == null)
                return null;
            return new FleeSunGoal(pathfinder, speed);
        case FLOAT:
            return new FloatGoal(mob);
        case FOLLOW_BOAT:
            if (pathfinder == null)
                return null;
            return new FollowBoatGoal(pathfinder);
        case FOLLOW_FLOCK_LEADER:
            if (mob instanceof AbstractSchoolingFish) {
                return new FollowFlockLeaderGoal((AbstractSchoolingFish) mob);
            }
            return null;
        case FOLLOW_MOB:
            return new FollowMobGoal(mob, speed, distance, radius);
        case FOLLOW_OWNER:
            if (mob instanceof TamableAnimal) {
                return new FollowOwnerGoal((TamableAnimal) mob, speed, startDistance, stopDistance, config.getBoolean("fly", false));
            }
        // Intentional fall-through
        case MAGIC_FOLLOW_OWNER:
            return new MagicFollowOwnerGoal(platform, mob, speed, startDistance, stopDistance, interval, config);
        case FOLLOW_PARENT:
            if (mob instanceof Animal) {
                return new FollowParentGoal((Animal) mob, speed);
            }
            return null;
        case GOLEM_RANDOM_STROLL_IN_VILLAGE:
            if (pathfinder == null)
                return null;
            return new GolemRandomStrollInVillageGoal(pathfinder, speed);
        case INTERACT:
            return new InteractGoal(mob, getMobClass(classType), distance, (float) config.getDouble("probability", 1));
        case LAND_ON_OWNERS_SHOULDER:
            if (mob instanceof ShoulderRidingEntity) {
                return new LandOnOwnersShoulderGoal((ShoulderRidingEntity) mob);
            }
            return null;
        case LEAP_AT_TARGET:
            return new LeapAtTargetGoal(mob, (float) config.getDouble("y_offset", 0.4));
        case LOOK_AT_PLAYER:
            return new LookAtPlayerGoal(mob, getMobClass(classType), distance, (float) config.getDouble("probability", 1), config.getBoolean("horizontal"));
        case MELEE_ATTACK:
            if (pathfinder == null)
                return null;
            return new MeleeAttackGoal(pathfinder, speed, config.getBoolean("follow", true));
        case MOVE_BACK_TO_VILLAGE:
            if (pathfinder == null)
                return null;
            return new MoveBackToVillageGoal(pathfinder, speed, config.getBoolean("check", true));
        case MOVE_THROUGH_VILLAGE:
            if (pathfinder == null)
                return null;
            return new MoveThroughVillageGoal(pathfinder, speed, config.getBoolean("night", true), (int) distance, (BooleanSupplier) () -> doors);
        case MOVE_TOWARDS_RESTRICTION:
            if (pathfinder == null)
                return null;
            return new MoveTowardsRestrictionGoal(pathfinder, speed);
        case MOVE_TOWARDS_TARGET:
            if (pathfinder == null)
                return null;
            return new MoveTowardsTargetGoal(pathfinder, speed, distance);
        case OCELOT_ATTACK:
            return new OcelotAttackGoal(mob);
        case OFFER_FLOWER:
            if (mob instanceof IronGolem) {
                return new OfferFlowerGoal((IronGolem) mob);
            }
            return null;
        case OPEN_DOOR:
            return new OpenDoorGoal(mob, config.getBoolean("close", false));
        case PANIC_FIRE:
            if (pathfinder == null)
                return null;
            return new PanicGoal(pathfinder, speed);
        case PANIC:
        case MAGIC_PANIC:
            if (pathfinder == null)
                return null;
            return new MagicPanicGoal(pathfinder, speed, config.getInt("panic", 3000), config.getInt("calm", 5000), interruptable);
        case RANDOM_LOOK_AROUND:
            return new RandomLookAroundGoal(mob);
        case RANDOM_STROLL:
            if (pathfinder == null)
                return null;
            return new RandomStrollGoal(pathfinder, speed, interval);
        case RANDOM_SWIMMING:
            if (pathfinder == null)
                return null;
            return new RandomSwimmingGoal(pathfinder, speed, interval);
        case RESTRICT_SUN:
            if (pathfinder == null)
                return null;
            return new RestrictSunGoal(pathfinder);
        case RUN_AROUND_LIKE_CRAZY:
            if (mob instanceof Horse) {
                return new RunAroundLikeCrazyGoal((Horse) mob, speed);
            }
            return null;
        case STROLL_THROUGH_VILLAGE:
            if (pathfinder == null)
                return null;
            return new StrollThroughVillageGoal(pathfinder, interval);
        case SWELL:
            if (mob instanceof Creeper) {
                return new SwellGoal((Creeper) mob);
            }
            return null;
        case TEMPT:
            if (pathfinder == null)
                return null;
            String itemKey = config.getString("item", "EMERALD");
            try {
                Material material = Material.valueOf(itemKey.toUpperCase());
                org.bukkit.inventory.ItemStack itemStack = new org.bukkit.inventory.ItemStack(material);
                ItemUtils itemUtils = platform.getItemUtils();
                itemStack = itemUtils.makeReal(itemStack);
                ItemStack nms = (ItemStack) itemUtils.getHandle(itemStack);
                if (nms == null) {
                    platform.getLogger().warning("Invalid item from material in temp goal: " + itemKey);
                    return null;
                }
                boolean scare = config.getBoolean("scare", false);
                return new TemptGoal(pathfinder, speed, Ingredient.of(nms), scare);
            } catch (Exception ex) {
                platform.getLogger().warning("Invalid material in temp goal: " + itemKey);
                return null;
            }
        case TRY_FIND_WATER:
            if (pathfinder == null)
                return null;
            return new TryFindWaterGoal(pathfinder);
        case WATER_AVOIDING_RANDOM_FLYING:
            if (pathfinder == null)
                return null;
            return new WaterAvoidingRandomFlyingGoal(pathfinder, speed);
        case WATER_AVOIDING_RANDOM_STROLL:
            if (pathfinder == null)
                return null;
            return new WaterAvoidingRandomStrollGoal(pathfinder, speed);
        case ZOMBIE_ATTACK:
            if (mob instanceof Zombie) {
                return new ZombieAttackGoal((Zombie) mob, speed, config.getBoolean("follow", true));
            }
            return null;
        // Target
        case DEFEND_VILLAGE_TARGET:
            if (mob instanceof IronGolem) {
                return new DefendVillageTargetGoal((IronGolem) mob);
            }
            return null;
        case HURT_BY_TARGET:
            if (pathfinder == null)
                return null;
            return new HurtByTargetGoal(pathfinder);
        case NEAREST_ATTACKABLE_TARGET:
            return new NearestAttackableTargetGoal<>(mob, getMobClass(classType), see, reach);
        case OWNER_HURT_BY_TARGET:
            if (mob instanceof TamableAnimal) {
                return new OwnerHurtByTargetGoal((TamableAnimal) mob);
            }
        // Intentional fall-through
        case MAGIC_OWNER_HURT_BY_TARGET:
            return new MagicOwnerHurtByTargetGoal(platform, mob, entity, see, reach);
        case OWNER_HURT_TARGET:
            if (mob instanceof TamableAnimal) {
                return new OwnerHurtTargetGoal((TamableAnimal) mob);
            }
        // Intentional fall-through
        case MAGIC_OWNER_HURT_TARGET:
            return new MagicOwnerHurtTargetGoal(platform, mob, entity, see, reach);
        // Magic add-ons
        case FOLLOW_ENTITY:
        case MAGIC_FOLLOW_MOB:
            Class<? extends LivingEntity> mobClass = getMobClass(classType);
            if (mobClass == null) {
                platform.getLogger().warning("Unsupported entity_class in magic_follow_mob goal: " + classType);
                return null;
            }
            return new MagicFollowMobGoal(mob, speed, radius, distance, interval, mobClass);
        case REQUIREMENT:
        case REQUIREMENTS:
            if (pathfinder == null)
                return null;
            mage = controller.getMage(entity);
            Collection<Requirement> requirements = controller.getRequirements(config);
            goals = getGoals(entity, mob, config, "magic requirement goal");
            return new RequirementsGoal(mage, goals, interruptable, requirements);
        case GROUP:
            goals = getGoals(entity, mob, config, "magic group goal");
            return new MagicGoal(goals, interruptable);
        case TRIGGER:
            mage = controller.getMage(entity);
            goals = getGoals(entity, mob, config, "magic trigger goal");
            return new TriggerGoal(mage, goals, interruptable, config.getString("trigger", "goal"), interval);
        case FIND_OWNER:
            return new MagicFindOwnerGoal(platform, mob, radius, getMobClass(classType));
        case CHECK_OWNER:
            return new MagicCheckOwnerGoal(platform, mob);
        case IDLE:
            return new IdleGoal();
        case SPIN:
            return new SpinGoal(mob, (float) config.getDouble("degrees", 10));
        default:
            platform.getLogger().warning("Unsupported goal type: " + goalType);
            return null;
    }
}
Also used : TryFindWaterGoal(net.minecraft.world.entity.ai.goal.TryFindWaterGoal) TriggerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.TriggerGoal) IdleGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.IdleGoal) NearestAttackableTargetGoal(net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal) MagicGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.MagicGoal) SpinGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.SpinGoal) MageController(com.elmakers.mine.bukkit.api.magic.MageController) AvoidEntityGoal(net.minecraft.world.entity.ai.goal.AvoidEntityGoal) FollowBoatGoal(net.minecraft.world.entity.ai.goal.FollowBoatGoal) MagicOwnerHurtByTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.MagicOwnerHurtByTargetGoal) StrollThroughVillageGoal(net.minecraft.world.entity.ai.goal.StrollThroughVillageGoal) OcelotAttackGoal(net.minecraft.world.entity.ai.goal.OcelotAttackGoal) AvoidEntityGoal(net.minecraft.world.entity.ai.goal.AvoidEntityGoal) 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) 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) OpenDoorGoal(net.minecraft.world.entity.ai.goal.OpenDoorGoal) RandomLookAroundGoal(net.minecraft.world.entity.ai.goal.RandomLookAroundGoal) TriggerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.TriggerGoal) RandomStrollGoal(net.minecraft.world.entity.ai.goal.RandomStrollGoal) IdleGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.IdleGoal) TryFindWaterGoal(net.minecraft.world.entity.ai.goal.TryFindWaterGoal) MoveTowardsRestrictionGoal(net.minecraft.world.entity.ai.goal.MoveTowardsRestrictionGoal) MagicPanicGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.MagicPanicGoal) MoveTowardsTargetGoal(net.minecraft.world.entity.ai.goal.MoveTowardsTargetGoal) DefendVillageTargetGoal(net.minecraft.world.entity.ai.goal.target.DefendVillageTargetGoal) MagicOwnerHurtTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.MagicOwnerHurtTargetGoal) 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) MagicFollowMobGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.MagicFollowMobGoal) 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) MagicGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.MagicGoal) LeapAtTargetGoal(net.minecraft.world.entity.ai.goal.LeapAtTargetGoal) HurtByTargetGoal(net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal) RequirementsGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.RequirementsGoal) MagicFindOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.MagicFindOwnerGoal) 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) FleeSunGoal(net.minecraft.world.entity.ai.goal.FleeSunGoal) MagicCheckOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.MagicCheckOwnerGoal) 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) SpinGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.SpinGoal) MagicFollowOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.MagicFollowOwnerGoal) BegGoal(net.minecraft.world.entity.ai.goal.BegGoal) MeleeAttackGoal(net.minecraft.world.entity.ai.goal.MeleeAttackGoal) RestrictSunGoal(net.minecraft.world.entity.ai.goal.RestrictSunGoal) Horse(net.minecraft.world.entity.animal.horse.Horse) ZombieHorse(net.minecraft.world.entity.animal.horse.ZombieHorse) AbstractChestedHorse(net.minecraft.world.entity.animal.horse.AbstractChestedHorse) AbstractHorse(net.minecraft.world.entity.animal.horse.AbstractHorse) ZombieAttackGoal(net.minecraft.world.entity.ai.goal.ZombieAttackGoal) InteractGoal(net.minecraft.world.entity.ai.goal.InteractGoal) BreathAirGoal(net.minecraft.world.entity.ai.goal.BreathAirGoal) MoveBackToVillageGoal(net.minecraft.world.entity.ai.goal.MoveBackToVillageGoal) Zombie(net.minecraft.world.entity.monster.Zombie) MagicOwnerHurtByTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.MagicOwnerHurtByTargetGoal) MagicOwnerHurtByTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.MagicOwnerHurtByTargetGoal) OwnerHurtByTargetGoal(net.minecraft.world.entity.ai.goal.target.OwnerHurtByTargetGoal) MagicOwnerHurtTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.MagicOwnerHurtTargetGoal) MagicCheckOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.MagicCheckOwnerGoal) Requirement(com.elmakers.mine.bukkit.api.requirements.Requirement) Mage(com.elmakers.mine.bukkit.api.magic.Mage) Animal(net.minecraft.world.entity.animal.Animal) TamableAnimal(net.minecraft.world.entity.TamableAnimal) MagicFollowMobGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.MagicFollowMobGoal) LandOnOwnersShoulderGoal(net.minecraft.world.entity.ai.goal.LandOnOwnersShoulderGoal) BreedGoal(net.minecraft.world.entity.ai.goal.BreedGoal) LeapAtTargetGoal(net.minecraft.world.entity.ai.goal.LeapAtTargetGoal) MoveThroughVillageGoal(net.minecraft.world.entity.ai.goal.MoveThroughVillageGoal) ItemStack(net.minecraft.world.item.ItemStack) FollowOwnerGoal(net.minecraft.world.entity.ai.goal.FollowOwnerGoal) MagicFollowOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.MagicFollowOwnerGoal) MoveTowardsTargetGoal(net.minecraft.world.entity.ai.goal.MoveTowardsTargetGoal) DefendVillageTargetGoal(net.minecraft.world.entity.ai.goal.target.DefendVillageTargetGoal) MagicFollowOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.MagicFollowOwnerGoal) RunAroundLikeCrazyGoal(net.minecraft.world.entity.ai.goal.RunAroundLikeCrazyGoal) WaterAvoidingRandomStrollGoal(net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal) MoveTowardsRestrictionGoal(net.minecraft.world.entity.ai.goal.MoveTowardsRestrictionGoal) StrollThroughVillageGoal(net.minecraft.world.entity.ai.goal.StrollThroughVillageGoal) SwellGoal(net.minecraft.world.entity.ai.goal.SwellGoal) TamableAnimal(net.minecraft.world.entity.TamableAnimal) Creeper(net.minecraft.world.entity.monster.Creeper) TemptGoal(net.minecraft.world.entity.ai.goal.TemptGoal) FollowFlockLeaderGoal(net.minecraft.world.entity.ai.goal.FollowFlockLeaderGoal) OwnerHurtTargetGoal(net.minecraft.world.entity.ai.goal.target.OwnerHurtTargetGoal) MagicOwnerHurtTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.MagicOwnerHurtTargetGoal) IronGolem(net.minecraft.world.entity.animal.IronGolem) FleeSunGoal(net.minecraft.world.entity.ai.goal.FleeSunGoal) ShoulderRidingEntity(net.minecraft.world.entity.animal.ShoulderRidingEntity) EatBlockGoal(net.minecraft.world.entity.ai.goal.EatBlockGoal) LookAtPlayerGoal(net.minecraft.world.entity.ai.goal.LookAtPlayerGoal) Wolf(net.minecraft.world.entity.animal.Wolf) OpenDoorGoal(net.minecraft.world.entity.ai.goal.OpenDoorGoal) RandomStrollGoal(net.minecraft.world.entity.ai.goal.RandomStrollGoal) WaterAvoidingRandomStrollGoal(net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal) BreakDoorGoal(net.minecraft.world.entity.ai.goal.BreakDoorGoal) FollowParentGoal(net.minecraft.world.entity.ai.goal.FollowParentGoal) MagicOwnerHurtByTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.MagicOwnerHurtByTargetGoal) OwnerHurtByTargetGoal(net.minecraft.world.entity.ai.goal.target.OwnerHurtByTargetGoal) HurtByTargetGoal(net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal) GolemRandomStrollInVillageGoal(net.minecraft.world.entity.ai.goal.GolemRandomStrollInVillageGoal) Material(org.bukkit.Material) WaterAvoidingRandomFlyingGoal(net.minecraft.world.entity.ai.goal.WaterAvoidingRandomFlyingGoal) PanicGoal(net.minecraft.world.entity.ai.goal.PanicGoal) MagicPanicGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.MagicPanicGoal) MagicPanicGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.MagicPanicGoal) RandomLookAroundGoal(net.minecraft.world.entity.ai.goal.RandomLookAroundGoal) MagicFindOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.MagicFindOwnerGoal) RequirementsGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.RequirementsGoal) OcelotAttackGoal(net.minecraft.world.entity.ai.goal.OcelotAttackGoal) AbstractSchoolingFish(net.minecraft.world.entity.animal.AbstractSchoolingFish) FollowMobGoal(net.minecraft.world.entity.ai.goal.FollowMobGoal) MagicFollowMobGoal(com.elmakers.mine.bukkit.utility.platform.v1_18_2.goal.MagicFollowMobGoal) RandomSwimmingGoal(net.minecraft.world.entity.ai.goal.RandomSwimmingGoal) PathfinderMob(net.minecraft.world.entity.PathfinderMob) ItemUtils(com.elmakers.mine.bukkit.utility.platform.ItemUtils) FloatGoal(net.minecraft.world.entity.ai.goal.FloatGoal) OfferFlowerGoal(net.minecraft.world.entity.ai.goal.OfferFlowerGoal)

Example 4 with MagicFindOwnerGoal

use of com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicFindOwnerGoal in project MagicPlugin by elBukkit.

the class MobUtils method getGoal.

private Goal getGoal(GoalType goalType, Entity entity, Mob mob, ConfigurationSection config) {
    final String classType = config.getString("entity_class", "player");
    final double speed = config.getDouble("speed", 1);
    final double sprintSpeed = config.getDouble("sprint_speed", 1);
    final float distance = (float) config.getDouble("distance", 16);
    final boolean doors = config.getBoolean("doors", true);
    final boolean interruptable = config.getBoolean("interruptable", true);
    final boolean see = config.getBoolean("see", true);
    final boolean reach = config.getBoolean("reach", false);
    final float startDistance = (float) config.getDouble("start_distance", 5);
    final float stopDistance = (float) config.getDouble("stop_distance", 1);
    final float radius = (float) config.getDouble("radius", 16);
    final PathfinderMob pathfinder = mob instanceof PathfinderMob ? (PathfinderMob) mob : null;
    int interval = config.getInt("interval", 1000);
    // Interval is specified in ms, but needed in ticks
    interval = interval / 50;
    MageController controller = platform.getController();
    Mage mage;
    List<Goal> goals;
    switch(goalType) {
        case AVOID_ENTITY:
            if (pathfinder == null)
                return null;
            return new AvoidEntityGoal<>(pathfinder, getMobClass(classType), distance, sprintSpeed, sprintSpeed);
        case BEG:
            if (mob instanceof Wolf) {
                return new BegGoal((Wolf) mob, distance);
            }
            return null;
        case BREAK_DOOR:
            return new BreakDoorGoal(mob, difficulty -> true);
        case BREATHE_AIR:
            if (pathfinder == null)
                return null;
            return new BreathAirGoal(pathfinder);
        case BREED:
            if (mob instanceof Animal) {
                return new BreedGoal((Animal) mob, speed);
            }
            return null;
        case EAT_BLOCK:
            return new EatBlockGoal(mob);
        case FLEE_SUN:
            if (pathfinder == null)
                return null;
            return new FleeSunGoal(pathfinder, speed);
        case FLOAT:
            return new FloatGoal(mob);
        case FOLLOW_BOAT:
            if (pathfinder == null)
                return null;
            return new FollowBoatGoal(pathfinder);
        case FOLLOW_FLOCK_LEADER:
            if (mob instanceof AbstractSchoolingFish) {
                return new FollowFlockLeaderGoal((AbstractSchoolingFish) mob);
            }
            return null;
        case FOLLOW_MOB:
            return new FollowMobGoal(mob, speed, distance, radius);
        case FOLLOW_OWNER:
            if (mob instanceof TamableAnimal) {
                return new FollowOwnerGoal((TamableAnimal) mob, speed, startDistance, stopDistance, config.getBoolean("fly", false));
            }
        // Intentional fall-through
        case MAGIC_FOLLOW_OWNER:
            return new MagicFollowOwnerGoal(platform, mob, speed, startDistance, stopDistance, interval, config);
        case FOLLOW_PARENT:
            if (mob instanceof Animal) {
                return new FollowParentGoal((Animal) mob, speed);
            }
            return null;
        case GOLEM_RANDOM_STROLL_IN_VILLAGE:
            if (pathfinder == null)
                return null;
            return new GolemRandomStrollInVillageGoal(pathfinder, speed);
        case INTERACT:
            return new InteractGoal(mob, getMobClass(classType), distance, (float) config.getDouble("probability", 1));
        case LAND_ON_OWNERS_SHOULDER:
            if (mob instanceof ShoulderRidingEntity) {
                return new LandOnOwnersShoulderGoal((ShoulderRidingEntity) mob);
            }
            return null;
        case LEAP_AT_TARGET:
            return new LeapAtTargetGoal(mob, (float) config.getDouble("y_offset", 0.4));
        case LOOK_AT_PLAYER:
            return new LookAtPlayerGoal(mob, getMobClass(classType), distance, (float) config.getDouble("probability", 1), config.getBoolean("horizontal"));
        case MELEE_ATTACK:
            if (pathfinder == null)
                return null;
            return new MeleeAttackGoal(pathfinder, speed, config.getBoolean("follow", true));
        case MOVE_BACK_TO_VILLAGE:
            if (pathfinder == null)
                return null;
            return new MoveBackToVillageGoal(pathfinder, speed, config.getBoolean("check", true));
        case MOVE_THROUGH_VILLAGE:
            if (pathfinder == null)
                return null;
            return new MoveThroughVillageGoal(pathfinder, speed, config.getBoolean("night", true), (int) distance, (BooleanSupplier) () -> doors);
        case MOVE_TOWARDS_RESTRICTION:
            if (pathfinder == null)
                return null;
            return new MoveTowardsRestrictionGoal(pathfinder, speed);
        case MOVE_TOWARDS_TARGET:
            if (pathfinder == null)
                return null;
            return new MoveTowardsTargetGoal(pathfinder, speed, distance);
        case OCELOT_ATTACK:
            return new OcelotAttackGoal(mob);
        case OFFER_FLOWER:
            if (mob instanceof IronGolem) {
                return new OfferFlowerGoal((IronGolem) mob);
            }
            return null;
        case OPEN_DOOR:
            return new OpenDoorGoal(mob, config.getBoolean("close", false));
        case PANIC_FIRE:
            if (pathfinder == null)
                return null;
            return new PanicGoal(pathfinder, speed);
        case PANIC:
        case MAGIC_PANIC:
            if (pathfinder == null)
                return null;
            return new MagicPanicGoal(pathfinder, speed, config.getInt("panic", 3000), config.getInt("calm", 5000), interruptable);
        case RANDOM_LOOK_AROUND:
            return new RandomLookAroundGoal(mob);
        case RANDOM_STROLL:
            if (pathfinder == null)
                return null;
            return new RandomStrollGoal(pathfinder, speed, interval);
        case RANDOM_SWIMMING:
            if (pathfinder == null)
                return null;
            return new RandomSwimmingGoal(pathfinder, speed, interval);
        case RESTRICT_SUN:
            if (pathfinder == null)
                return null;
            return new RestrictSunGoal(pathfinder);
        case RUN_AROUND_LIKE_CRAZY:
            if (mob instanceof Horse) {
                return new RunAroundLikeCrazyGoal((Horse) mob, speed);
            }
            return null;
        case STROLL_THROUGH_VILLAGE:
            if (pathfinder == null)
                return null;
            return new StrollThroughVillageGoal(pathfinder, interval);
        case SWELL:
            if (mob instanceof Creeper) {
                return new SwellGoal((Creeper) mob);
            }
            return null;
        case TEMPT:
            if (pathfinder == null)
                return null;
            String itemKey = config.getString("item", "EMERALD");
            try {
                Material material = Material.valueOf(itemKey.toUpperCase());
                org.bukkit.inventory.ItemStack itemStack = new org.bukkit.inventory.ItemStack(material);
                ItemUtils itemUtils = platform.getItemUtils();
                itemStack = itemUtils.makeReal(itemStack);
                ItemStack nms = (ItemStack) itemUtils.getHandle(itemStack);
                if (nms == null) {
                    platform.getLogger().warning("Invalid item from material in temp goal: " + itemKey);
                    return null;
                }
                boolean scare = config.getBoolean("scare", false);
                return new TemptGoal(pathfinder, speed, Ingredient.of(nms), scare);
            } catch (Exception ex) {
                platform.getLogger().warning("Invalid material in temp goal: " + itemKey);
                return null;
            }
        case TRY_FIND_WATER:
            if (pathfinder == null)
                return null;
            return new TryFindWaterGoal(pathfinder);
        case WATER_AVOIDING_RANDOM_FLYING:
            if (pathfinder == null)
                return null;
            return new WaterAvoidingRandomFlyingGoal(pathfinder, speed);
        case WATER_AVOIDING_RANDOM_STROLL:
            if (pathfinder == null)
                return null;
            return new WaterAvoidingRandomStrollGoal(pathfinder, speed);
        case ZOMBIE_ATTACK:
            if (mob instanceof Zombie) {
                return new ZombieAttackGoal((Zombie) mob, speed, config.getBoolean("follow", true));
            }
            return null;
        // Target
        case DEFEND_VILLAGE_TARGET:
            if (mob instanceof IronGolem) {
                return new DefendVillageTargetGoal((IronGolem) mob);
            }
            return null;
        case HURT_BY_TARGET:
            if (pathfinder == null)
                return null;
            return new HurtByTargetGoal(pathfinder);
        case NEAREST_ATTACKABLE_TARGET:
            return new NearestAttackableTargetGoal<>(mob, getMobClass(classType), see, reach);
        case OWNER_HURT_BY_TARGET:
            if (mob instanceof TamableAnimal) {
                return new OwnerHurtByTargetGoal((TamableAnimal) mob);
            }
        // Intentional fall-through
        case MAGIC_OWNER_HURT_BY_TARGET:
            return new MagicOwnerHurtByTargetGoal(platform, mob, entity, see, reach);
        case OWNER_HURT_TARGET:
            if (mob instanceof TamableAnimal) {
                return new OwnerHurtTargetGoal((TamableAnimal) mob);
            }
        // Intentional fall-through
        case MAGIC_OWNER_HURT_TARGET:
            return new MagicOwnerHurtTargetGoal(platform, mob, entity, see, reach);
        // Magic add-ons
        case FOLLOW_ENTITY:
        case MAGIC_FOLLOW_MOB:
            Class<? extends LivingEntity> mobClass = getMobClass(classType);
            if (mobClass == null) {
                platform.getLogger().warning("Unsupported entity_class in magic_follow_mob goal: " + classType);
                return null;
            }
            return new MagicFollowMobGoal(mob, speed, radius, distance, interval, mobClass);
        case REQUIREMENT:
        case REQUIREMENTS:
            if (pathfinder == null)
                return null;
            mage = controller.getMage(entity);
            Collection<Requirement> requirements = controller.getRequirements(config);
            goals = getGoals(entity, mob, config, "magic requirement goal");
            return new RequirementsGoal(mage, goals, interruptable, requirements);
        case GROUP:
            goals = getGoals(entity, mob, config, "magic group goal");
            return new MagicGoal(goals, interruptable);
        case TRIGGER:
            mage = controller.getMage(entity);
            goals = getGoals(entity, mob, config, "magic trigger goal");
            return new TriggerGoal(mage, goals, interruptable, config.getString("trigger", "goal"), interval);
        case FIND_OWNER:
            return new MagicFindOwnerGoal(platform, mob, radius, getMobClass(classType));
        case CHECK_OWNER:
            return new MagicCheckOwnerGoal(platform, mob);
        case IDLE:
            return new IdleGoal();
        default:
            platform.getLogger().warning("Unsupported goal type: " + goalType);
            return null;
    }
}
Also used : TryFindWaterGoal(net.minecraft.world.entity.ai.goal.TryFindWaterGoal) TriggerGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.TriggerGoal) IdleGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.IdleGoal) NearestAttackableTargetGoal(net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal) MagicGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicGoal) MageController(com.elmakers.mine.bukkit.api.magic.MageController) AvoidEntityGoal(net.minecraft.world.entity.ai.goal.AvoidEntityGoal) FollowBoatGoal(net.minecraft.world.entity.ai.goal.FollowBoatGoal) 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) BegGoal(net.minecraft.world.entity.ai.goal.BegGoal) MeleeAttackGoal(net.minecraft.world.entity.ai.goal.MeleeAttackGoal) RestrictSunGoal(net.minecraft.world.entity.ai.goal.RestrictSunGoal) Horse(net.minecraft.world.entity.animal.horse.Horse) ZombieHorse(net.minecraft.world.entity.animal.horse.ZombieHorse) AbstractChestedHorse(net.minecraft.world.entity.animal.horse.AbstractChestedHorse) AbstractHorse(net.minecraft.world.entity.animal.horse.AbstractHorse) ZombieAttackGoal(net.minecraft.world.entity.ai.goal.ZombieAttackGoal) InteractGoal(net.minecraft.world.entity.ai.goal.InteractGoal) BreathAirGoal(net.minecraft.world.entity.ai.goal.BreathAirGoal) MoveBackToVillageGoal(net.minecraft.world.entity.ai.goal.MoveBackToVillageGoal) Zombie(net.minecraft.world.entity.monster.Zombie) MagicOwnerHurtByTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicOwnerHurtByTargetGoal) MagicOwnerHurtByTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicOwnerHurtByTargetGoal) OwnerHurtByTargetGoal(net.minecraft.world.entity.ai.goal.target.OwnerHurtByTargetGoal) MagicOwnerHurtTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicOwnerHurtTargetGoal) MagicCheckOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicCheckOwnerGoal) Requirement(com.elmakers.mine.bukkit.api.requirements.Requirement) Mage(com.elmakers.mine.bukkit.api.magic.Mage) Animal(net.minecraft.world.entity.animal.Animal) TamableAnimal(net.minecraft.world.entity.TamableAnimal) MagicFollowMobGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicFollowMobGoal) LandOnOwnersShoulderGoal(net.minecraft.world.entity.ai.goal.LandOnOwnersShoulderGoal) BreedGoal(net.minecraft.world.entity.ai.goal.BreedGoal) LeapAtTargetGoal(net.minecraft.world.entity.ai.goal.LeapAtTargetGoal) MoveThroughVillageGoal(net.minecraft.world.entity.ai.goal.MoveThroughVillageGoal) ItemStack(net.minecraft.world.item.ItemStack) FollowOwnerGoal(net.minecraft.world.entity.ai.goal.FollowOwnerGoal) MagicFollowOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicFollowOwnerGoal) MoveTowardsTargetGoal(net.minecraft.world.entity.ai.goal.MoveTowardsTargetGoal) DefendVillageTargetGoal(net.minecraft.world.entity.ai.goal.target.DefendVillageTargetGoal) MagicFollowOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicFollowOwnerGoal) RunAroundLikeCrazyGoal(net.minecraft.world.entity.ai.goal.RunAroundLikeCrazyGoal) WaterAvoidingRandomStrollGoal(net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal) MoveTowardsRestrictionGoal(net.minecraft.world.entity.ai.goal.MoveTowardsRestrictionGoal) StrollThroughVillageGoal(net.minecraft.world.entity.ai.goal.StrollThroughVillageGoal) SwellGoal(net.minecraft.world.entity.ai.goal.SwellGoal) TamableAnimal(net.minecraft.world.entity.TamableAnimal) Creeper(net.minecraft.world.entity.monster.Creeper) TemptGoal(net.minecraft.world.entity.ai.goal.TemptGoal) FollowFlockLeaderGoal(net.minecraft.world.entity.ai.goal.FollowFlockLeaderGoal) OwnerHurtTargetGoal(net.minecraft.world.entity.ai.goal.target.OwnerHurtTargetGoal) MagicOwnerHurtTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicOwnerHurtTargetGoal) IronGolem(net.minecraft.world.entity.animal.IronGolem) FleeSunGoal(net.minecraft.world.entity.ai.goal.FleeSunGoal) ShoulderRidingEntity(net.minecraft.world.entity.animal.ShoulderRidingEntity) EatBlockGoal(net.minecraft.world.entity.ai.goal.EatBlockGoal) LookAtPlayerGoal(net.minecraft.world.entity.ai.goal.LookAtPlayerGoal) Wolf(net.minecraft.world.entity.animal.Wolf) OpenDoorGoal(net.minecraft.world.entity.ai.goal.OpenDoorGoal) RandomStrollGoal(net.minecraft.world.entity.ai.goal.RandomStrollGoal) WaterAvoidingRandomStrollGoal(net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal) BreakDoorGoal(net.minecraft.world.entity.ai.goal.BreakDoorGoal) FollowParentGoal(net.minecraft.world.entity.ai.goal.FollowParentGoal) MagicOwnerHurtByTargetGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicOwnerHurtByTargetGoal) OwnerHurtByTargetGoal(net.minecraft.world.entity.ai.goal.target.OwnerHurtByTargetGoal) HurtByTargetGoal(net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal) GolemRandomStrollInVillageGoal(net.minecraft.world.entity.ai.goal.GolemRandomStrollInVillageGoal) Material(org.bukkit.Material) WaterAvoidingRandomFlyingGoal(net.minecraft.world.entity.ai.goal.WaterAvoidingRandomFlyingGoal) MagicPanicGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicPanicGoal) PanicGoal(net.minecraft.world.entity.ai.goal.PanicGoal) MagicPanicGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicPanicGoal) RandomLookAroundGoal(net.minecraft.world.entity.ai.goal.RandomLookAroundGoal) MagicFindOwnerGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicFindOwnerGoal) RequirementsGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.RequirementsGoal) OcelotAttackGoal(net.minecraft.world.entity.ai.goal.OcelotAttackGoal) AbstractSchoolingFish(net.minecraft.world.entity.animal.AbstractSchoolingFish) FollowMobGoal(net.minecraft.world.entity.ai.goal.FollowMobGoal) MagicFollowMobGoal(com.elmakers.mine.bukkit.utility.platform.v1_17_1.goal.MagicFollowMobGoal) RandomSwimmingGoal(net.minecraft.world.entity.ai.goal.RandomSwimmingGoal) PathfinderMob(net.minecraft.world.entity.PathfinderMob) ItemUtils(com.elmakers.mine.bukkit.utility.platform.ItemUtils) FloatGoal(net.minecraft.world.entity.ai.goal.FloatGoal) OfferFlowerGoal(net.minecraft.world.entity.ai.goal.OfferFlowerGoal)

Aggregations

Mage (com.elmakers.mine.bukkit.api.magic.Mage)4 MageController (com.elmakers.mine.bukkit.api.magic.MageController)4 Requirement (com.elmakers.mine.bukkit.api.requirements.Requirement)4 ItemUtils (com.elmakers.mine.bukkit.utility.platform.ItemUtils)4 PathfinderMob (net.minecraft.world.entity.PathfinderMob)4 TamableAnimal (net.minecraft.world.entity.TamableAnimal)4 AvoidEntityGoal (net.minecraft.world.entity.ai.goal.AvoidEntityGoal)4 BegGoal (net.minecraft.world.entity.ai.goal.BegGoal)4 BreakDoorGoal (net.minecraft.world.entity.ai.goal.BreakDoorGoal)4 BreathAirGoal (net.minecraft.world.entity.ai.goal.BreathAirGoal)4 BreedGoal (net.minecraft.world.entity.ai.goal.BreedGoal)4 EatBlockGoal (net.minecraft.world.entity.ai.goal.EatBlockGoal)4 FleeSunGoal (net.minecraft.world.entity.ai.goal.FleeSunGoal)4 FloatGoal (net.minecraft.world.entity.ai.goal.FloatGoal)4 FollowBoatGoal (net.minecraft.world.entity.ai.goal.FollowBoatGoal)4 FollowFlockLeaderGoal (net.minecraft.world.entity.ai.goal.FollowFlockLeaderGoal)4 FollowMobGoal (net.minecraft.world.entity.ai.goal.FollowMobGoal)4 FollowOwnerGoal (net.minecraft.world.entity.ai.goal.FollowOwnerGoal)4 FollowParentGoal (net.minecraft.world.entity.ai.goal.FollowParentGoal)4 Goal (net.minecraft.world.entity.ai.goal.Goal)4