Search in sources :

Example 6 with Monster

use of org.spongepowered.api.entity.living.monster.Monster in project Skree by Skelril.

the class FreakyFourInstance method runCharlotte.

private void runCharlotte() {
    Living boss = getBoss(FreakyFourBoss.CHARLOTTE).get();
    for (int i = Probability.getRandom(10); i > 0; --i) {
        spawnCharlotteMinion(boss.getLocation().getPosition());
    }
    ZoneBoundingBox charlotte_RG = regions.get(FreakyFourBoss.CHARLOTTE);
    switch(Probability.getRandom(3)) {
        case 1:
            createWall(charlotte_RG, type -> type == BlockTypes.AIR, type -> type == BlockTypes.WEB, BlockTypes.AIR, BlockTypes.WEB, 1, config.charlotteFloorWeb);
            break;
        case 2:
            if (boss instanceof Monster) {
                Optional<Entity> optTarget = ((Monster) boss).getTarget();
                if (optTarget.isPresent() && contains(optTarget.get())) {
                    Entity target = optTarget.get();
                    ZoneBoundingBox targetArea = new ZoneBoundingBox(target.getLocation().getPosition().sub(1, 1, 1).toInt(), new Vector3i(3, 3, 3));
                    targetArea.forAll(pt -> {
                        if (getRegion().getExtent().getBlockType(pt) == BlockTypes.AIR) {
                            getRegion().getExtent().setBlockType(pt, BlockTypes.WEB, Cause.source(SkreePlugin.container()).build());
                        }
                    });
                }
                break;
            }
        case 3:
            charlotte_RG.forAll(pt -> {
                if (!Probability.getChance(config.charlotteWebSpider)) {
                    return;
                }
                if (getRegion().getExtent().getBlockType(pt) == BlockTypes.WEB) {
                    getRegion().getExtent().setBlockType(pt, BlockTypes.AIR, Cause.source(SkreePlugin.container()).build());
                    spawnCharlotteMinion(pt.toDouble().add(.5, 0, .5));
                }
            });
            break;
    }
}
Also used : Entity(org.spongepowered.api.entity.Entity) Living(org.spongepowered.api.entity.living.Living) Monster(org.spongepowered.api.entity.living.monster.Monster) Vector3i(com.flowpowered.math.vector.Vector3i) ZoneBoundingBox(com.skelril.skree.service.internal.zone.ZoneBoundingBox)

Example 7 with Monster

use of org.spongepowered.api.entity.living.monster.Monster in project ClearMob by axle2005.

the class clearMain method run.

public void run(Boolean[] configoptions, List<EntityType> listEntityType, CommandSource src) {
    int removedEntities = 0;
    Map<UUID, Entity> entityData = new ConcurrentHashMap<>();
    for (World world : Sponge.getServer().getWorlds()) {
        for (Entity entity : world.getEntities()) {
            entityData.put(entity.getUniqueId(), entity);
        }
        for (Entity entity : entityData.values()) {
            if (!entity.isRemoved()) {
                if (entity instanceof Player) {
                } else if (entity.get(DisplayNameData.class).isPresent()) {
                // Checks if entity has nametag and ignores it.
                } else if (configoptions[1] == true && entity instanceof Monster) {
                    // KillAllMonsters
                    removedEntities++;
                    entity.remove();
                } else if (configoptions[2] == true && entity instanceof Item) {
                    // KillDrops
                    if (ClearItems.run(entity, plugin.getListItemType(), plugin.getitemWB())) {
                        removedEntities++;
                    }
                } else if (configoptions[3] == true && entity instanceof Animal) {
                    // KillAnimalGroups
                    removedEntities = removedEntities + animals.run(entity);
                } else {
                    if (wl.clear(entity, plugin.getListEntityType()) == true) {
                        removedEntities++;
                    }
                }
            }
        }
    }
    ClearTileEntity.run(plugin, plugin.getListTileEntityType(), plugin.getWorlds(), src);
    feedback(src, removedEntities);
}
Also used : Entity(org.spongepowered.api.entity.Entity) Item(org.spongepowered.api.entity.Item) Player(org.spongepowered.api.entity.living.player.Player) Animal(org.spongepowered.api.entity.living.animal.Animal) Monster(org.spongepowered.api.entity.living.monster.Monster) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) UUID(java.util.UUID) World(org.spongepowered.api.world.World)

Aggregations

Monster (org.spongepowered.api.entity.living.monster.Monster)7 Entity (org.spongepowered.api.entity.Entity)4 Listener (org.spongepowered.api.event.Listener)4 World (org.spongepowered.api.world.World)4 Player (org.spongepowered.api.entity.living.player.Player)3 ItemDropper (com.skelril.nitro.item.ItemDropper)2 Living (org.spongepowered.api.entity.living.Living)2 Boss (org.spongepowered.api.entity.living.monster.Boss)2 Egg (org.spongepowered.api.entity.projectile.Egg)2 BlockSpawnCause (org.spongepowered.api.event.cause.entity.spawn.BlockSpawnCause)2 Vector3i (com.flowpowered.math.vector.Vector3i)1 PlayerCombatParser (com.skelril.nitro.combat.PlayerCombatParser)1 DropTable (com.skelril.nitro.droptable.DropTable)1 MasterDropTable (com.skelril.nitro.droptable.MasterDropTable)1 ItemStackFactory.newItemStack (com.skelril.nitro.item.ItemStackFactory.newItemStack)1 IntegratedRunnable (com.skelril.nitro.time.IntegratedRunnable)1 TimedRunnable (com.skelril.nitro.time.TimedRunnable)1 WanderingBoss (com.skelril.skree.content.world.wilderness.wanderer.WanderingBoss)1 ModifierService (com.skelril.skree.service.ModifierService)1 PvPService (com.skelril.skree.service.PvPService)1