Search in sources :

Example 1 with CustomBossEntity

use of com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity in project EliteMobs by MagmaGuy.

the class DebugScreen method openBossScreen.

private static void openBossScreen(Player player, String argument) {
    TextComponent[] pages = new TextComponent[100];
    int counter = 0;
    for (EliteEntity eliteEntity : EntityTracker.getEliteMobEntities().values()) if (!(eliteEntity instanceof RegionalBossEntity))
        if (eliteEntity instanceof CustomBossEntity) {
            TextComponent textComponent = generateEntry((CustomBossEntity) eliteEntity, argument, player);
            if (textComponent == null)
                continue;
            pages[counter] = textComponent;
            counter++;
        }
    for (RegionalBossEntity regionalBossEntity : RegionalBossEntity.getRegionalBossEntities()) {
        TextComponent textComponent = generateEntry(regionalBossEntity, argument, player);
        if (textComponent == null)
            continue;
        pages[counter] = textComponent;
        counter++;
    }
    BookMaker.generateBook(player, pages);
}
Also used : TextComponent(net.md_5.bungee.api.chat.TextComponent) EliteEntity(com.magmaguy.elitemobs.mobconstructor.EliteEntity) CustomBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity) RegionalBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity)

Example 2 with CustomBossEntity

use of com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity in project EliteMobs by MagmaGuy.

the class SpawnCommand method spawnCustomBossCommand.

public static void spawnCustomBossCommand(Player player, String fileName) {
    CustomBossesConfigFields customBossesConfigFields = CustomBossesConfig.getCustomBoss(fileName);
    if (customBossesConfigFields == null) {
        player.sendMessage("Filename " + fileName + " is not valid! Make sure you are writing the name of a configuration file in the custombosses folder!");
        return;
    }
    CustomBossEntity customBossEntity = new CustomBossEntity(customBossesConfigFields);
    customBossEntity.setSpawnLocation(getLocation(player));
    customBossEntity.spawn(false);
}
Also used : CustomBossesConfigFields(com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields) CustomBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity)

Example 3 with CustomBossEntity

use of com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity in project EliteMobs by MagmaGuy.

the class SpawnCommand method spawnCustomBossCommand.

public static void spawnCustomBossCommand(CommandSender commandSender, String fileName, String world, Vector coords) {
    try {
        Location location = new Location(Bukkit.getWorld(world), coords.getX(), coords.getY(), coords.getZ());
        CustomBossesConfigFields customBossesConfigFields = CustomBossesConfig.getCustomBoss(fileName);
        if (customBossesConfigFields == null) {
            commandSender.sendMessage("Filename " + fileName + " is not valid! Make sure you are writing the name of a configuration file in the custombosses folder!");
            return;
        }
        CustomBossEntity customBossEntity = new CustomBossEntity(customBossesConfigFields);
        customBossEntity.setSpawnLocation(location);
        customBossEntity.spawn(false);
    } catch (Exception e) {
        commandSender.sendMessage("[EliteMobs] World argument was not valid!");
    }
}
Also used : CustomBossesConfigFields(com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields) CustomBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity) Location(org.bukkit.Location)

Example 4 with CustomBossEntity

use of com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity in project EliteMobs by MagmaGuy.

the class EnderDragonEndermiteBombardment method taskBehavior.

@Override
public void taskBehavior(EliteEntity eliteEntity) {
    try {
        Vector direction = eliteEntity.getLivingEntity().getLocation().getDirection();
        float rotation = (float) (Math.atan2(direction.getX(), direction.getZ()) * 180 / Math.PI);
        Vector direction1 = new Vector(1, -4, 0);
        Vector direction2 = new Vector(-1, -4, 0);
        direction1 = direction1.rotateAroundY(rotation);
        direction2 = direction2.rotateAroundY(rotation);
        CustomBossEntity customBossEntity1 = CustomBossEntity.createCustomBossEntity("binder_of_worlds_phase_1_endermite_reinforcement.yml");
        customBossEntity1.spawn(eliteEntity.getLivingEntity().getLocation().clone().add(direction1), false);
        customBossEntity1.getLivingEntity().addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 20 * 5, 0));
        eliteEntity.addReinforcement(customBossEntity1);
        CustomBossEntity customBossEntity2 = CustomBossEntity.createCustomBossEntity("binder_of_worlds_phase_1_endermite_reinforcement.yml");
        customBossEntity2.spawn(eliteEntity.getLivingEntity().getLocation().clone().add(direction2), false);
        customBossEntity2.getLivingEntity().addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 20 * 5, 0));
        eliteEntity.addReinforcement(customBossEntity2);
    } catch (Exception ex) {
        new WarningMessage("Failed to spawn binder of world's reinforcement endermite!");
    }
}
Also used : WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage) PotionEffect(org.bukkit.potion.PotionEffect) CustomBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity) Vector(org.bukkit.util.Vector)

Example 5 with CustomBossEntity

use of com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity in project EliteMobs by MagmaGuy.

the class ZombieNecronomicon method spawnReinforcements.

