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);
}
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);
}
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!");
}
}
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!");
}
}
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);
}
Aggregations