Search in sources :

Example 16 with Vector3i

use of com.flowpowered.math.vector.Vector3i 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 17 with Vector3i

use of com.flowpowered.math.vector.Vector3i in project Skree by Skelril.

the class CatacombsInstance method setUp.

private void setUp() {
    Vector3i min = getRegion().getMinimumPoint();
    this.entryPoint = new Location<>(getRegion().getExtent(), min.getX() + 17.5, min.getY() + 1, min.getZ() + 58.5);
    Task.builder().execute(this::checkedSpawnWave).delay(5, TimeUnit.SECONDS).submit(SkreePlugin.inst());
}
Also used : Vector3i(com.flowpowered.math.vector.Vector3i)

Example 18 with Vector3i

use of com.flowpowered.math.vector.Vector3i in project Skree by Skelril.

the class CatacombsInstance method spawnNormalWave.

private void spawnNormalWave() {
    Vector3i min = getRegion().getMinimumPoint();
    Vector3i max = getRegion().getMaximumPoint();
    int minX = min.getX();
    int minZ = min.getZ();
    int maxX = max.getX();
    int maxZ = max.getZ();
    final int y = min.getY() + 2;
    int needed = getSpawnCount(wave);
    for (int i = needed; i > 0; --i) {
        int x, z;
        BlockType type, aboveType;
        do {
            x = Probability.getRangedRandom(minX, maxX);
            z = Probability.getRangedRandom(minZ, maxZ);
            type = getRegion().getExtent().getBlockType(x, y, z);
            aboveType = getRegion().getExtent().getBlockType(x, y + 1, z);
        } while (type != BlockTypes.AIR || aboveType != BlockTypes.AIR);
        spawnWaveMob(new Location<>(getRegion().getExtent(), x + .5, y, z + .5));
    }
}
Also used : BlockType(org.spongepowered.api.block.BlockType) Vector3i(com.flowpowered.math.vector.Vector3i)

Example 19 with Vector3i

use of com.flowpowered.math.vector.Vector3i in project Skree by Skelril.

the class JurackOrePopulator method populate.

@Override
public void populate(World world, Extent volume, Random random) {
    Vector3i min = volume.getBlockMin();
    Vector3i max = volume.getBlockMax();
    for (int x = min.getX(); x <= max.getX(); ++x) {
        for (int z = min.getZ(); z <= max.getZ(); ++z) {
            if (random.nextInt(20) != 0) {
                continue;
            }
            for (int y = min.getY(); y < 20; ++y) {
                Vector3i searchPoint = new Vector3i(x, y, z);
                if (world.getBlockType(searchPoint) == BlockTypes.LAVA) {
                    Vector3i above = searchPoint.add(0, 1, 0);
                    if (world.getBlockType(above) == BlockTypes.LAVA) {
                        Vector3i lowPoint = searchPoint.add(0, -1, 0);
                        if (world.getBlockType(lowPoint) == BlockTypes.STONE) {
                            world.setBlockType(lowPoint, (BlockType) CustomBlockTypes.JURACK_ORE, Cause.source(SkreePlugin.container()).build());
                        }
                    }
                }
            }
        }
    }
}
Also used : Vector3i(com.flowpowered.math.vector.Vector3i)

Example 20 with Vector3i

use of com.flowpowered.math.vector.Vector3i in project Skree by Skelril.

the class MagicMushroomPopulator method populate.

@Override
public void populate(World world, Extent volume, Random random) {
    Vector3i min = volume.getBlockMin();
    Vector3i chunkPos = new Vector3i(min.getX(), min.getY(), min.getZ());
    for (int i = 0; i < mushroomCount; ++i) {
        int x = random.nextInt(16) + 8;
        int z = random.nextInt(16) + 8;
        int y = random.nextInt(40);
        generate(tf(world), random, tf(chunkPos.add(x, y, z)));
    }
}
Also used : Vector3i(com.flowpowered.math.vector.Vector3i)

Aggregations

Vector3i (com.flowpowered.math.vector.Vector3i)28 World (org.spongepowered.api.world.World)11 Location (org.spongepowered.api.world.Location)8 BlockType (org.spongepowered.api.block.BlockType)5 ZoneBoundingBox (com.skelril.skree.service.internal.zone.ZoneBoundingBox)4 Vector3d (com.flowpowered.math.vector.Vector3d)3 Vector2i (com.flowpowered.math.vector.Vector2i)2 EditSession (com.sk89q.worldedit.EditSession)2 Vector (com.sk89q.worldedit.Vector)2 ItemDropper (com.skelril.nitro.item.ItemDropper)2 PositionRandomizer (com.skelril.nitro.position.PositionRandomizer)2 IntegratedRunnable (com.skelril.nitro.time.IntegratedRunnable)2 TimedRunnable (com.skelril.nitro.time.TimedRunnable)2 Entity (org.spongepowered.api.entity.Entity)2 Listener (org.spongepowered.api.event.Listener)2 ItemStack (org.spongepowered.api.item.inventory.ItemStack)2 Vector2d (com.flowpowered.math.vector.Vector2d)1 MaxChangedBlocksException (com.sk89q.worldedit.MaxChangedBlocksException)1 Clipboard (com.sk89q.worldedit.extent.clipboard.Clipboard)1 Operation (com.sk89q.worldedit.function.operation.Operation)1