private void spawnReinforcements(EliteEntity eliteEntity, LivingEntity targetted, ZombieNecronomicon zombieNecronomicon) {
    LivingEntity targetter = eliteEntity.getLivingEntity();
    new BukkitRunnable() {

        final ArrayList<Entity> entityList = new ArrayList<>();

        @Override
        public void run() {
            if (!eliteEntity.isValid() || !targetted.isValid() || !targetter.isValid() || targetted.getWorld() != targetter.getWorld() || targetted.getLocation().distance(targetter.getLocation()) > 30) {
                for (Entity entity : entityList) if (entity.isValid())
                    entity.remove();
                if (eliteEntity.isValid())
                    targetter.setAI(true);
                cancel();
                return;
            }
            int randomizedNumber = ThreadLocalRandom.current().nextInt(5) + 1;
            entityList.removeIf(currentEntity -> !currentEntity.isValid());
            if (entityList.size() < 11) {
                targetter.setAI(false);
                if (!zombieNecronomicon.isFiring())
                    necronomiconVisualEffect(eliteEntity, zombieNecronomicon);
                if (randomizedNumber < 5) {
                    CustomBossEntity customBossEntity = CustomBossEntity.createCustomBossEntity("necronomicon_zombie.yml");
                    if (customBossEntity == null) {
                        new WarningMessage("necronomicon_zombie.yml is not valid!");
                        return;
                    }
                    customBossEntity.spawn(targetter.getLocation(), eliteEntity.getLevel(), false);
                    if (!customBossEntity.getLivingEntity().isValid()) {
                        targetter.setAI(true);
                        cancel();
                        targetter.setAI(true);
                        cancel();
                        return;
                    }
                    customBossEntity.getLivingEntity().setVelocity(new Vector((ThreadLocalRandom.current().nextDouble() - 0.5) / 30, 0.5, (ThreadLocalRandom.current().nextDouble() - 0.5) / 30));
                    eliteEntity.addReinforcement(customBossEntity);
                    entityList.add(customBossEntity.getLivingEntity());
                } else {
                    CustomBossEntity customBossEntity = CustomBossEntity.createCustomBossEntity("necronomicon_skeleton.yml");
                    if (customBossEntity == null) {
                        new WarningMessage("necronomicon_skeleton.yml is not valid!");
                        targetter.setAI(true);
                        cancel();
                        return;
                    }
                    customBossEntity.spawn(targetter.getLocation(), eliteEntity.getLevel(), false);
                    if (!customBossEntity.getLivingEntity().isValid()) {
                        targetter.setAI(true);
                        cancel();
                        return;
                    }
                    customBossEntity.getLivingEntity().setVelocity(new Vector((ThreadLocalRandom.current().nextDouble() - 0.5) / 30, 0.5, (ThreadLocalRandom.current().nextDouble() - 0.5) / 30));
                    eliteEntity.addReinforcement(customBossEntity);
                    entityList.add(customBossEntity.getLivingEntity());
                }
            } else
                targetter.setAI(true);
        }
    }.runTaskTimer(MetadataHandler.PLUGIN, 20 * 3L, 20 * 3L);
}
Also used : LivingEntity(org.bukkit.entity.LivingEntity) WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage) Item(org.bukkit.entity.Item) HashMap(java.util.HashMap) EliteEntity(com.magmaguy.elitemobs.mobconstructor.EliteEntity) MobCombatSettingsConfig(com.magmaguy.elitemobs.config.MobCombatSettingsConfig) MajorPower(com.magmaguy.elitemobs.powers.meta.MajorPower) ArrayList(java.util.ArrayList) EventHandler(org.bukkit.event.EventHandler) Location(org.bukkit.Location) ThreadLocalRandom(java.util.concurrent.ThreadLocalRandom) MetadataHandler(com.magmaguy.elitemobs.MetadataHandler) ChatColorConverter.convert(com.magmaguy.elitemobs.ChatColorConverter.convert) GenericRotationMatrixMath(com.magmaguy.elitemobs.powerstances.GenericRotationMatrixMath) EliteMobDamagedByPlayerEvent(com.magmaguy.elitemobs.api.EliteMobDamagedByPlayerEvent) Material(org.bukkit.Material) Listener(org.bukkit.event.Listener) Entity(org.bukkit.entity.Entity) BukkitRunnable(org.bukkit.scheduler.BukkitRunnable) VisualItemInitializer(com.magmaguy.elitemobs.powerstances.VisualItemInitializer) EntityTracker(com.magmaguy.elitemobs.entitytracker.EntityTracker) LivingEntity(org.bukkit.entity.LivingEntity) CustomBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity) ItemStack(org.bukkit.inventory.ItemStack) Vector(org.bukkit.util.Vector) List(java.util.List) PowersConfig(com.magmaguy.elitemobs.config.powers.PowersConfig) EliteEntity(com.magmaguy.elitemobs.mobconstructor.EliteEntity) Entity(org.bukkit.entity.Entity) LivingEntity(org.bukkit.entity.LivingEntity) CustomBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity) WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage) ArrayList(java.util.ArrayList) BukkitRunnable(org.bukkit.scheduler.BukkitRunnable) CustomBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity) Vector(org.bukkit.util.Vector)

Aggregations

CustomBossEntity (com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity)22 WarningMessage (com.magmaguy.elitemobs.utils.WarningMessage)9 CustomBossesConfigFields (com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields)5 EliteEntity (com.magmaguy.elitemobs.mobconstructor.EliteEntity)5 Location (org.bukkit.Location)5 EventHandler (org.bukkit.event.EventHandler)5 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)5 Vector (org.bukkit.util.Vector)5 RegionalBossEntity (com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity)3 ArrayList (java.util.ArrayList)3 Entity (org.bukkit.entity.Entity)3 LivingEntity (org.bukkit.entity.LivingEntity)3 MetadataHandler (com.magmaguy.elitemobs.MetadataHandler)2 HashMap (java.util.HashMap)2 List (java.util.List)2 ThreadLocalRandom (java.util.concurrent.ThreadLocalRandom)2 TextComponent (net.md_5.bungee.api.chat.TextComponent)2 Player (org.bukkit.entity.Player)2 Wolf (org.bukkit.entity.Wolf)2 PotionEffect (org.bukkit.potion.PotionEffect)2