Search in sources :

Example 1 with EntityShadowlord

use of net.tslat.aoa3.entity.boss.shadowlord.EntityShadowlord in project Advent-Of-Ascension by Tslat.

the class ShadowlordSpawnTask method run.

@Override
public void run() {
    if (spawned) {
        for (int x = -2; x <= 2; x += 4) {
            for (int z = -2; z <= 2; z += 4) {
                BlockPos pos = altarPosition.add(x, 1, z);
                Block block = player.world.getBlockState(pos).getBlock();
                if (block instanceof LampBlock)
                    player.world.setBlockState(pos, ((LampBlock) block).getOnLamp().getDefaultState().withProperty(LampBlock.FIXED_LAMP, true));
            }
        }
    } else if (spawning) {
        spawned = true;
        EntityShadowlord shadowlord = new EntityShadowlord(player.world);
        shadowlord.setLocationAndAngles(altarPosition.getX(), altarPosition.getY() + 3, altarPosition.getZ(), 0, 0);
        player.world.spawnEntity(shadowlord);
        StringUtil.sendMessageWithinRadius(StringUtil.getLocaleWithArguments("message.mob.shadowlord.spawn", player.getDisplayNameString()), player, 50);
        schedule(5, TimeUnit.SECONDS);
    } else {
        for (int x = -2; x <= 2; x++) {
            for (int y = 0; y <= 1; y++) {
                for (int z = -2; z <= 2; z++) {
                    BlockPos pos = altarPosition.add(x, y, z);
                    IBlockState state = player.world.getBlockState(pos);
                    Block block = state.getBlock();
                    if (block instanceof LampBlock && block != ((LampBlock) block).getOffLamp()) {
                        player.world.setBlockState(pos, ((LampBlock) block).getOffLamp().getDefaultState(), 2);
                        schedule(2, TimeUnit.SECONDS);
                        player.world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, pos.getX(), pos.getY(), pos.getZ(), 0, 0, 0);
                        return;
                    }
                }
            }
        }
        spawning = true;
        schedule(1, TimeUnit.SECONDS);
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) LampBlock(net.tslat.aoa3.block.functional.lamps.LampBlock) Block(net.minecraft.block.Block) LampBlock(net.tslat.aoa3.block.functional.lamps.LampBlock) BlockPos(net.minecraft.util.math.BlockPos) EntityShadowlord(net.tslat.aoa3.entity.boss.shadowlord.EntityShadowlord)

Aggregations

Block (net.minecraft.block.Block)1 IBlockState (net.minecraft.block.state.IBlockState)1 BlockPos (net.minecraft.util.math.BlockPos)1 LampBlock (net.tslat.aoa3.block.functional.lamps.LampBlock)1 EntityShadowlord (net.tslat.aoa3.entity.boss.shadowlord.EntityShadowlord)1